Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
AggregateMergeRule should merge SUM0 into COUNT even if GROUP BY is empty.
Basically, the comment inĀ AggregateMergeRule,
Should not merge if top agg with empty group keys and the lower agg function is COUNT, because in case of empty input for lower agg, the result is empty, if we merge them, we end up with 1 result with 0, which is wrong.
does not apply if the top aggregate is a SUM0, I believe. Without a fix for this, there's this one case where this rule falls down and isn't able to merge something that just got rolled up: otherwise it's a pretty nice invariant that if one of our standard rollup rules for aggregates (say, in MaterializedViewRule) just split the aggregate, this rule should be able to merge it back.
Attachments
Issue Links
- is related to
-
CALCITE-1172 Add rule to flatten two Aggregate operators into one
- Closed
-
CALCITE-4154 Add a rule to merge a Project onto an Aggregate
- Closed
- links to