Class TransformCorrelatedScalarAggregationToJoin
- java.lang.Object
-
- io.prestosql.sql.planner.iterative.rule.TransformCorrelatedScalarAggregationToJoin
-
public class TransformCorrelatedScalarAggregationToJoin extends Object
Scalar aggregation is aggregation with GROUP BY 'a constant' (or empty GROUP BY). It always returns single row.This optimizer rewrites correlated scalar aggregation subquery to left outer join in a way described here: https://github.com/prestosql/presto/wiki/Correlated-subqueries
From:
- CorrelatedJoin (with correlation list: [C]) - (input) plan which produces symbols: [A, B, C] - (subquery) Aggregation(GROUP BY (); functions: [sum(F), count(), ...] - Filter(D = C AND E > 5) - plan which produces symbols: [D, E, F]
to:- Aggregation(GROUP BY A, B, C, U; functions: [sum(F), count(non_null), ...] - Join(LEFT_OUTER, D = C) - AssignUniqueId(adds symbol U) - (input) plan which produces symbols: [A, B, C] - projection which adds non null symbol used for count() function - Filter(E > 5) - plan which produces symbols: [D, E, F]
Note that only conjunction predicates in FilterNode are supported
-
-
Constructor Summary
Constructors Constructor Description TransformCorrelatedScalarAggregationToJoin(Metadata metadata)
-