[
https://issues.apache.org/jira/browse/CALCITE-7467?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18073017#comment-18073017
]
Sergey Nuyanzin commented on CALCITE-7467:
------------------------------------------
Merged as
[37448dc565f8ab3c74c45b2f0ded3b6642144a4e|https://github.com/apache/calcite/commit/37448dc565f8ab3c74c45b2f0ded3b6642144a4e]
Thank you for the review [~mbudiu], [~caicancai]
> 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)