Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-4154

Add a rule to merge a Project onto an Aggregate

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.25.0
    • 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

          Activity

            People

              julianhyde Julian Hyde
              julianhyde Julian Hyde
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m