Class 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.