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

Add rule, AggregateCaseToFilterRule, that converts "SUM(CASE WHEN b THEN x END)" to "SUM(x) FILTER (WHERE b)"

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.21.0
    • Component/s: None
    • Labels:
      None

      Description

      Add a rule that converts "SUM(CASE WHEN b THEN x END)" to "SUM(x) FILTER (WHERE b)".

      Druid added CaseFilteredAggregatorRule in https://github.com/apache/incubator-druid/pull/4360.

      Maybe AggregateCaseToFilterRule is a slightly better name. Or maybe this transform could be done in RelBuilder.aggregate, and we wouldn't need a rule.

        Attachments

          Activity

            People

            • Assignee:
              julianhyde Julian Hyde
              Reporter:
              julianhyde Julian Hyde
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: