Sergey Nuyanzin created CALCITE-7467:
----------------------------------------

             Summary: MATCH_RECOGNIZE does not support aliases
                 Key: CALCITE-7467
                 URL: https://issues.apache.org/jira/browse/CALCITE-7467
             Project: Calcite
          Issue Type: Bug
          Components: core
            Reporter: Sergey Nuyanzin
            Assignee: Sergey Nuyanzin


The issue appears in case of {SqlValidator.Config#identifierExpansion == true}}
Simple query highlighting the issue
{code:sql}
SELECT *
FROM emp
MATCH_RECOGNIZE (
  MEASURES
     FINAL COUNT(A.deptno) AS deptno
  PATTERN (A B)
  DEFINE
    A AS A.empno = 123
) AS T
{code}
will be rewritten to 
{code:sql}
SELECT `T`.`DEPTNO`
FROM `CATALOG`.`SALES`.`EMP` AS `EMP` MATCH_RECOGNIZE(
MEASURES FINAL COUNT(`A`.`DEPTNO`) AS `DEPTNO`
PATTERN (`A` `B`)
DEFINE `A` AS (PREV(`A`.`EMPNO`, 0) = 123 AS `A`)) AS `T`
{code}

Now the result is unparsable as current parser can not parse tables with alias 
before {{MATCH_RECOGNIZE}}.
The proposal is to add such ability



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to