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

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.21.0
    • None
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: