Class ImplementFilteredAggregations

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

public class ImplementFilteredAggregations extends Object implements Rule<AggregationNode>
Implements filtered aggregations by transforming plans of the following shape:
 - Aggregation
        F1(...) FILTER (WHERE C1(...)),
        F2(...) FILTER (WHERE C2(...)), mask (m)
     - X
 
into
 - Aggregation
        F1(...) mask ($0)
        F2(...) mask ($2)
     - Filter(mask ($0) OR mask ($2))
     - Project
            <identity projections for existing fields>
            $2 = m AND $1
     - Project
            <identity projections for existing fields>
            $0 = C1(...)
            $1 = C2(...)
         - X