Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Add a rule to merge a Project onto an Aggregate. In practice, it means that aggregate functions that are not used in the Project are removed from the Aggregate.
For example,
SELECT deptno, sum_sal FROM ( SELECT deptno, job, SUM(sal) AS sum_sal, MIN(ename) AS min_ename FROM emp GROUP BY deptno, job)
becomes
SELECT deptno, sum_sal FROM ( SELECT deptno, job, SUM(sal) AS sum_sal FROM emp GROUP BY deptno, job)
Note that min_ename is removed from the Aggregate (because it is not used by the Project). job is not used, but it remains because it is a GROUP BY key.
Attachments
Issue Links
- relates to
-
CALCITE-1172 Add rule to flatten two Aggregate operators into one
- Closed
-
CALCITE-3957 AggregateMergeRule should merge SUM0 into COUNT even if GROUP BY is empty
- Closed
-
CALCITE-5483 ProjectAggregateMergeRule throws exception if literal is non-numeric
- Closed
- links to