lsyldliu commented on code in PR #19742:
URL: https://github.com/apache/flink/pull/19742#discussion_r893419950


##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/operations/SqlToOperationConverterTest.java:
##########
@@ -1213,6 +1218,54 @@ public void testCreateTableWithMetadataColumn() {
         assertThat(actualSchema).isEqualTo(expectedSchema);
     }
 
+    @Test
+    public void testCreateFunction() {
+        // test create catalog function
+        String sql =
+                "CREATE FUNCTION test_udf AS 
'org.apache.fink.function.function1' "
+                        + "LANGUAGE JAVA USING JAR 'file:///path/to/test.jar'";
+        final FlinkPlannerImpl planner = 
getPlannerBySqlDialect(SqlDialect.DEFAULT);
+        Operation operation = parse(sql, planner, 
getParserBySqlDialect(SqlDialect.DEFAULT));
+        
assertThat(operation).isInstanceOf(CreateCatalogFunctionOperation.class);
+        CatalogFunction actualFunction =
+                ((CreateCatalogFunctionOperation) 
operation).getCatalogFunction();
+
+        assertThat(operation.asSummaryString())
+                .isEqualTo(
+                        "CREATE CATALOG FUNCTION: (catalogFunction: 
[Optional[This is a user-defined function]], "
+                                + "identifier: 
[`builtin`.`default`.`test_udf`], ignoreIfExists: [false], isTemporary: 
[false])");
+
+        // here doesn't assert the CatalogFunction directly because of the 
isGeneric method will
+        // load the class
+        
assertThat(actualFunction.getClassName()).isEqualTo("org.apache.fink.function.function1");

Review Comment:
   I think it will be better if we provide this method.



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