Class AggregateArgumentsRewriter
-
Method Summary
Modifier and TypeMethodDescriptionstatic List<Expression> rewrite(List<Expression> arguments, Symbol classifierSymbol, Symbol matchNumberSymbol) This rewriter is dedicated for aggregation arguments in pattern recognition context.
-
Method Details
-
rewrite
public static List<Expression> rewrite(List<Expression> arguments, Symbol classifierSymbol, Symbol matchNumberSymbol) This rewriter is dedicated for aggregation arguments in pattern recognition context.Rewrite expressions so that they do not contain any elements specific to row pattern recognition: - remove labels from `LabelDereference`s and `CLASSIFIER()` calls, - replace `CLASSIFIER()` and `MATCH_NUMBER()` calls with new symbols, - the expressions do not contain navigations by analysis.
NOTE: Unlike `LogicalIndexExtractor`, this rewriter does not re-allocate all symbols. The rewritten expressions contain all the original symbols, and additionally they contain new symbols replacing `CLASSIFIER()` and `MATCH_NUMBER()` calls. It is correct, because each of the expressions (by analysis) is effectively evaluated within a single row, so any expression optimizations based on symbols are applicable. Additionally, that makes the expressions eligible for pre-projection on the condition that there were no `CLASSIFIER()` or `MATCH_NUMBER()` calls. The `PushDownProjectionsFromPatternRecognition` rule pushes down argument computations and replaces them with single symbols.
Because the expressions are effectively evaluated within a single row, it is correct to replace all `CLASSIFIER()` calls with the same symbol and all `MATCH_NUMBER()` calls with the same symbol.
-