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

Sergey Nuyanzin reassigned CALCITE-7465:
----------------------------------------

    Assignee: Sergey Nuyanzin  (was: krooswu)

> Unparse of MATCH_RECOGNIZE with field forwards produce unparsable sql
> ---------------------------------------------------------------------
>
>                 Key: CALCITE-7465
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7465
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Sergey Nuyanzin
>            Assignee: Sergey Nuyanzin
>            Priority: Major
>
> It adds extra {{FINAL}} for every field forward at 
> {{SqlValidatorImpl#navigationInMeasure}}
> the suggestion then make {{FINAL}} optional for each field
> {code:sql}
> SELECT *
> FROM emp
> MATCH_RECOGNIZE (
>   MEASURES
>      FINAL COUNT(A.deptno) AS deptno,
>      FINAL A.ename AS ename
>   PATTERN (A B)
>   DEFINE
>     A AS A.empno = 123
> ) AS T
> {code}
> is being rewritten to (added {{FINAL}})
> {code:sql}
> SELECT *
> FROM `EMP` MATCH_RECOGNIZE(
> MEASURES FINAL COUNT(`A`.`DEPTNO`) AS `DEPTNO`, FINAL `A`.`ENAME` AS `ENAME`
> PATTERN (`A` `B`)
> DEFINE `A` AS (PREV(`A`.`EMPNO`, 0) = 123)) AS `T`
> {code}
> At the same time an attempt to parse unparsed version will fail because of 
> added {{FINAL}}



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

Reply via email to