[ https://issues.apache.org/jira/browse/CALCITE-3319?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Haisheng Yuan resolved CALCITE-3319. ------------------------------------ Fix Version/s: 1.22.0 Resolution: Fixed Fixed in https://github.com/apache/calcite/commit/ce8ca6742bf1296af421c8e61f9918734db74cf3, thanks for the PR, [~yanlin-Lynn]! > AssertionError for ReduceDecimalsRule > ------------------------------------- > > Key: CALCITE-3319 > URL: https://issues.apache.org/jira/browse/CALCITE-3319 > Project: Calcite > Issue Type: Bug > Reporter: Wang Yanlin > Priority: Major > Labels: pull-request-available > Fix For: 1.22.0 > > Time Spent: 1h 10m > Remaining Estimate: 0h > > When trying to use *ReduceDecimalsRule*, I got > {code:java} > java.lang.AssertionError > at > org.apache.calcite.rel.rules.ReduceDecimalsRule$DecimalShuttle.visitCall(ReduceDecimalsRule.java:159) > at > org.apache.calcite.rel.rules.ReduceDecimalsRule$DecimalShuttle.visitCall(ReduceDecimalsRule.java:124) > at org.apache.calcite.rex.RexCall.accept(RexCall.java:191) > at > org.apache.calcite.rex.RexProgramBuilder.add(RexProgramBuilder.java:653) > at > org.apache.calcite.rex.RexProgramBuilder.create(RexProgramBuilder.java:601) > at > org.apache.calcite.rel.rules.ReduceDecimalsRule.onMatch(ReduceDecimalsRule.java:103) > at > org.apache.calcite.plan.AbstractRelOptPlanner.fireRule(AbstractRelOptPlanner.java:319) > at org.apache.calcite.plan.hep.HepPlanner.applyRule(HepPlanner.java:560) > at > org.apache.calcite.plan.hep.HepPlanner.applyRules(HepPlanner.java:419) > at > org.apache.calcite.plan.hep.HepPlanner.executeInstruction(HepPlanner.java:256) > at > org.apache.calcite.plan.hep.HepInstruction$RuleInstance.execute(HepInstruction.java:127) > at > org.apache.calcite.plan.hep.HepPlanner.executeProgram(HepPlanner.java:215) > at > org.apache.calcite.plan.hep.HepPlanner.findBestExp(HepPlanner.java:202) > {code} > I read the code, and found this. > {code:java} > List<RexNode> newOperands = apply(call.getOperands()); > if (true) { > // FIXME: Operands are now immutable. Create a new call with > // new operands? > throw new AssertionError(); > } > {code} > After remove this logic, the rel below > {code:java} > LogicalCalc(expr#0..7=[{inputs}], expr#8=[1.01E1:DOUBLE], expr#9=[15], > expr#10=[+($t8, $t9)], expr#11=[>($t5, $t10)], proj#0..7=[{exprs}], > $condition=[$t11]) > LogicalTableScan(table=[[scott, EMP]]) > {code} > can be translated into > {code:java} > LogicalCalc(expr#0..7=[{inputs}], expr#8=[Reinterpret($t5)], > expr#9=[CAST($t8):DOUBLE], expr#10=[1E2:DOUBLE], expr#11=[/INT($t9, $t10)], > expr#12=[1.01E1:DOUBLE], expr#13=[15], expr#14=[+($t12, $t13)], > expr#15=[>($t11, $t14)], proj#0..7=[{exprs}], $condition=[$t15]) > LogicalTableScan(table=[[scott, EMP]]) > {code} > So is this rule not ready for use now, or we should just remove this logic? -- This message was sent by Atlassian Jira (v8.3.2#803003)