snuyanzin opened a new pull request, #4894:
URL: https://github.com/apache/calcite/pull/4894

   ## Jira Link
   
   [CALCITE-7480](https://issues.apache.org/jira/browse/CALCITE-7480)
   
   ## Changes Proposed
   The problem the PR is going to fix is invalid output SQL after unparsing of 
`MATCH_RECOGNIZE` with `ORDER BY` or `PARTITION BY`
   example 
   ```sql
   SELECT *
   FROM (SELECT empno, deptno from sales.emp)
   MATCH_RECOGNIZE (
     PARTITION BY empno
     ORDER BY deptno
     MEASURES
        FINAL COUNT(A.deptno) AS deptno
     PATTERN (A B)
     DEFINE
       A AS A.empno = 123
   )
   ```
   is being unparsed as 
   ```sql
   SELECT `T`.`EMPNO`, `T`.`DEPTNO`
   FROM `CATALOG`.`SALES`.`EMP` AS `EMP_ALIAS` MATCH_RECOGNIZE(
   PARTITION BY `*`.`EMPNO`
   ORDER BY `*`.`DEPTNO`
   MEASURES FINAL COUNT(`A`.`DEPTNO`) AS `DEPTNO`
   PATTERN (`A` `B`)
   DEFINE `A` AS PREV(`A`.`EMPNO`, 0) = 123) AS `T`
   
   ```
   where 
   ```sql
   PARTITION BY `*`.`EMPNO`
   ORDER BY `*`.`DEPTNO`
   ```
   is not parsable anymore


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to