Index: common/src/java/org/apache/hadoop/hive/conf/HiveConf.java =================================================================== --- common/src/java/org/apache/hadoop/hive/conf/HiveConf.java (revision 1032760) +++ common/src/java/org/apache/hadoop/hive/conf/HiveConf.java (working copy) @@ -483,6 +483,16 @@ initialize(cls); } + /** + * Copy constructor + */ + public HiveConf(HiveConf other) { + super(other); + hiveJar = other.hiveJar; + auxJars = other.auxJars; + origProp = (Properties)other.origProp.clone(); + } + private Properties getUnderlyingProps() { Iterator> iter = this.iterator(); Properties p = new Properties(); Index: ql/src/java/org/apache/hadoop/hive/ql/exec/Task.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/exec/Task.java (revision 1032760) +++ ql/src/java/org/apache/hadoop/hive/ql/exec/Task.java (working copy) @@ -58,6 +58,7 @@ protected transient TaskHandle taskHandle; protected transient HashMap taskCounters; protected transient DriverContext driverContext; + protected transient boolean clonedConf = false; // Descendants tasks who subscribe feeds from this task protected transient List> feedSubscribers; @@ -381,4 +382,11 @@ // a subscriber accept the feed and do something depending on the Task type protected void receiveFeed(FeedType feedType, Object feedValue) { } + + protected void cloneConf () { + if (!clonedConf) { + clonedConf = true; + conf = new HiveConf(conf); + } + } } \ No newline at end of file Index: ql/src/java/org/apache/hadoop/hive/ql/exec/MapRedTask.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/exec/MapRedTask.java (revision 1032760) +++ ql/src/java/org/apache/hadoop/hive/ql/exec/MapRedTask.java (working copy) @@ -102,8 +102,8 @@ String reason = MapRedTask.isEligibleForLocalMode(conf, inputSummary, numReducers); if (reason == null) { - // set the JT to local for the duration of this job - ctx.setOriginalTracker(conf.getVar(HiveConf.ConfVars.HADOOPJT)); + // clone configuration before modifying it on per-task basis + cloneConf(); conf.setVar(HiveConf.ConfVars.HADOOPJT, "local"); console.printInfo("Selecting local mode for task: " + getId()); } else { @@ -121,6 +121,9 @@ return super.execute(driverContext); } + // we need to edit the configuration to setup cmdline. clone it first + cloneConf(); + // enable assertion String hadoopExec = conf.getVar(HiveConf.ConfVars.HADOOPBIN); String hiveJar = conf.getJar();