Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-2746

Cryptic exception when expression used in PARTITION BY clause in MATCH_RECOGNIZE

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      Query:

      SELECT *
      FROM MyTable
      MATCH_RECOGNIZE (
        PARTITION BY (id + 2)
        ORDER BY proctime
        MEASURES
          A.id AS id
        PATTERN (A)
        DEFINE
          A AS name = 'a'
      ) AS T
      

      results in exception:

      Caused by: java.lang.ClassCastException: org.apache.calcite.sql.SqlBasicCall cannot be cast to org.apache.calcite.sql.SqlIdentifier
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateMatchRecognize(SqlValidatorImpl.java:4885)
      	at org.apache.calcite.sql.validate.MatchRecognizeNamespace.validateImpl(MatchRecognizeNamespace.java:38)
      	at org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:84)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:972)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:948)
      

      I suggest improving it to give a proper hint that only input reference is supported.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              dawidwys Dawid Wysakowicz
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: