snuyanzin commented on code in PR #4879:
URL: https://github.com/apache/calcite/pull/4879#discussion_r3068448425


##########
core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java:
##########
@@ -2482,20 +2482,27 @@ void testLikeAndSimilarFails() {
     sql(sql).fails("DISTINCT/ALL not allowed with "
         + "COUNT\\(DISTINCT `A`\\.`DEPTNO`\\) function");
 
-    sql("SELECT *\n"
+    final String simpleMatchRecognize = "SELECT *\n"
         + "FROM emp\n"
         + "MATCH_RECOGNIZE (\n"
         + "  MEASURES\n"
         + "     FINAL COUNT(A.deptno) AS deptno\n"
         + "  PATTERN (A B)\n"
         + "  DEFINE\n"
         + "    A AS A.empno = 123\n"
-        + ") AS T")
-        .rewritesTo("SELECT *\n"
-            + "FROM `EMP` MATCH_RECOGNIZE(\n"
-            + "MEASURES FINAL COUNT(`A`.`DEPTNO`) AS `DEPTNO`\n"
-            + "PATTERN (`A` `B`)\n"
-            + "DEFINE `A` AS (PREV(`A`.`EMPNO`, 0) = 123 AS `A`)) AS `T`");
+        + ") AS T";
+
+    final String simpleMatchRecognizeExpected = "SELECT *\n"
+        + "FROM `EMP` MATCH_RECOGNIZE(\n"
+        + "MEASURES FINAL COUNT(`A`.`DEPTNO`) AS `DEPTNO`\n"
+        + "PATTERN (`A` `B`)\n"
+        + "DEFINE `A` AS PREV(`A`.`EMPNO`, 0) = 123) AS `T`";
+
+    sql(simpleMatchRecognize)
+        .rewritesTo(simpleMatchRecognizeExpected);
+
+    sql(simpleMatchRecognizeExpected)
+        .withParserConfig(c -> c.withQuoting(Quoting.BACK_TICK)).ok();

Review Comment:
   Since there are multiple issues around unparsing of `MATCH_RECOGNIZE`
   add also a test that expected is parsable.



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