Class AggregateValuesRule


  • public class AggregateValuesRule
    extends RelOptRule
    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.