This is an automated email from the ASF dual-hosted git repository.

pdallig pushed a commit to branch branch-0.10
in repository https://gitbox.apache.org/repos/asf/zeppelin.git


The following commit(s) were added to refs/heads/branch-0.10 by this push:
     new 3384cd9  [ZEPPELIN-5540] fix the unexpected NPE when use hive with 
Flink
3384cd9 is described below

commit 3384cd9f40a750df0182934656ed40c5a1ecb836
Author: taokelu <taok...@bytedance.com>
AuthorDate: Mon Sep 27 20:02:57 2021 +0800

    [ZEPPELIN-5540] fix the unexpected NPE when use hive with Flink
    
    ### What is this PR for?
    When we enable hive in Flink interpreter, we encounter the unexpected NPE. 
The root cause is the value `properties.getOrDefault("HIVE_CONF_DIR", 
System.getenv("HIVE_CONF_DIR"))` is null. It will throw NPE when apply the 
`toString()` method.
    
    ### What type of PR is it?
    [Bug Fix ]
    
    ### Todos
    None
    
    ### What is the Jira issue?
    * https://issues.apache.org/jira/browse/ZEPPELIN-5540
    
    ### How should this be tested?
    CI pass
    
    ### Screenshots (if appropriate)
    
    ### Questions:
    * Does the licenses files need update? No
    * Is there breaking changes for older versions? No
    * Does this needs documentation? No
    
    Author: taokelu <taok...@bytedance.com>
    
    Closes #4236 from legendtkl/fixNpeForFlinkInterpret and squashes the 
following commits:
    
    6ec7c4b3a [taokelu] fix
    f76132427 [taokelu] [ZEPPELIN-5540] fix the unexpected NPE when use hive in 
Flink Interpreter
    
    (cherry picked from commit 5c52dd38dae7d5bde49837e3df2eb0b68a305117)
    Signed-off-by: Philipp Dallig <philipp.dal...@gmail.com>
---
 .../main/scala/org/apache/zeppelin/flink/FlinkScalaInterpreter.scala  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/flink/flink-scala-parent/src/main/scala/org/apache/zeppelin/flink/FlinkScalaInterpreter.scala
 
b/flink/flink-scala-parent/src/main/scala/org/apache/zeppelin/flink/FlinkScalaInterpreter.scala
index 7729a5f..1545bcd 100644
--- 
a/flink/flink-scala-parent/src/main/scala/org/apache/zeppelin/flink/FlinkScalaInterpreter.scala
+++ 
b/flink/flink-scala-parent/src/main/scala/org/apache/zeppelin/flink/FlinkScalaInterpreter.scala
@@ -489,13 +489,13 @@ abstract class FlinkScalaInterpreter(val properties: 
Properties,
 
   private def registerHiveCatalog(): Unit = {
     val hiveConfDir =
-      properties.getOrDefault("HIVE_CONF_DIR", 
System.getenv("HIVE_CONF_DIR")).toString
+      properties.getOrDefault("HIVE_CONF_DIR", System.getenv("HIVE_CONF_DIR"))
     if (hiveConfDir == null) {
       throw new InterpreterException("HIVE_CONF_DIR is not specified");
     }
     val database = properties.getProperty("zeppelin.flink.hive.database", 
"default")
     val hiveVersion = properties.getProperty("zeppelin.flink.hive.version", 
"2.3.4")
-    val hiveCatalog = new HiveCatalog("hive", database, hiveConfDir, 
hiveVersion)
+    val hiveCatalog = new HiveCatalog("hive", database, hiveConfDir.toString, 
hiveVersion)
     this.btenv.registerCatalog("hive", hiveCatalog)
     this.btenv.useCatalog("hive")
     this.btenv.useDatabase(database)

Reply via email to