You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2022/12/05 20:30:23 UTC

[GitHub] [calcite] julianhyde commented on a diff in pull request #2985: [CALCITE-5393] Support MySQL VALUE operator parse

julianhyde commented on code in PR #2985:
URL: https://github.com/apache/calcite/pull/2985#discussion_r1038925433


##########
testkit/src/main/java/org/apache/calcite/sql/parser/SqlParserTest.java:
##########
@@ -4585,6 +4585,23 @@ void checkPeriodPredicate(Checker checker) {
         .ok(expected);
   }
 
+  /** Tests VALUE, which is equivalent to VALUES but only supported in some
+   * conformance levels (e.g. MYSQL). */
+  @Test void testInsertValue() {
+    final String pattern =
+        "VALUE is not allowed under the current SQL conformance level";
+    final String sql = "insert into emps ^value^ (1, 'Fredkin')";
+    sql(sql)
+        .fails(pattern);
+
+    final String expected = "INSERT INTO `EMPS`\n"
+        + "VALUES (ROW(1, 'Fredkin'))";
+    sql(sql)
+        .withConformance(SqlConformanceEnum.MYSQL_5)
+        .ok(expected)
+        .node(not(isDdl()));
+  }
+

Review Comment:
   I think I would merge this test into `testInsertValues`, since the expected AST is the same.
   
   Can you also test VALUE as a top-level query, not just in INSERT. Maybe modify `testValues`.



##########
core/src/main/java/org/apache/calcite/runtime/CalciteResource.java:
##########
@@ -995,4 +995,6 @@ ExInstWithCause<CalciteException> failedToAccessField(
   @BaseMessage("A table function at most has one input table with row semantics. Table function ''{0}'' has multiple input tables with row semantics")
   ExInst<SqlValidatorException> multipleRowSemanticsTables(String funcName);
 
+  @BaseMessage("VALUE is not allowed under the current SQL conformance level")
+  ExInst<CalciteException> valueNotAllowed();

Review Comment:
   Why do you put it last? If everyone puts things last, we get conflicts. Put it in the best place.



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org