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

Remove Aggregate if grouping columns are unique and all functions are splittable

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.20.0
    • None

    Description

      Remove Aggregate if grouping columns are unique and all functions are splittable. Currently AggregateRemoveRule is only applied if there are no aggregate functions. But we could optimize

      select deptno, count(name) from dept group by deptno

      to

      select deptno, 1 from dept

      because we know deptno is unique, name is not null, and a singleton count applied to a not null column evaluates to 1.

      See AggregateJoinTransposeRule; it already makes use of SqlSplittableAggFunction.

      Attachments

        1. node.png
          454 kB
          Haisheng Yuan

        Issue Links

          Activity

            People

              hyuan Haisheng Yuan
              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 - 1h 20m
                  1h 20m