Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.13.0, 1.14.0
Description
I met the problem and added a unit test in HiveDialectITCase to reproduce this question:
This is the compatibility of hive udtf. Refer to this issue:https://issues.apache.org/jira/browse/HIVE-5737
@Test public void testTemporaryFunctionUDTFInitializeWithStructObjectInspector() throws Exception { // create temp function tableEnv.executeSql( String.format( "create temporary function temp_split as '%s'", HiveGenericUDTFTest.TestSplitUDTFInitializeWithStructObjectInspector.class .getName())); String[] functions = tableEnv.listUserDefinedFunctions(); assertArrayEquals(new String[] {"temp_split"}, functions); // call the function tableEnv.executeSql("create table src(x string)"); tableEnv.executeSql("insert into src values ('a,b,c')").await(); assertEquals( "[+I[a], +I[b], +I[c]]", queryResult(tableEnv.sqlQuery("select temp_split(x) from src")).toString()); // switch DB and the temp function can still be used tableEnv.executeSql("create database db1"); tableEnv.useDatabase("db1"); assertEquals( "[+I[a], +I[b], +I[c]]", queryResult(tableEnv.sqlQuery("select temp_split(x) from `default`.src")) .toString()); // drop the function tableEnv.executeSql("drop temporary function temp_split"); functions = tableEnv.listUserDefinedFunctions(); assertEquals(0, functions.length); tableEnv.executeSql("drop temporary function if exists foo"); }
Attachments
Attachments
Issue Links
- relates to
-
FLINK-24862 The user-defined hive udaf/udtf cannot be used normally in hive dialect
- Closed
- links to