Class RemoveStatsOverride


public final class RemoveStatsOverride extends OptimizerRules.OptimizerRule<Aggregate>
Removes Aggregate overrides in grouping, aggregates and across them inside. The overrides appear when the same alias is used multiple times in aggregations and/or groupings: STATS x = COUNT(*), x = MIN(a) BY x = b + 1, x = c + 10 becomes STATS BY x = c + 10 and INLINESTATS x = COUNT(*), x = MIN(a) BY x = b + 1, x = c + 10 becomes INLINESTATS BY x = c + 10 This is "last one wins", with groups having priority over aggregates. Separately, it replaces expressions used as group keys inside the aggregates with references: STATS max(a + b + 1) BY a + b becomes STATS max($x + 1) BY $x = a + b