Details

    • 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:

      Description

      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

          Activity

          Hide
          ransom Zhiqiang He added a comment -
          Show
          ransom Zhiqiang He added a comment - https://github.com/apache/calcite/pull/473 please review it. thanks.
          Hide
          julianhyde Julian Hyde added a comment -

          Looks good. Some minor stuff:

          • In the parser, indent the code (except the "|" lines) by 4 spaces, and put the "{" at the end of the previous line
          • In SqlOperatorTable, CLASSIFIER and MATCH_NUMBER need a little more indentation
          • Need to document CLASSIFIER and MATCH_NUMBER in reference.md
          • Capitalization in the commit comment
          Show
          julianhyde Julian Hyde added a comment - Looks good. Some minor stuff: In the parser, indent the code (except the "|" lines) by 4 spaces, and put the "{" at the end of the previous line In SqlOperatorTable, CLASSIFIER and MATCH_NUMBER need a little more indentation Need to document CLASSIFIER and MATCH_NUMBER in reference.md Capitalization in the commit comment
          Hide
          ransom Zhiqiang He added a comment -

          Julian Hyde fixed. please review it. thanks.

          Show
          ransom Zhiqiang He added a comment - Julian Hyde fixed. please review it. thanks.
          Show
          jcamachorodriguez Jesus Camacho Rodriguez added a comment - Fixed in http://git-wip-us.apache.org/repos/asf/calcite/commit/304eb9c . Thanks Zhiqiang He !
          Hide
          jcamachorodriguez Jesus Camacho Rodriguez added a comment -

          Resolved in release 1.13.0 (2017-06-26).

          Show
          jcamachorodriguez Jesus Camacho Rodriguez added a comment - Resolved in release 1.13.0 (2017-06-26).

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development