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

AggregateCaseToFilterRule handles NULL values incorrectly

    XMLWordPrintableJSON

Details

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

    Description

      AggregateCaseToFilterRule handles NULL values incorrectly. It converts

      SELECT COUNT(CASE WHEN b THEN NULL ELSE 1 END) FROM t
      

      to

      SELECT COUNT(*) FILTER (WHERE b IS FALSE) FROM t
      

      which fails to count rows where b is UNKNOWN, so it should convert to

      SELECT COUNT(*) FILTER (WHERE b IS NOT TRUE) FROM t
      

      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 - 0.5h
                  0.5h