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

RelMdUniqueKeys returns wrong unique keys for Aggregate with grouping sets

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.26.0
    • Component/s: core

      Description

      For Aggregate with grouping sets, group by keys might not form a unique key. For example: 

      //PostgreSQL
      
      create table test2(key bigint, value bigint);
      insert into test2 values
       (1, null),
       (null, 1);
      
      
      select key, value, count(*) from test2
      group by GROUPING SETS (key,value) 
      ;
      
      postgres=# select key, value, count(*) from test2
      postgres-# group by GROUPING SETS (key,value)
      postgres-# ;
       key | value | count
      -----+-------+-------
           |       |     1
         1 |       |     1
           |       |     1
           |     1 |     1
      (4 rows)
      
      

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Chunwei Lei Chunwei Lei
                Reporter:
                Chunwei Lei Chunwei Lei
              • Votes:
                0 Vote for this issue
                Watchers:
                4 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 40m
                  1h 40m