Class AggregateExpandDistinctAggregatesRule

All Implemented Interfaces:

@Enclosing public final class AggregateExpandDistinctAggregatesRule extends RelRule<AggregateExpandDistinctAggregatesRule.Config> implements TransformationRule
Planner rule that expands distinct aggregates (such as COUNT(DISTINCT x)) from a Aggregate.

How this is done depends upon the arguments to the function. If all functions have the same argument (e.g. COUNT(DISTINCT x), SUM(DISTINCT x) both have the argument x) then one extra Aggregate is sufficient.

If there are multiple arguments (e.g. COUNT(DISTINCT x), COUNT(DISTINCT y)) the rule creates separate Aggregates and combines using a Join.

See Also: