Class RemoveRedundantDistinctAggregation

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

public class RemoveRedundantDistinctAggregation extends Object implements Rule<AggregationNode>
Removes DISTINCT only aggregation, when the input source is already distinct over a subset of the grouping keys as a result of another aggregation. Given:
 - Aggregate[keys = [a, max]]
   - Aggregate[keys = [a]]
     max := max(b)
 

Produces:

   - Aggregate[keys = [a]]
     max := max(b)