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

Allow GROUP BY ALL or DISTINCT set quantifier on GROUPING SETS

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.30.0
    • 1.31.0
    • core
    • jdk8

    Description

      GROUP BY DISTINCT will be used to remove duplicate GROUPING SETS, for example:

      SELECT product_id, product_class_id, count(*) from product GROUP BY DISTINCT CUBE (product_id, product_class_id), ROLLUP (product_id, product_class_id)

      it's equivalent to 

      SELECT product_id, product_class_id, count(*) from product GROUP BY GROUPING SETS ((product_id, product_class_id), (product_id), (product_class_id), ()) 

      GROUP BY ALL will remain the duplicate GROUPING SETS, it's equivalent to GROUP BY, so most databases use ALL as the default set quantifier.

      As far as I know the PostgreSQL and Trino support this syntax.

      Attachments

        Activity

          People

            yanjing.wang yanjing.wang
            yanjing.wang yanjing.wang
            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 50m
                1h 50m