wjvonline opened a new issue #2036: COUNT( 1 ) Spaces ERROR
URL: https://github.com/apache/incubator-shardingsphere/issues/2036
 
 
   The mybatis plus generated statement has Spaces: IService.count()
   
   Example:
   SELECT COUNT( 1 ) FROM table;
   
   Execution error:
   
   Caused by: java.lang.IllegalStateException: Can't find index: 
AggregationSelectItem(type=COUNT, innerExpression=( 1 ), 
alias=Optional.absent(), derivedAggregationSelectItems=[], index=-1), please 
add alias for aggregate selections
        at 
com.google.common.base.Preconditions.checkState(Preconditions.java:507)
        at 
io.shardingsphere.core.parsing.parser.sql.dql.select.SelectStatement.setIndexForAggregationItem(SelectStatement.java:186)
        at 
io.shardingsphere.core.parsing.parser.sql.dql.select.SelectStatement.setIndexForItems(SelectStatement.java:179)
        at 
io.shardingsphere.core.merger.dql.DQLMergeEngine.merge(DQLMergeEngine.java:69)
        at ### 
**io.shardingsphere.shardingjdbc.jdbc.core.statement.ShardingPreparedStatement.getResultSet(ShardingPreparedStatement.java:185)**
        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.PreparedStatementLogger.invoke(PreparedStatementLogger.java:69)
        at com.sun.proxy.$Proxy108.getResultSet(Unknown Source)
        at 
org.apache.ibatis.executor.resultset.DefaultResultSetHandler.getFirstResultSet(DefaultResultSetHandler.java:237)
        at 
org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSets(DefaultResultSetHandler.java:187)
        at 
org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:65)
        at 
org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)
        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.plugin.Plugin.invoke(Plugin.java:63)
        at com.sun.proxy.$Proxy106.query(Unknown Source)
        at 
org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63)
        at 
org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324)
        at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
        at 
org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
        at 
org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83)
        at 
org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)
        ... 45 more
   
   I think the SQL was executed, but could not be parsed when the result set 
was fetched for a merge.
   
   sharding-jdcb version: 3.0.0, 3.0.0.M3, 3.1.0
   mybatis-plus version: 3.0.7.1
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to