quark
quark copied to clipboard
Casts/DECIMAL type is mapped to Double instead of BigDecimal
As per https://docs.oracle.com/javase/6/docs/technotes/guides/jdbc/getstart/mapping.html, Types.DECIMAL
should be mapped to java.math.BigDecimal
. However, AggStar rule fails because Double and BigDecimal are not considered to be equivalent. The relevant stack trace is:
java.lang.AssertionError: Internal error: Error while applying rule AggStarRule, args [rel#14028:LogicalAggregate.NONE.[](input=rel#14027:Subset#6.NONE.[],group={70},EXPR$0=SUM($23)), rel#14042:StarTableScan.NONE.[](table=[QUARK_METADATA, web_returns_cubes])]
at org.apache.calcite.plan.RelOptUtil.equal(RelOptUtil.java:1693)
at org.apache.calcite.plan.volcano.VolcanoPlanner.register(VolcanoPlanner.java:1027)
at org.apache.calcite.plan.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:1055)
at org.apache.calcite.plan.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:1958)
at org.apache.calcite.plan.volcano.VolcanoRuleCall.transformTo(VolcanoRuleCall.java:138)
at org.apache.calcite.plan.RelOptRuleCall.transformTo(RelOptRuleCall.java:213)
at com.qubole.quark.planner.AggStarRule.apply(AggStarRule.java:184)
I have worked around the problem by mapping DECIMAL to DOUBLE. However, that doesnt seem right. This may also point to a larger problem with automatic casts.