huaxingao commented on code in PR #11480:
URL: https://github.com/apache/iceberg/pull/11480#discussion_r1833437708


##########
spark/v3.5/spark-extensions/src/main/scala/org/apache/spark/sql/catalyst/parser/extensions/IcebergSparkSqlExtensionsParser.scala:
##########
@@ -151,6 +155,11 @@ class IcebergSparkSqlExtensionsParser(delegate: 
ParserInterface) extends ParserI
             isSnapshotRefDdl(normalized)))
   }
 
+  private def isIcebergProcedure(normalized: String): Boolean = {
+    // All builtin Iceberg procedures are under the 'system' namespace
+    SparkProcedures.names().asScala.map("system." + 
_).exists(normalized.contains)

Review Comment:
   +1 to move this method to `SparkProcedures`.



##########
spark/v3.5/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestCallStatementParser.java:
##########
@@ -68,11 +68,29 @@ public static void stopSpark() {
     currentSpark.stop();
   }
 
+  @Test
+  public void testDelegateUnsupportedProcedure() {
+    assertThatThrownBy(() -> parser.parsePlan("CALL cat.d.t()"))
+        .isInstanceOf(ParseException.class)
+        .hasMessageContaining("[PARSE_SYNTAX_ERROR] Syntax error at or near 
'CALL'.");

Review Comment:
   Spark already has error class in 3.5. Shall we do something like
   ```
       assertThatThrownBy(() -> parser.parsePlan("CALL cat.d.t()"))
           .isInstanceOf(ParseException.class)
           .satisfies(exception -> {
               ParseException parseException = (ParseException) exception;
               
assertThat(parseException.getErrorClass()).isEqualTo("PARSE_SYNTAX_ERROR");
               
assertThat(parseException.getMessageParameters().get("error")).isEqualTo("'CALL'");
            });
   ```



-- 
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: issues-unsubscr...@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to