Index: ql/src/java/org/apache/hadoop/hive/ql/optimizer/physical/CommonJoinResolver.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/optimizer/physical/CommonJoinResolver.java (revision 1452628) +++ ql/src/java/org/apache/hadoop/hive/ql/optimizer/physical/CommonJoinResolver.java (working copy) @@ -234,11 +234,8 @@ } // create map join task and set big table as bigTablePosition - private ObjectPair convertTaskToMapJoinTask(String xml, + private ObjectPair convertTaskToMapJoinTask(MapredWork newWork, int bigTablePosition) throws UnsupportedEncodingException, SemanticException { - // deep copy a new mapred work from xml - InputStream in = new ByteArrayInputStream(xml.getBytes("UTF-8")); - MapredWork newWork = Utilities.deserializeMapRedWork(in, physicalContext.getConf()); // create a mapred task for this work MapRedTask newTask = (MapRedTask) TaskFactory.get(newWork, physicalContext .getParseContext().getConf()); @@ -365,14 +362,13 @@ String bigTableAlias = null; currWork.setOpParseCtxMap(parseCtx.getOpParseCtx()); currWork.setJoinTree(joinTree); - String xml = currWork.toXML(); if (convertJoinMapJoin) { // create map join task and set big table as bigTablePosition - MapRedTask newTask = convertTaskToMapJoinTask(xml, bigTablePosition).getFirst(); + MapRedTask newTask = convertTaskToMapJoinTask(currWork, bigTablePosition).getFirst(); newTask.setTaskTag(Task.MAPJOIN_ONLY_NOBACKUP); - replaceTask(currTask, newTask, physicalContext); + //replaceTask(currTask, newTask, physicalContext); // Can this task be merged with the child task. This can happen if a big table is being // joined with multiple small tables on different keys @@ -388,6 +384,7 @@ long ThresholdOfSmallTblSizeSum = HiveConf.getLongVar(conf, HiveConf.ConfVars.HIVESMALLTABLESFILESIZE); + String xml = currWork.toXML(); for (int i = 0; i < numAliases; i++) { // this table cannot be big table if (!bigTableCandidates.contains(i)) { @@ -395,7 +392,10 @@ } // create map join task and set big table as i - ObjectPair newTaskAlias = convertTaskToMapJoinTask(xml, i); + // deep copy a new mapred work from xml + InputStream in = new ByteArrayInputStream(xml.getBytes("UTF-8")); + MapredWork newWork = Utilities.deserializeMapRedWork(in, physicalContext.getConf()); + ObjectPair newTaskAlias = convertTaskToMapJoinTask(newWork, i); MapRedTask newTask = newTaskAlias.getFirst(); bigTableAlias = newTaskAlias.getSecond();