Index: ql/src/java/org/apache/hadoop/hive/ql/processors/SetProcessor.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/processors/SetProcessor.java (revision 1310557) +++ ql/src/java/org/apache/hadoop/hive/ql/processors/SetProcessor.java (working copy) @@ -31,6 +31,8 @@ import org.apache.hadoop.hive.metastore.api.Schema; import org.apache.hadoop.hive.ql.parse.VariableSubstitution; import org.apache.hadoop.hive.ql.session.SessionState; +import org.apache.hadoop.hive.ql.metadata.Hive; +import org.apache.hadoop.hive.ql.metadata.HiveException; /** * SetProcessor. @@ -101,7 +103,8 @@ public void init() { } - private CommandProcessorResponse setVariable(String varname, String varvalue){ + private CommandProcessorResponse setVariable(String varname, String varvalue) + throws HiveException { SessionState ss = SessionState.get(); if (varname.startsWith(SetProcessor.ENV_PREFIX)){ ss.err.println("env:* variables can not be set."); @@ -122,6 +125,8 @@ String substitutedValue = new VariableSubstitution().substitute(ss.getConf(),varvalue); ss.getConf().set(varname, substitutedValue ); ss.getOverriddenConfigurations().put(varname, substitutedValue); + // If anything changed in the conf, this should be reflected in Hive's conf also + Hive.get(ss.getConf(), true); return new CommandProcessorResponse(0); } } @@ -220,7 +225,16 @@ ss.setIsSilent(getBoolean(part[1])); return new CommandProcessorResponse(0); } - return setVariable(part[0],part[1]); + CommandProcessorResponse ret = null; + try { + ret = setVariable(part[0],part[1]); + } catch (HiveException e) { + // An exception can be thrown, since the Hive's conf is changed + // Throw a random error for now + return new CommandProcessorResponse(-1001); + } + + return ret; } else { return getVariable(nwcmd); }