Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.13.0
-
None
-
None
Description
Given the following SQL:
select sum(ss_list_price) SM ,count(ss_list_price) NT,count(distinct ss_list_price) DNT from store_sales
An exception occurs when the following rules are used:
AggregateExpandDistinctAggregatesRule.JOIN
AggregateReduceFunctionsRule.INSTANCE
java.lang.AssertionError: Type mismatch: rowtype of new rel: RecordType(BIGINT SM, BIGINT NOT NULL NT, BIGINT NOT NULL DNT) NOT NULL rowtype of set: RecordType(DOUBLE SM, BIGINT NOT NULL NT, BIGINT NOT NULL DNT) NOT NULL at org.apache.calcite.util.Litmus$1.fail(Litmus.java:31) at org.apache.calcite.plan.RelOptUtil.equal(RelOptUtil.java:1873) at org.apache.calcite.plan.volcano.RelSubset.add(RelSubset.java:271) at org.apache.calcite.plan.volcano.RelSet.add(RelSet.java:85) at org.apache.calcite.plan.volcano.VolcanoPlanner.addRelToSet(VolcanoPlanner.java:1645) at org.apache.calcite.plan.volcano.VolcanoPlanner.registerImpl(VolcanoPlanner.java:1591) at org.apache.calcite.plan.volcano.VolcanoPlanner.register(VolcanoPlanner.java:863) at org.apache.calcite.plan.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:883) at org.apache.calcite.plan.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:1767) at org.apache.calcite.plan.volcano.VolcanoRuleCall.transformTo(VolcanoRuleCall.java:135) at org.apache.calcite.plan.RelOptRuleCall.transformTo(RelOptRuleCall.java:234) at org.apache.calcite.rel.rules.AggregateReduceFunctionsRule.reduceAggs(AggregateReduceFunctionsRule.java:181) at org.apache.calcite.rel.rules.AggregateReduceFunctionsRule.onMatch(AggregateReduceFunctionsRule.java:110) at org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:212) at org.apache.calcite.plan.volcano.VolcanoPlanner.findBestExp(VolcanoPlanner.java:650)
Attachments
Issue Links
- is related to
-
CALCITE-2132 Unify rewrites for aggregate functions and windowed aggregate functions
- Open