Class MultipleDistinctAggregationToMarkDistinct

java.lang.Object
io.trino.sql.planner.iterative.rule.MultipleDistinctAggregationToMarkDistinct
All Implemented Interfaces:
Rule<AggregationNode>

public class MultipleDistinctAggregationToMarkDistinct extends Object implements Rule<AggregationNode>
Implements distinct aggregations with different inputs by transforming plans of the following shape:
 - Aggregation
        GROUP BY (k)
        F1(DISTINCT a0, a1, ...)
        F2(DISTINCT b0, b1, ...)
        F3(c0, c1, ...)
     - X
 
into
 - Aggregation
        GROUP BY (k)
        F1(a0, a1, ...) mask ($0)
        F2(b0, b1, ...) mask ($1)
        F3(c0, c1, ...)
     - MarkDistinct (k, a0, a1, ...) -> $0
          - MarkDistinct (k, b0, b1, ...) -> $1
              - X