Return-Path: X-Original-To: apmail-hive-commits-archive@www.apache.org Delivered-To: apmail-hive-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id F32D31834A for ; Fri, 6 Nov 2015 13:53:01 +0000 (UTC) Received: (qmail 58071 invoked by uid 500); 6 Nov 2015 13:53:01 -0000 Delivered-To: apmail-hive-commits-archive@hive.apache.org Received: (qmail 58026 invoked by uid 500); 6 Nov 2015 13:53:01 -0000 Mailing-List: contact commits-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hive-dev@hive.apache.org Delivered-To: mailing list commits@hive.apache.org Received: (qmail 58015 invoked by uid 99); 6 Nov 2015 13:53:01 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Nov 2015 13:53:01 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B1B6DDFDD0; Fri, 6 Nov 2015 13:53:01 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ctang@apache.org To: commits@hive.apache.org Message-Id: <71e6501531954155b2998d8853e5f65b@git.apache.org> X-Mailer: ASF-Git Admin Mailer 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, 6 Nov 2015 13:53:01 +0000 (UTC) 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 Authored: Fri Nov 6 08:51:41 2015 -0500 Committer: ctang 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