[ https://issues.apache.org/jira/browse/FLINK-16055?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Rui Li updated FLINK-16055: --------------------------- Description: When we create catalog functions during tests, the functions get registered with {{FunctionRegistry}}. If later on we try to list Hive built-in functions, {{FunctionRegistry::getFunctionInfo}} will try to register the catalog functions with a session registry. And therefore fails if we don't have a {{SessionState}} in the test. The following example exposes this issue. {code} @Test public void test() throws Exception { hiveShell.execute("create function hiveudtf as 'org.apache.hadoop.hive.ql.udf.generic.GenericUDTFExplode'"); HiveModule hiveModule = new HiveModule(hiveCatalog.getHiveVersion()); hiveModule.listFunctions(); } {code} Fails with: {noformat} Caused by: java.lang.RuntimeException: Function registery for session is not initialized at org.apache.hadoop.hive.ql.session.SessionState.getRegistryForWrite(SessionState.java:979) at org.apache.hadoop.hive.ql.exec.Registry.registerToSessionRegistry(Registry.java:657) at org.apache.hadoop.hive.ql.exec.Registry.getQualifiedFunctionInfoUnderLock(Registry.java:616) at org.apache.hadoop.hive.ql.exec.Registry.getFunctionInfo(Registry.java:321) at org.apache.hadoop.hive.ql.exec.FunctionRegistry.getFunctionInfo(FunctionRegistry.java:549) at org.apache.flink.table.catalog.hive.client.HiveShimV120.getFunctionInfo(HiveShimV120.java:162) at org.apache.flink.table.catalog.hive.client.HiveShimV120.lambda$listBuiltInFunctions$0(HiveShimV120.java:142) {noformat} > Avoid catalog functions when listing Hive built-in functions > ------------------------------------------------------------ > > Key: FLINK-16055 > URL: https://issues.apache.org/jira/browse/FLINK-16055 > Project: Flink > Issue Type: Test > Components: Connectors / Hive > Reporter: Rui Li > Priority: Major > > When we create catalog functions during tests, the functions get registered > with {{FunctionRegistry}}. If later on we try to list Hive built-in > functions, {{FunctionRegistry::getFunctionInfo}} will try to register the > catalog functions with a session registry. And therefore fails if we don't > have a {{SessionState}} in the test. The following example exposes this issue. > {code} > @Test > public void test() throws Exception { > hiveShell.execute("create function hiveudtf as > 'org.apache.hadoop.hive.ql.udf.generic.GenericUDTFExplode'"); > HiveModule hiveModule = new > HiveModule(hiveCatalog.getHiveVersion()); > hiveModule.listFunctions(); > } > {code} > Fails with: > {noformat} > Caused by: java.lang.RuntimeException: Function registery for session is not > initialized > at > org.apache.hadoop.hive.ql.session.SessionState.getRegistryForWrite(SessionState.java:979) > at > org.apache.hadoop.hive.ql.exec.Registry.registerToSessionRegistry(Registry.java:657) > at > org.apache.hadoop.hive.ql.exec.Registry.getQualifiedFunctionInfoUnderLock(Registry.java:616) > at > org.apache.hadoop.hive.ql.exec.Registry.getFunctionInfo(Registry.java:321) > at > org.apache.hadoop.hive.ql.exec.FunctionRegistry.getFunctionInfo(FunctionRegistry.java:549) > at > org.apache.flink.table.catalog.hive.client.HiveShimV120.getFunctionInfo(HiveShimV120.java:162) > at > org.apache.flink.table.catalog.hive.client.HiveShimV120.lambda$listBuiltInFunctions$0(HiveShimV120.java:142) > {noformat} -- This message was sent by Atlassian Jira (v8.3.4#803005)