hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ct...@apache.org
Subject hive git commit: HIVE-12346:Internally used variables in HiveConf should not be settable via command (Chaoyu Tang, reviewed by Xuefu Zhang)
Date Fri, 06 Nov 2015 13:53:01 GMT
Repository: hive
Updated Branches:
  refs/heads/master b29705ed7 -> 2ae1c5cc7


HIVE-12346:Internally used variables in HiveConf should not be settable via command (Chaoyu
Tang, reviewed by Xuefu Zhang)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/2ae1c5cc
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/2ae1c5cc
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/2ae1c5cc

Branch: refs/heads/master
Commit: 2ae1c5cc7b3575b34dff5dbb7605b81bc19cc4b1
Parents: b29705e
Author: ctang <ctang.ma@gmail.com>
Authored: Fri Nov 6 08:51:41 2015 -0500
Committer: ctang <ctang.ma@gmail.com>
Committed: Fri Nov 6 08:51:53 2015 -0500

----------------------------------------------------------------------
 .../java/org/apache/hadoop/hive/conf/HiveConf.java   | 15 ++++++++++++++-
 .../clientnegative/set_hiveconf_internal_variable0.q |  4 ++++
 .../clientnegative/set_hiveconf_internal_variable1.q |  4 ++++
 .../set_hiveconf_internal_variable0.q.out            | 11 +++++++++++
 .../set_hiveconf_internal_variable1.q.out            | 11 +++++++++++
 5 files changed, 44 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/2ae1c5cc/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
----------------------------------------------------------------------
diff --git a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
index 98f9206..12276bf 100644
--- a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
+++ b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
@@ -2104,6 +2104,10 @@ public class HiveConf extends Configuration {
         METASTOREPWD.varname + "," + HIVE_SERVER2_SSL_KEYSTORE_PASSWORD.varname,
         "Comma separated list of configuration options which should not be read by normal
user like passwords"),
 
+    HIVE_CONF_INTERNAL_VARIABLE_LIST("hive.conf.internal.variable.list",
+        "hive.added.files.path,hive.added.jars.path,hive.added.archives.path",
+        "Comma separated list of variables which are used internally and should not be configurable."),
+
     // If this is set all move tasks at the end of a multi-insert query will only begin once
all
     // outputs are ready
     HIVE_MULTI_INSERT_MOVE_TASKS_SHARE_DEPENDENCIES(
@@ -2634,7 +2638,7 @@ public class HiveConf extends Configuration {
     }
     if (restrictList.contains(name)) {
       throw new IllegalArgumentException("Cannot modify " + name + " at runtime. It is in
the list"
-          + "of parameters that can't be modified at runtime");
+          + " of parameters that can't be modified at runtime");
     }
     String oldValue = name != null ? get(name) : null;
     if (name == null || value == null || !value.equals(oldValue)) {
@@ -3329,9 +3333,18 @@ public class HiveConf extends Configuration {
         restrictList.add(entry.trim());
       }
     }
+
+    String internalVariableListStr = this.getVar(ConfVars.HIVE_CONF_INTERNAL_VARIABLE_LIST);
+    if (internalVariableListStr != null) {
+      for (String entry : internalVariableListStr.split(",")) {
+        restrictList.add(entry.trim());
+      }
+    }
+
     restrictList.add(ConfVars.HIVE_IN_TEST.varname);
     restrictList.add(ConfVars.HIVE_CONF_RESTRICTED_LIST.varname);
     restrictList.add(ConfVars.HIVE_CONF_HIDDEN_LIST.varname);
+    restrictList.add(ConfVars.HIVE_CONF_INTERNAL_VARIABLE_LIST.varname);
   }
 
   private void setupHiddenSet() {

http://git-wip-us.apache.org/repos/asf/hive/blob/2ae1c5cc/ql/src/test/queries/clientnegative/set_hiveconf_internal_variable0.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientnegative/set_hiveconf_internal_variable0.q b/ql/src/test/queries/clientnegative/set_hiveconf_internal_variable0.q
new file mode 100644
index 0000000..b6393e4
--- /dev/null
+++ b/ql/src/test/queries/clientnegative/set_hiveconf_internal_variable0.q
@@ -0,0 +1,4 @@
+-- should fail: for some internal variables which should not be settable via set command
+desc src;
+
+set hive.added.jars.path=file://rootdir/test/added/a.jar;

http://git-wip-us.apache.org/repos/asf/hive/blob/2ae1c5cc/ql/src/test/queries/clientnegative/set_hiveconf_internal_variable1.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientnegative/set_hiveconf_internal_variable1.q b/ql/src/test/queries/clientnegative/set_hiveconf_internal_variable1.q
new file mode 100644
index 0000000..0038f36
--- /dev/null
+++ b/ql/src/test/queries/clientnegative/set_hiveconf_internal_variable1.q
@@ -0,0 +1,4 @@
+-- should fail: hive.conf.internal.variable.list is in restricted list
+desc src;
+
+set hive.conf.internal.variable.list=;

http://git-wip-us.apache.org/repos/asf/hive/blob/2ae1c5cc/ql/src/test/results/clientnegative/set_hiveconf_internal_variable0.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/set_hiveconf_internal_variable0.q.out b/ql/src/test/results/clientnegative/set_hiveconf_internal_variable0.q.out
new file mode 100644
index 0000000..61dafb4
--- /dev/null
+++ b/ql/src/test/results/clientnegative/set_hiveconf_internal_variable0.q.out
@@ -0,0 +1,11 @@
+PREHOOK: query: -- should fail: for some internal variables which should not be settable
via set command
+desc src
+PREHOOK: type: DESCTABLE
+PREHOOK: Input: default@src
+POSTHOOK: query: -- should fail: for some internal variables which should not be settable
via set command
+desc src
+POSTHOOK: type: DESCTABLE
+POSTHOOK: Input: default@src
+key                 	string              	default             
+value               	string              	default             
+Query returned non-zero code: 1, cause: Cannot modify hive.added.jars.path at runtime. It
is in the list of parameters that can't be modified at runtime

http://git-wip-us.apache.org/repos/asf/hive/blob/2ae1c5cc/ql/src/test/results/clientnegative/set_hiveconf_internal_variable1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/set_hiveconf_internal_variable1.q.out b/ql/src/test/results/clientnegative/set_hiveconf_internal_variable1.q.out
new file mode 100644
index 0000000..ae2dafb
--- /dev/null
+++ b/ql/src/test/results/clientnegative/set_hiveconf_internal_variable1.q.out
@@ -0,0 +1,11 @@
+PREHOOK: query: -- should fail: hive.conf.internal.variable.list is in restricted list
+desc src
+PREHOOK: type: DESCTABLE
+PREHOOK: Input: default@src
+POSTHOOK: query: -- should fail: hive.conf.internal.variable.list is in restricted list
+desc src
+POSTHOOK: type: DESCTABLE
+POSTHOOK: Input: default@src
+key                 	string              	default             
+value               	string              	default             
+Query returned non-zero code: 1, cause: Cannot modify hive.conf.internal.variable.list at
runtime. It is in the list of parameters that can't be modified at runtime


Mime
View raw message