osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[jira] [Created] (CALCITE-2325) Calcite can not verify a explicit cast column in some senario


Yuzhao Chen created CALCITE-2325:
------------------------------------

             Summary: Calcite can not verify a explicit cast column in some senario
                 Key: CALCITE-2325
                 URL: https://issues.apache.org/jira/browse/CALCITE-2325
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.17.0
            Reporter: Yuzhao Chen
            Assignee: Julian Hyde
             Fix For: 1.17.0


In now calcite core, there is a test case in agg.ig

 

select cast(deptno as decimal) / 2 + 1 as half1, count(*) as c
from emp
group by rollup(deptno / 2, gender), rollup(substring(ename FROM 1 FOR 1));

But if we add in a explicit cast, it will throw an error 

Caused by: org.apache.calcite.runtime.CalciteContextException: From line 1, column 13 to line 1, column 18: Expression 'DEPTNO' is not being grouped
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
 at org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:463)
 at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:810)
 at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:795)
 at org.apache.calcite.sql.validate.SqlValidatorImpl.newValidationError(SqlValidatorImpl.java:4749)
 at org.apache.calcite.sql.validate.AggChecker.visit(AggChecker.java:117)
 at org.apache.calcite.sql.validate.AggChecker.visit(AggChecker.java:41)
 at org.apache.calcite.sql.SqlIdentifier.accept(SqlIdentifier.java:344)
 at org.apache.calcite.sql.util.SqlBasicVisitor$ArgHandlerImpl.visitChild(SqlBasicVisitor.java:123)
 at org.apache.calcite.sql.SqlOperator.acceptCall(SqlOperator.java:859)
 at org.apache.calcite.sql.validate.AggChecker.visit(AggChecker.java:212)
 at org.apache.calcite.sql.validate.AggChecker.visit(AggChecker.java:41)
 at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:138)
 at org.apache.calcite.sql.util.SqlBasicVisitor$ArgHandlerImpl.visitChild(SqlBasicVisitor.java:123)
 at org.apache.calcite.sql.SqlOperator.acceptCall(SqlOperator.java:859)
 at org.apache.calcite.sql.validate.AggChecker.visit(AggChecker.java:212)
 at org.apache.calcite.sql.validate.AggChecker.visit(AggChecker.java:41)
 at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:138)
 at org.apache.calcite.sql.util.SqlBasicVisitor$ArgHandlerImpl.visitChild(SqlBasicVisitor.java:123)
 at org.apache.calcite.sql.SqlOperator.acceptCall(SqlOperator.java:859)
 at org.apache.calcite.sql.validate.AggChecker.visit(AggChecker.java:212)
 at org.apache.calcite.sql.validate.AggChecker.visit(AggChecker.java:41)
 at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:138)
 at org.apache.calcite.sql.util.SqlBasicVisitor$ArgHandlerImpl.visitChild(SqlBasicVisitor.java:123)
 at org.apache.calcite.sql.SqlAsOperator.acceptCall(SqlAsOperator.java:121)
 at org.apache.calcite.sql.validate.AggChecker.visit(AggChecker.java:212)
 at org.apache.calcite.sql.validate.AggChecker.visit(AggChecker.java:41)
 at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:138)
 at org.apache.calcite.sql.validate.AggregatingSelectScope.checkAggregateExpr(AggregatingSelectScope.java:231)
 at org.apache.calcite.sql.validate.AggregatingSelectScope.validateExpr(AggregatingSelectScope.java:240)
 at org.apache.calcite.sql.validate.SqlValidatorImpl.validateExpr(SqlValidatorImpl.java:4071)
 at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelectList(SqlValidatorImpl.java:4045)
 at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:3259)
 at org.apache.calcite.sql.validate.SelectNamespace.validateImpl(SelectNamespace.java:60)
 at org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:84)
 at org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:972)
 at org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:948)
 at org.apache.calcite.sql.SqlSelect.validate(SqlSelect.java:226)
 at org.apache.calcite.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:923)
 at org.apache.calcite.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:633)
 at org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:554)
 at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:264)
 at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:230)
 at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:781)
 at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:640)
 at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:610)
 at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:221)
 at org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:603)
 at org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:638)
 at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:149)
 ... 36 more
 Caused by: org.apache.calcite.sql.validate.SqlValidatorException: Expression 'DEPTNO' is not being grouped
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
 at org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:463)
 at org.apache.calcite.runtime.Resources$ExInst.ex(Resources.java:572)
 ... 84 more

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)