You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ab...@apache.org on 2022/03/12 15:05:52 UTC

[hive] branch master updated: HIVE-26001: LlapServiceDriver: forward hiveconf from commandline to AsyncTaskCreateUdfFile (#3074) (Laszlo Bodor reviewed by Ramesh Kumar)

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

abstractdog pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new f654131  HIVE-26001: LlapServiceDriver: forward hiveconf from commandline to AsyncTaskCreateUdfFile (#3074) (Laszlo Bodor reviewed by Ramesh Kumar)
f654131 is described below

commit f6541313a8cffd160d619884ddab616328150fc8
Author: Bodor Laszlo <bo...@gmail.com>
AuthorDate: Sat Mar 12 16:05:31 2022 +0100

    HIVE-26001: LlapServiceDriver: forward hiveconf from commandline to AsyncTaskCreateUdfFile (#3074) (Laszlo Bodor reviewed by Ramesh Kumar)
---
 common/src/java/org/apache/hadoop/hive/conf/HiveConfUtil.java | 11 +++++++++++
 .../hadoop/hive/llap/cli/service/AsyncTaskCreateUdfFile.java  |  2 +-
 .../hadoop/hive/llap/cli/service/LlapServiceDriver.java       |  4 ++++
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/common/src/java/org/apache/hadoop/hive/conf/HiveConfUtil.java b/common/src/java/org/apache/hadoop/hive/conf/HiveConfUtil.java
index 7985758..179ee83 100644
--- a/common/src/java/org/apache/hadoop/hive/conf/HiveConfUtil.java
+++ b/common/src/java/org/apache/hadoop/hive/conf/HiveConfUtil.java
@@ -35,10 +35,12 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
+import java.util.Enumeration;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 import java.util.Set;
 import java.util.StringTokenizer;
 import java.util.stream.Stream;
@@ -276,4 +278,13 @@ public class HiveConfUtil {
     String propertyValue = HiveStringUtils.insertValue(keyName, newKeyValue, existingValue);
     jobConf.set(property, propertyValue);
   }
+
+  @SuppressWarnings("unchecked")
+  public static void copyFromProperties(Properties propSource, HiveConf confTarget) {
+    Enumeration<String> props = (Enumeration<String>) propSource.propertyNames();
+    while (props.hasMoreElements()) {
+      String key = props.nextElement();
+      confTarget.set(key, propSource.getProperty(key));
+    }
+  }
 }
diff --git a/llap-server/src/java/org/apache/hadoop/hive/llap/cli/service/AsyncTaskCreateUdfFile.java b/llap-server/src/java/org/apache/hadoop/hive/llap/cli/service/AsyncTaskCreateUdfFile.java
index 430471e..32b84fd 100644
--- a/llap-server/src/java/org/apache/hadoop/hive/llap/cli/service/AsyncTaskCreateUdfFile.java
+++ b/llap-server/src/java/org/apache/hadoop/hive/llap/cli/service/AsyncTaskCreateUdfFile.java
@@ -90,7 +90,7 @@ class AsyncTaskCreateUdfFile implements Callable<Void> {
 
   private Set<String> downloadPermanentFunctions() throws HiveException, URISyntaxException, IOException {
     Map<String, String> udfs = new HashMap<String, String>();
-    HiveConf hiveConf = new HiveConf();
+    HiveConf hiveConf = new HiveConf(conf);
     // disable expensive operations on the metastore
     hiveConf.setBoolean(MetastoreConf.ConfVars.INIT_METADATA_COUNT_ENABLED.getVarname(), false);
     hiveConf.setBoolean(MetastoreConf.ConfVars.METRICS_ENABLED.getVarname(), false);
diff --git a/llap-server/src/java/org/apache/hadoop/hive/llap/cli/service/LlapServiceDriver.java b/llap-server/src/java/org/apache/hadoop/hive/llap/cli/service/LlapServiceDriver.java
index dae41b6..e0a02a5 100644
--- a/llap-server/src/java/org/apache/hadoop/hive/llap/cli/service/LlapServiceDriver.java
+++ b/llap-server/src/java/org/apache/hadoop/hive/llap/cli/service/LlapServiceDriver.java
@@ -27,6 +27,7 @@ import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.permission.FsPermission;
 import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.hadoop.hive.conf.HiveConfUtil;
 import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
 import org.apache.hadoop.hive.llap.LlapUtil;
 import org.apache.hadoop.hive.llap.cli.LlapSliderUtils;
@@ -73,6 +74,9 @@ public class LlapServiceDriver {
 
     SessionState ss = SessionState.get();
     this.conf = (ss != null) ? ss.getConf() : new HiveConf(SessionState.class);
+
+    HiveConfUtil.copyFromProperties(cl.getConfig(), this.conf);
+
     if (conf == null) {
       throw new Exception("Cannot load any configuration to run command");
     }