Skip to content

Commit

Permalink
HIVE-12346:Internally used variables in HiveConf should not be settab…
Browse files Browse the repository at this point in the history
…le via command (Chaoyu Tang, reviewed by Xuefu Zhang)
  • Loading branch information
chaoyu-tang committed Nov 6, 2015
1 parent 3bf280f commit eef89a2
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 1 deletion.
15 changes: 14 additions & 1 deletion common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
Original file line number Diff line number Diff line change
Expand Up @@ -2104,6 +2104,10 @@ public static enum ConfVars {
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(
Expand Down Expand Up @@ -2634,7 +2638,7 @@ public void verifyAndSet(String name, String value) throws IllegalArgumentExcept
}
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)) {
Expand Down Expand Up @@ -3329,9 +3333,18 @@ private void setupRestrictList() {
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() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- should fail: hive.conf.internal.variable.list is in restricted list
desc src;

set hive.conf.internal.variable.list=;
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit eef89a2

Please sign in to comment.