Class AggregateValuesRule

All Implemented Interfaces:
SubstitutionRule, TransformationRule

@Enclosing public class AggregateValuesRule extends RelRule<AggregateValuesRule.Config> implements SubstitutionRule
Rule that applies Aggregate to a Values (currently just an empty Values).

This is still useful because PruneEmptyRules.AGGREGATE_INSTANCE doesn't handle Aggregate, which is in turn because Aggregate of empty relations need some special handling: a single row will be generated, where each column's value depends on the specific aggregate calls (e.g. COUNT is 0, SUM is NULL).

Sample query where this matters:

SELECT COUNT(*) FROM s.foo WHERE 1 = 0

This rule only applies to "grand totals", that is, GROUP BY (). Any non-empty GROUP BY clause will return one row per group key value, and each group will consist of at least one row.

See Also: