Index: ql/src/java/org/apache/hadoop/hive/ql/exec/MapJoinOperator.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/exec/MapJoinOperator.java (revision 1084672) +++ ql/src/java/org/apache/hadoop/hive/ql/exec/MapJoinOperator.java (working copy) @@ -64,6 +64,7 @@ transient int metadataKeyTag; transient int[] metadataValueTag; transient int maxMapJoinSize; + transient boolean hashTblInitedOnce; private int bigTableAlias; public MapJoinOperator() { @@ -103,7 +104,7 @@ rowContainerMap.put(Byte.valueOf((byte) pos), rowContainer); } - + hashTblInitedOnce = false; } @Override @@ -144,10 +145,17 @@ } private void loadHashTable() throws HiveException { + + if (!this.getExecContext().getLocalWork().getInputFileChangeSensitive()) { + if (hashTblInitedOnce) { + return; + } else { + hashTblInitedOnce = true; + } + } + boolean localMode = HiveConf.getVar(hconf, HiveConf.ConfVars.HADOOPJT).equals("local"); String baseDir = null; - HashMapWrapper hashtable; - Byte pos; String currentInputFile = HiveConf.getVar(hconf, HiveConf.ConfVars.HADOOPMAPFILENAME); LOG.info("******* Load from HashTable File: input : " + currentInputFile); @@ -181,8 +189,8 @@ } for (Map.Entry> entry : mapJoinTables .entrySet()) { - pos = entry.getKey(); - hashtable = entry.getValue(); + Byte pos = entry.getKey(); + HashMapWrapper hashtable = entry.getValue(); String filePath = Utilities.generatePath(baseDir, pos, currentFileName); Path path = new Path(filePath); LOG.info("\tLoad back 1 hashtable file from tmp file uri:" + path.toString()); @@ -293,7 +301,7 @@ public void closeOp(boolean abort) throws HiveException { if (mapJoinTables != null) { - for (HashMapWrapper hashTable : mapJoinTables.values()) { + for (HashMapWrapper hashTable : mapJoinTables.values()) { hashTable.close(); } }