[ 
https://issues.apache.org/jira/browse/CALCITE-7467?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sergey Nuyanzin updated CALCITE-7467:
-------------------------------------
    Summary: MATCH_RECOGNIZE does not support alias for table before  (was: 
MATCH_RECOGNIZE does not support aliases)

> MATCH_RECOGNIZE does not support alias for table before
> -------------------------------------------------------
>
>                 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
>            Priority: Major
>              Labels: pull-request-available
>
> 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 `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--
> UPD: 
> I checked with Oracle and it also doesn't support aliases in this case
> also BigQuery and Snowflake support it
> unfortunately I don't have access to SQL Standard where probably it is 
> specified, however for now I don't see a good reason why aliases here should 
> not be supported



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

Reply via email to