[
https://issues.apache.org/jira/browse/CALCITE-7467?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated CALCITE-7467:
------------------------------------
Labels: pull-request-available (was: )
> 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
> 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 `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--
> UPD: I checked with Oracle and it also doesn't support aliases in this case,
> so to make it consistent probably makes sense to not expand identifier here
--
This message was sent by Atlassian Jira
(v8.20.10#820010)