Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
Description
This is reported originally from CALCITE-5127.
select (select json_object('a': v)) from unnest(array[1,2,null]) as T(v)
will lead to exception
java.lang.AssertionError: No assign rules for SYMBOL defined
at org.apache.calcite.sql.type.SqlTypeMappingRule.canApplyFrom(SqlTypeMappingRule.java:57)
at org.apache.calcite.sql.type.SqlTypeUtil.canCastFrom(SqlTypeUtil.java:956)
at org.apache.calcite.sql.type.SqlTypeFactoryImpl.leastRestrictiveByCast(SqlTypeFactoryImpl.java:184)
at org.apache.calcite.sql.type.SqlTypeFactoryImpl.leastRestrictive(SqlTypeFactoryImpl.java:164)
at org.apache.calcite.sql.fun.SqlCaseOperator.inferTypeFromOperands(SqlCaseOperator.java:320)
at org.apache.calcite.sql.fun.SqlCaseOperator.inferReturnType(SqlCaseOperator.java:223)
at org.apache.calcite.rex.RexBuilder.deriveReturnType(RexBuilder.java:290)
at org.apache.calcite.rex.RexBuilder.makeCall(RexBuilder.java:264)
at org.apache.calcite.rex.RexBuilder.makeCall(RexBuilder.java:277)
at org.apache.calcite.sql2rel.RelDecorrelator$RemoveCorrelationRexShuttle.createCaseExpression(RelDecorrelator.java:1731)
at org.apache.calcite.sql2rel.RelDecorrelator$RemoveCorrelationRexShuttle.visitLiteral(RelDecorrelator.java:1798)
at org.apache.calcite.sql2rel.RelDecorrelator$RemoveCorrelationRexShuttle.visitLiteral(RelDecorrelator.java:1672)
at org.apache.calcite.rex.RexLiteral.accept(RexLiteral.java:1217)
at org.apache.calcite.rex.RexShuttle.visitList(RexShuttle.java:163)
at org.apache.calcite.sql2rel.RelDecorrelator$RemoveCorrelationRexShuttle.visitCall(RelDecorrelator.java:1807)
at org.apache.calcite.sql2rel.RelDecorrelator$RemoveCorrelationRexShuttle.visitCall(RelDecorrelator.java:1672)
at org.apache.calcite.rex.RexCall.accept(RexCall.java:189)
at org.apache.calcite.sql2rel.RelDecorrelator.removeCorrelationExpr(RelDecorrelator.java:405)
at org.apache.calcite.sql2rel.RelDecorrelator.projectJoinOutputWithNullability(RelDecorrelator.java:1429)
at org.apache.calcite.sql2rel.RelDecorrelator.access$900(RelDecorrelator.java:147)
at org.apache.calcite.sql2rel.RelDecorrelator$RemoveCorrelationForScalarProjectRule.onMatch(RelDecorrelator.java:2144)
at org.apache.calcite.plan.AbstractRelOptPlanner.fireRule(AbstractRelOptPlanner.java:337)
at org.apache.calcite.plan.hep.HepPlanner.applyRule(HepPlanner.java:556)
at org.apache.calcite.plan.hep.HepPlanner.applyRules(HepPlanner.java:420)
at org.apache.calcite.plan.hep.HepPlanner.executeRuleInstance(HepPlanner.java:243)
at org.apache.calcite.plan.hep.HepInstruction$RuleInstance$State.execute(HepInstruction.java:178)
at org.apache.calcite.plan.hep.HepPlanner.lambda$executeProgram$0(HepPlanner.java:211)
at com.google.common.collect.ImmutableList.forEach(ImmutableList.java:422)
at org.apache.calcite.plan.hep.HepPlanner.executeProgram(HepPlanner.java:210)
at org.apache.calcite.plan.hep.HepProgram$State.execute(HepProgram.java:118)
at org.apache.calcite.plan.hep.HepPlanner.executeProgram(HepPlanner.java:205)
at org.apache.calcite.plan.hep.HepPlanner.findBestExp(HepPlanner.java:191)
at org.apache.calcite.sql2rel.RelDecorrelator.removeCorrelationViaRule(RelDecorrelator.java:378)
at org.apache.calcite.sql2rel.RelDecorrelator.decorrelateQuery(RelDecorrelator.java:221)
at org.apache.calcite.tools.Programs$DecorrelateProgram.run(Programs.java:362)
at org.apache.calcite.tools.Programs$SequenceProgram.run(Programs.java:337)
at org.apache.calcite.prepare.Prepare.optimize(Prepare.java:177)
at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:312)
at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:220)
at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:648)
at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:514)
at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:484)
at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:234)
at org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:623)
at org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:677)
at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:156)
at org.apache.calcite.avatica.AvaticaStatement.execute(AvaticaStatement.java:217)
Attachments
Issue Links
- is related to
-
CALCITE-5127 Support correlation variables in Project
- Closed
- links to