You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by ul...@apache.org on 2022/04/14 01:58:00 UTC
[incubator-kyuubi] branch master updated: [KYUUBI #2357] [Improvement] Add warn log and check in class of HiveProcessBuilder
This is an automated email from the ASF dual-hosted git repository.
ulyssesyou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-kyuubi.git
The following commit(s) were added to refs/heads/master by this push:
new d5acb78e7 [KYUUBI #2357] [Improvement] Add warn log and check in class of HiveProcessBuilder
d5acb78e7 is described below
commit d5acb78e7511f75f8286a2d76008d6c397978ef3
Author: Min Zhao <zh...@163.com>
AuthorDate: Thu Apr 14 09:57:53 2022 +0800
[KYUUBI #2357] [Improvement] Add warn log and check in class of HiveProcessBuilder
Add warn log and check in class of HiveProcessBuilder
### _Why are the changes needed?_
### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
- [ ] Add screenshots for manual tests if appropriate
- [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
Closes #2358 from zhaomin1423/hive_engine_check.
Closes #2357
56e4227a [Min Zhao] [KYUUBI #2357] [Improvement] Add warn log and check in class of HiveProcessBuilder
Authored-by: Min Zhao <zh...@163.com>
Signed-off-by: ulysses-you <ul...@apache.org>
---
.../org/apache/kyuubi/engine/hive/HiveProcessBuilder.scala | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/hive/HiveProcessBuilder.scala b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/hive/HiveProcessBuilder.scala
index 6dd2c5069..974959dd7 100644
--- a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/hive/HiveProcessBuilder.scala
+++ b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/hive/HiveProcessBuilder.scala
@@ -18,7 +18,7 @@
package org.apache.kyuubi.engine.hive
import java.io.File
-import java.nio.file.Paths
+import java.nio.file.{Files, Paths}
import java.util.LinkedHashSet
import scala.collection.JavaConverters._
@@ -66,17 +66,26 @@ class HiveProcessBuilder(
// classpath contains hive configurations, default to hive.home/conf
classpathEntries.add(env.getOrElse("HIVE_CONF_DIR", s"$hiveHome${File.separator}conf"))
// classpath contains hadoop configurations
- env.get("HADOOP_CONF_DIR").foreach(classpathEntries.add)
+ val hadoopConfDir = env.get("HADOOP_CONF_DIR")
+ if (hadoopConfDir.isEmpty) {
+ warn(s"HADOOP_CONF_DIR does not export.")
+ } else {
+ classpathEntries.add(hadoopConfDir.get)
+ }
env.get("YARN_CONF_DIR").foreach(classpathEntries.add)
// jars from hive distribution
classpathEntries.add(s"$hiveHome${File.separator}lib${File.separator}*")
val hadoopCp = env.get("HIVE_HADOOP_CLASSPATH").orElse(env.get("HADOOP_CLASSPATH"))
hadoopCp.foreach(path => classpathEntries.add(s"$path${File.separator}*"))
if (hadoopCp.isEmpty) {
+ warn(s"HIVE_HADOOP_CLASSPATH or HADOOP_CLASSPATH don't export.")
mainResource.foreach { path =>
val devHadoopJars = Paths.get(path).getParent
.resolve(s"scala-$SCALA_COMPILE_VERSION")
.resolve("jars")
+ if (!Files.exists(devHadoopJars)) {
+ throw new KyuubiException(s"The path $devHadoopJars does not exists. ")
+ }
classpathEntries.add(s"$devHadoopJars${File.separator}*")
}