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

HiveParser could not attach the sessionstate of hive

    XMLWordPrintableJSON

Details

    Description

      My sql code is as follows:

      //代码占位符
      CREATE CATALOG myhive WITH (
          'type' = 'hive',
          'default-database' = 'default',
          'hive-conf-dir' = '/home/service/upload-job-file/1624269463008'
      );
      
      use catalog hive;
      
      set 'table.sql-dialect' = 'hive';
      
      create view if not exists view_test as
      select
        cast(goods_id as string) as goods_id,
        cast(depot_id as string) as depot_id,
        cast(product_id as string) as product_id,
        cast(tenant_code as string) as tenant_code
      from edw.dim_yezi_whse_goods_base_info/*+ OPTIONS('streaming-source.consume-start-offset'='dayno=20210621') */;
      

      and the exception is as follows:

      //代码占位符
      org.apache.flink.client.program.ProgramInvocationException: The main method caused an error: Conf non-local session path expected to be non-null
              at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:372)
              at org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:222)
              at org.apache.flink.client.ClientUtils.executeProgram(ClientUtils.java:114)
              at org.apache.flink.client.cli.CliFrontend.executeProgram(CliFrontend.java:812)
              at org.apache.flink.client.cli.CliFrontend.run(CliFrontend.java:246)
              at org.apache.flink.client.cli.CliFrontend.parseAndRun(CliFrontend.java:1054)
              at org.apache.flink.client.cli.CliFrontend.lambda$main$10(CliFrontend.java:1132)
              at org.apache.flink.client.cli.CliFrontend$$Lambda$68/330382173.call(Unknown Source)
              at org.apache.flink.runtime.security.contexts.HadoopSecurityContext$$Lambda$69/680712932.run(Unknown Source)
              at java.security.AccessController.doPrivileged(Native Method)
              at javax.security.auth.Subject.doAs(Subject.java:422)
              at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1692)
              at org.apache.flink.runtime.security.contexts.HadoopSecurityContext.runSecured(HadoopSecurityContext.java:41)
              at org.apache.flink.client.cli.CliFrontend.main(CliFrontend.java:1132)
      Caused by: java.lang.NullPointerException: Conf non-local session path expected to be non-null
              at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:208)
              at org.apache.hadoop.hive.ql.session.SessionState.getHDFSSessionPath(SessionState.java:669)
              at org.apache.flink.table.planner.delegation.hive.HiveParser.clearSessionState(HiveParser.java:376)
              at org.apache.flink.table.planner.delegation.hive.HiveParser.parse(HiveParser.java:219)
              at org.apache.flink.table.api.internal.TableEnvironmentImpl.executeSql(TableEnvironmentImpl.java:724)
              at com.shizhengchao.io.FlinkSqlStreamingPlatform.callFlinkSql(FlinkSqlStreamingPlatform.java:157)
              at com.shizhengchao.io.FlinkSqlStreamingPlatform.callCommand(FlinkSqlStreamingPlatform.java:129)
              at com.shizhengchao.io.FlinkSqlStreamingPlatform.run(FlinkSqlStreamingPlatform.java:91)
              at com.shizhengchao.io.FlinkSqlStreamingPlatform.main(FlinkSqlStreamingPlatform.java:66)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:497)
              at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:355)
              ... 13 common frames omitted
      

      My guess is that sessionstate is not set to threadlocal:

      //代码占位符
      // @see org.apache.hadoop.hive.ql.session.SessionState.setCurrentSessionState
      public static void setCurrentSessionState(SessionState startSs) {
        tss.get().attach(startSs);
      }
      

       

      Attachments

        Issue Links

          Activity

            People

              tinny shizhengchao
              tinny shizhengchao
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: