Class PushDownProjectionsFromPatternRecognition
java.lang.Object
io.trino.sql.planner.iterative.rule.PushDownProjectionsFromPatternRecognition
- All Implemented Interfaces:
Rule<PatternRecognitionNode>
public class PushDownProjectionsFromPatternRecognition
extends Object
implements Rule<PatternRecognitionNode>
Aggregate functions in pattern recognition context have special semantics.
It is allowed to use `CLASSIFIER()` and `MATCH_NUMBER()` functions
in aggregations arguments. Those calls are evaluated at runtime,
as they depend on the pattern matching state.
As a consequence, some aggregation arguments cannot be pre-projected and replaced with single symbols. These are the "runtime-evaluated arguments".
The purpose of this rule is to identify and pre-project all arguments which are not runtime-evaluated.
Example: `array_agg(CLASSIFIER(A))` -> the argument `CLASSIFIER(A)` cannot be pre-projected `avg(A.price + A.tax)` -> we can pre-project the expression `price + tax`, and replace the argument with a single symbol. The label 'A', which prefixes column references, has been already extracted from the expression in the LogicalIndexExtractor.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.trino.sql.planner.iterative.Rule
Rule.Context, Rule.Result -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapply(PatternRecognitionNode node, Captures captures, Rule.Context context) Returns a pattern to which plan nodes this rule applies.
-
Constructor Details
-
PushDownProjectionsFromPatternRecognition
public PushDownProjectionsFromPatternRecognition()
-
-
Method Details
-
getPattern
Description copied from interface:RuleReturns a pattern to which plan nodes this rule applies.- Specified by:
getPatternin interfaceRule<PatternRecognitionNode>
-
apply
- Specified by:
applyin interfaceRule<PatternRecognitionNode>
-