Class LogicalIndexExtractor


  • public class LogicalIndexExtractor
    extends Object
    Rewriter for expressions specific to row pattern recognition. Removes label-prefixed symbol references from the expression and replaces them with symbols. Removes row pattern navigation functions (PREV, NEXT, FIRST and LAST) from the expression. Removes pattern special functions CLASSIFIER() and MATCH_NUMBER() and replaces them with symbols. Reallocates all symbols in the expression to avoid unwanted optimizations when the expression is compiled. For each of the symbols creates a value accessor (ValuePointer). Returns new symbols as expected "input descriptor", upon which the rewritten expression will be compiled, along with value accessors. Value accessors are ordered the same way as the corresponding symbols so that they can be used to provide actual values to the compiled expression. Each time the compiled expression will be executed, a single-row input will be prepared with the use of the value accessors, following the symbols layout.

    Aggregate functions in pattern recognition expressions are handled in special way. Similarly to column references, CLASSIFIER() and MATCH_NUMBER() calls, they are replaced with a single symbol in the resulting expression, backed with a ValuePointer. The ValuePointer is an instance of the AggregationValuePointer class. It captures the aggregate function, the descriptor of the aggregated set of rows, and a list of arguments. The expressions in the arguments list are rewritten so that they do not contain any pattern-recognition-specific elements.