wuchong commented on code in PR #20776:
URL: https://github.com/apache/flink/pull/20776#discussion_r975091311
##########
flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/HiveDialectITCase.java:
##########
@@ -745,32 +745,40 @@ public void testTemporaryFunctionUDAF() throws Exception {
public void testCreateFunctionUsingJar() throws Exception {
tableEnv.executeSql("create table src(x int)");
tableEnv.executeSql("insert into src values (1), (2)").await();
- String udfClass = "addOne";
- String udfCode =
- "public class "
- + udfClass
+ String udfCodeTemplate =
+ "public class %s"
+ " extends org.apache.hadoop.hive.ql.exec.UDF {\n"
+ " public int evaluate(int content) {\n"
+ " return content + 1;\n"
+ " }"
+ "}\n";
+ String udfClass = "addOne";
+ String udfCode = String.format(udfCodeTemplate, udfClass);
File jarFile =
UserClassLoaderJarTestUtils.createJarFile(
tempFolder.newFolder("test-jar"), "test-udf.jar",
udfClass, udfCode);
// test create function using jar
tableEnv.executeSql(
String.format(
- "create function add_one as 'addOne' using jar '%s'",
jarFile.getPath()));
+ "create function add_one as '%s' using jar '%s'",
+ udfClass, jarFile.getPath()));
assertThat(
CollectionUtil.iteratorToList(
tableEnv.executeSql("select add_one(x)
from src").collect())
.toString())
.isEqualTo("[+I[2], +I[3]]");
+
// test create temporary function using jar
+ // create a new jarfile with a new class name
+ udfClass = "addOne1";
+ udfCode = String.format(udfCodeTemplate, udfClass);
Review Comment:
But the query only references one user jar. But the job contains 2 jars.
--
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]