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

   
   ## Jira Link
   
   [CALCITE-7486](https://issues.apache.org/jira/browse/CALCITE-7486)
   
   This PR is based on https://github.com/apache/calcite/pull/4899
   ## Changes Proposed
   
   In case of literals there might be unparsed SQL produced
   
   like for the case 
   ```sql
   SELECT *
   FROM emp
   MATCH_RECOGNIZE (
     MEASURES
       FIRST(DOWN.empno + DOWN.deptno + 1) AS bottom_total
     PATTERN (DOWN{2,})
     DEFINE
       DOWN AS EMP.EMPNO < 1
   )
   ```
   there will unparsed version
   ```sql
   SELECT `EXPR$0`.`BOTTOM_TOTAL`
   FROM `CATALOG`.`SALES`.`EMP` AS `EMP` MATCH_RECOGNIZE(
   MEASURES FINAL (FIRST(`DOWN`.`EMPNO` + `DOWN`.`DEPTNO`, 0) + FIRST(1, 0)) AS 
`BOTTOM_TOTAL`
   PATTERN (`DOWN` { 2, })
   DEFINE `DOWN` AS `EMP`.`EMPNO` < 1) AS `EXPR$0
   ```
   
   `FIRST(1, 0)` is failing right now, the PR makes it tolerant to such calls, 
same for other `MATCH_RECOGNIZE` operators like `PREV`, `NEXT`, `LAST`


-- 
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