当前使用版本(必填,否则不予处理)

3.5.2

该问题是如何引起的?(确定最新版也有问题再提!!!)

使用oracle数据库,shardingsphere(5.1.1)数据源,用lambdaQuery().count()查询时会出现异常 原因:oracle查询的列会读取为COUNT(*),而sql解析器里面的列是COUNT( * ),括号中多了空格,返回结果时会找不到结果列 建议:查询数量也加上别名

重现步骤(如果有就写完整)

1.连接oracle数据库 2.使用shardingsphere数据源 3.Long count = baseMapper.selectCount(new QueryWrapper<>()); 4.exception: can't get index from columnLabel[COUNT(*)]

报错信息

Caused by: java.sql.SQLFeatureNotSupportedException: can't get index from columnLabel[COUNT(*)]. at org.apache.shardingsphere.driver.jdbc.core.resultset.ShardingSphereResultSet.getIndexFromColumnLabelAndIndexMap(ShardingSphereResultSet.java:424) at org.apache.shardingsphere.driver.jdbc.core.resultset.ShardingSphereResultSet.getLong(ShardingSphereResultSet.java:167) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.ibatis.logging.jdbc.ResultSetLogger.invoke(ResultSetLogger.java:69) at com.sun.proxy.$Proxy502.getLong(Unknown Source) at org.apache.ibatis.type.LongTypeHandler.getNullableResult(LongTypeHandler.java:37) at org.apache.ibatis.type.LongTypeHandler.getNullableResult(LongTypeHandler.java:26) at org.apache.ibatis.type.BaseTypeHandler.getResult(BaseTypeHandler.java:85) MyBatis-Plus 使用shardingjdbc连接oracle查询selectCount异常

Comment From: huayanYu

根据我的经验应该是找sharding

Comment From: miemieYaho

3.5.2.6-SNAPSHOT

Comment From: linghengqian

  • You need to submit a minimal reproducible example to https://github.com/apache/shardingsphere as much as possible. Considering that the license of the Oracle JDBC Driver itself is in serious conflict with the Apache community, ShardingSphere only performs unit testing on Oracle SQL through Antlr 4.