Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-16055

Avoid catalog functions when listing Hive built-in functions

    XMLWordPrintableJSON

Details

    Description

      When we create catalog functions with hiveShell 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.

      	@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();
      	}
      

      Fails with:

      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)
      

      Attachments

        Issue Links

          Activity

            People

              lirui Rui Li
              lirui Rui Li
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m