[ https://issues.apache.org/jira/browse/CALCITE-6349?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mihai Budiu resolved CALCITE-6349. ---------------------------------- Resolution: Fixed Fixed in https://github.com/apache/calcite/commit/91115539f967fe213eb11a3ef84c49d847055569 > CoreRules.PROJECT_REDUCE_EXPRESSIONS crashes on expression with ARRAY_REPEAT > ---------------------------------------------------------------------------- > > Key: CALCITE-6349 > URL: https://issues.apache.org/jira/browse/CALCITE-6349 > Project: Calcite > Issue Type: Bug > Components: core > Affects Versions: 1.36.0 > Reporter: Mihai Budiu > Assignee: Mihai Budiu > Priority: Minor > Labels: pull-request-available > Fix For: 1.37.0 > > > The following test in RelOptRulesTest causes a crash: > {code:java} > @Test void testArrayRepeat() { > final String sql = "select array_repeat(1, null)"; > sql(sql) > .withFactory( > t -> t.withOperatorTable( > opTab -> > SqlLibraryOperatorTableFactory.INSTANCE.getOperatorTable( > SqlLibrary.STANDARD, SqlLibrary.SPARK))) > .withRule(CoreRules.PROJECT_REDUCE_EXPRESSIONS) > .check(); > } > {code} > The crash is: > {code:java} > java.lang.AssertionError: Cannot add expression of different type to set: > set type is RecordType(INTEGER NOT NULL ARRAY NOT NULL EXPR$0) NOT NULL > expression type is RecordType(INTEGER NOT NULL ARRAY EXPR$0) NOT NULL > set is rel#4:LogicalProject.(input=HepRelVertex#3,exprs=[ARRAY_REPEAT(1, > null:DECIMAL(19, 9))]) > expression is LogicalProject(EXPR$0=[null:INTEGER NOT NULL ARRAY]) > LogicalValues(tuples=[[{ 0 }]]) > Type mismatch: > rowtype of original rel: RecordType(INTEGER NOT NULL ARRAY NOT NULL EXPR$0) > NOT NULL > rowtype of new rel: RecordType(INTEGER NOT NULL ARRAY EXPR$0) NOT NULL > Difference: > EXPR$0: INTEGER NOT NULL ARRAY NOT NULL -> INTEGER NOT NULL ARRAY > at > org.apache.calcite.plan.RelOptUtil.verifyTypeEquivalence(RelOptUtil.java:419) > at > org.apache.calcite.plan.hep.HepRuleCall.transformTo(HepRuleCall.java:60) > at > org.apache.calcite.plan.RelOptRuleCall.transformTo(RelOptRuleCall.java:273) > at > org.apache.calcite.plan.RelOptRuleCall.transformTo(RelOptRuleCall.java:288) > at > org.apache.calcite.rel.rules.ReduceExpressionsRule$ProjectReduceExpressionsRule.onMatch(ReduceExpressionsRule.java:317) > at > org.apache.calcite.plan.AbstractRelOptPlanner.fireRule(AbstractRelOptPlanner.java:337) > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010)