FAQ
Repository: hive
Updated Branches:
   refs/heads/branch-1 dbc7abe03 -> cc12612db


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/cc12612d
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/cc12612d
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/cc12612d

Branch: refs/heads/branch-1
Commit: cc12612db0a92837e906cbff196406b77bd93cc3
Parents: dbc7abe
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:53:41 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/cc12612d/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 33e20aa..210a95f 100644
--- a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
+++ b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
@@ -2035,6 +2035,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(
@@ -2496,7 +2500,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)) {
@@ -3178,9 +3182,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/cc12612d/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/cc12612d/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/cc12612d/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/cc12612d/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

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 2 | next ›
Discussion Overview
groupcommits @
categorieshive, hadoop
postedNov 6, '15 at 1:53p
activeNov 6, '15 at 1:56p
posts2
users1
websitehive.apache.org

1 user in discussion

Ctang: 2 posts

People

Translate

site design / logo © 2021 Grokbase