Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-1570 Add MATCH_RECOGNIZE operator, for event pattern-matching
  3. CALCITE-1647

Classifier and match_number syntax support for MATCH_RECOGNIZE



    • Type: Sub-task
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.11.0
    • Fix Version/s: 1.13.0
    • Component/s: core
    • Labels:


      MATCH_NUMBER: Finding Which Rows Are in Which Match

      Matches within a row pattern partition are numbered sequentially starting with 1 in the order they are found. Note that match numbering starts over again at 1 in each row pattern partition, because there is no inherent ordering between row pattern partitions. MATCH_NUMBER() is a function that returns a numeric value with scale 0 (zero) whose value is the sequential number of the match within the row pattern partition.
      The previous examples using MATCH_NUMBER() have shown it used in the MEASURES clause. It is also possible to use MATCH_NUMBER() in the DEFINE clause, where it can be used to define conditions that depend upon the match number.

      CLASSIFIER: Finding Which Pattern Variable Applies to Which Rows

      The CLASSIFIER function returns a character string whose value is the name of the pattern variable to which a row is mapped. The CLASSIFIER function is allowed in both the MEASURES and the DEFINE clauses.
      In the DEFINE clause, the CLASSIFIER function returns the name of the primary pattern variable to which the current row is mapped.
      In the MEASURES clause:

      • If ONE ROW PER MATCH is specified, the query is using the last row of the match when processing the MEASURES clause, so the CLASSIFIER function returns the name of the pattern variable to which the last row of the match is mapped.
      • If ALL ROWS PER MATCH is specified, for each row of the match found, the CLASSIFIER function returns the name of the pattern variable to which the row is mapped.

      The classifier for the starting row of an empty match is the null value.


          Issue Links



              • Assignee:
                ransom Zhiqiang He
                ransom Zhiqiang He
              • Votes:
                0 Vote for this issue
                3 Start watching this issue


                • Created: