Index: conf/hive-default.xml.template =================================================================== --- conf/hive-default.xml.template (revision 1459648) +++ conf/hive-default.xml.template (working copy) @@ -785,6 +785,12 @@ + hive.ignore.mapjoin.hint + true + Ignore the mapjoin hint + + + hive.mapjoin.localtask.max.memory.usage 0.90 This number means how much memory the local task can take to hold the key/value into in-memory hash table; If the local task's memory usage is more than this number, the local task will be abort by themself. It means the data of small table is too large to be hold in the memory. Index: data/conf/hive-site.xml =================================================================== --- data/conf/hive-site.xml (revision 1459648) +++ data/conf/hive-site.xml (working copy) @@ -177,6 +177,12 @@ + hive.ignore.mapjoin.hint + false + Whether Hive ignores the mapjoin hint + + + hive.input.format org.apache.hadoop.hive.ql.io.CombineHiveInputFormat The default input format, if it is not specified, the system assigns it. It is set to HiveInputFormat for hadoop versions 17, 18 and 19, whereas it is set to CombineHiveInputFormat for hadoop 20. The user can always overwrite it - if there is a bug in CombineHiveInputFormat, it can always be manually set to HiveInputFormat. Index: common/src/java/org/apache/hadoop/hive/conf/HiveConf.java =================================================================== --- common/src/java/org/apache/hadoop/hive/conf/HiveConf.java (revision 1459648) +++ common/src/java/org/apache/hadoop/hive/conf/HiveConf.java (working copy) @@ -223,6 +223,9 @@ // not specified DROPIGNORESNONEXISTENT("hive.exec.drop.ignorenonexistent", true), + // ignore the mapjoin hint + HIVEIGNOREMAPJOINHINT("hive.ignore.mapjoin.hint", true), + // Hadoop Configuration Properties // Properties with null values are ignored and exist only for the purpose of giving us // a symbolic name to reference in the Hive source code. Properties with non-null Index: ql/src/java/org/apache/hadoop/hive/ql/QueryProperties.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/QueryProperties.java (revision 1459648) +++ ql/src/java/org/apache/hadoop/hive/ql/QueryProperties.java (working copy) @@ -43,6 +43,7 @@ boolean hasDistributeBy = false; boolean hasClusterBy = false; + boolean mapJoinRemoved = false; public boolean hasJoin() { return hasJoin; @@ -107,4 +108,12 @@ public void setHasClusterBy(boolean hasClusterBy) { this.hasClusterBy = hasClusterBy; } + + public boolean isMapJoinRemoved() { + return mapJoinRemoved; + } + + public void setMapJoinRemoved(boolean mapJoinRemoved) { + this.mapJoinRemoved = mapJoinRemoved; + } } Index: ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java (revision 1459648) +++ ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java (working copy) @@ -6096,19 +6096,27 @@ private List getMapSideJoinTables(QB qb) { List cols = new ArrayList(); + + ASTNode hints = qb.getParseInfo().getHints(); for (int pos = 0; pos < hints.getChildCount(); pos++) { ASTNode hint = (ASTNode) hints.getChild(pos); if (((ASTNode) hint.getChild(0)).getToken().getType() == HiveParser.TOK_MAPJOIN) { - ASTNode hintTblNames = (ASTNode) hint.getChild(1); - int numCh = hintTblNames.getChildCount(); - for (int tblPos = 0; tblPos < numCh; tblPos++) { - String tblName = ((ASTNode) hintTblNames.getChild(tblPos)).getText() - .toLowerCase(); - if (!cols.contains(tblName)) { - cols.add(tblName); + // the user has specified to ignore mapjoin hint + if (!conf.getBoolVar(HiveConf.ConfVars.HIVEIGNOREMAPJOINHINT)) { + ASTNode hintTblNames = (ASTNode) hint.getChild(1); + int numCh = hintTblNames.getChildCount(); + for (int tblPos = 0; tblPos < numCh; tblPos++) { + String tblName = ((ASTNode) hintTblNames.getChild(tblPos)).getText() + .toLowerCase(); + if (!cols.contains(tblName)) { + cols.add(tblName); + } } } + else { + queryProperties.setMapJoinRemoved(true); + } } }