zhou degao created CALCITE-1865: ----------------------------------- Summary: select count(1) from (select sum(1) .... without group by failed Key: CALCITE-1865 URL: https://issues.apache.org/jira/browse/CALCITE-1865 Project: Calcite Issue Type: Bug Reporter: zhou degao Assignee: Julian Hyde
sqlline> !connect jdbc:calcite:model=core/target/test-classes/test-mysql-model.j son admin admin; 0: jdbc:calcite:model=core/target/test-classe> select count(1) from (select sum( 1) from R_DATABASE ) a; Error: Error while executing SQL "select count(1) from (select sum(1) from R_DAT ABASE ) a": while executing SQL [SELECT COUNT(*) FROM (SELECT FROM `codedata`.`R_DATABASE` GROUP BY ()) AS `t`] (state=,code=0) java.sql.SQLException: Error while executing SQL "select count(1) from (select s um(1) from R_DATABASE ) a": while executing SQL [SELECT COUNT(*) FROM (SELECT FROM `codedata`.`R_DATABASE` GROUP BY ()) AS `t`] at org.apache.calcite.avatica.Helper.createException(Helper.java:56) at org.apache.calcite.avatica.Helper.createException(Helper.java:41) at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaSt atement.java:156) at org.apache.calcite.avatica.AvaticaStatement.execute(AvaticaStatement. java:209) at sqlline.Commands.execute(Commands.java:822) at sqlline.Commands.sql(Commands.java:732) at sqlline.SqlLine.dispatch(SqlLine.java:813) at sqlline.SqlLine.begin(SqlLine.java:686) at sqlline.SqlLine.start(SqlLine.java:398) at sqlline.SqlLine.main(SqlLine.java:291) Caused by: java.lang.RuntimeException: while executing SQL [SELECT COUNT(*) FROM (SELECT FROM `codedata`.`R_DATABASE` GROUP BY ()) AS `t`] at org.apache.calcite.runtime.ResultSetEnumerable.enumerator(ResultSetEn umerable.java:154) at org.apache.calcite.linq4j.AbstractEnumerable.iterator(AbstractEnumera ble.java:33) at org.apache.calcite.avatica.MetaImpl.createCursor(MetaImpl.java:81) at org.apache.calcite.avatica.AvaticaResultSet.execute(AvaticaResultSet. java:196) at org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.jav a:67) at org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.jav a:44) at org.apache.calcite.avatica.AvaticaConnection$1.execute(AvaticaConnect ion.java:607) at org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMeta Impl.java:600) at org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInterna l(AvaticaConnection.java:615) at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaSt atement.java:148) ... 7 more Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have a n error in your SQL syntax; check the manual that corresponds to your MySQL serv er version for the right syntax to use near 'FROM `codedata`.`R_DATABASE` GROUP BY ()) AS `t`' at line 3 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou rce) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.Util.getInstance(Util.java:386) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4096) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4028) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2490) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2651) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2677) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2627) at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:841) at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:681) at org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStateme nt.java:264) at org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStateme nt.java:264) at org.apache.calcite.runtime.ResultSetEnumerable.enumerator(ResultSetEn umerable.java:144) ... 16 more 0: jdbc:calcite:model=core/target/test-classe> -- This message was sent by Atlassian JIRA (v6.4.14#64029)