Index: conf/hive-default.xml.template =================================================================== --- conf/hive-default.xml.template (revision 1466798) +++ conf/hive-default.xml.template (working copy) @@ -969,9 +969,11 @@ hive.auto.convert.sortmerge.join.bigtable.selection.policy - org.apache.hadoop.hive.ql.optimizer.LeftmostBigTableSelectorForAutoSMJ + org.apache.hadoop.hive.ql.optimizer.AvgPartitionSizeBasedBigTableSelectorForAutoSMJ The policy to choose the big table for automatic conversion to sort-merge join. - By default, the leftmost table is assigned the big table. Other policies are based on size: + By default, the table with the largest partitions is assigned the big table. All policies are: + . based on position of the table - the leftmost table is selected + org.apache.hadoop.hive.ql.optimizer.LeftmostBigTableSMJ. . based on total size (all the partitions selected in the query) of the table org.apache.hadoop.hive.ql.optimizer.TableSizeBasedBigTableSelectorForAutoSMJ. . based on average size (all the partitions selected in the query) of the table Index: common/src/java/org/apache/hadoop/hive/conf/HiveConf.java =================================================================== --- common/src/java/org/apache/hadoop/hive/conf/HiveConf.java (revision 1466798) +++ common/src/java/org/apache/hadoop/hive/conf/HiveConf.java (working copy) @@ -523,7 +523,7 @@ HIVE_AUTO_SORTMERGE_JOIN("hive.auto.convert.sortmerge.join", false), HIVE_AUTO_SORTMERGE_JOIN_BIGTABLE_SELECTOR( "hive.auto.convert.sortmerge.join.bigtable.selection.policy", - "org.apache.hadoop.hive.ql.optimizer.LeftmostBigTableSelectorForAutoSMJ"), + "org.apache.hadoop.hive.ql.optimizer.AvgPartitionSizeBasedBigTableSelectorForAutoSMJ"), HIVESCRIPTOPERATORTRUST("hive.exec.script.trust", false), HIVEROWOFFSET("hive.exec.rowoffset", false), Index: ql/src/java/org/apache/hadoop/hive/ql/exec/CommonJoinOperator.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/exec/CommonJoinOperator.java (revision 1466798) +++ ql/src/java/org/apache/hadoop/hive/ql/exec/CommonJoinOperator.java (working copy) @@ -385,7 +385,7 @@ // all evaluation should be processed here for valid aliasFilterTags // // for MapJoin, filter tag is pre-calculated in MapredLocalTask and stored with value. - // when reading the hashtable, MapJoinObjectValue calcuates alias filter and provide it to join + // when reading the hashtable, MapJoinObjectValue calculates alias filter and provide it to join protected ArrayList getFilteredValue(byte alias, Object row) throws HiveException { boolean hasFilter = hasFilter(alias); ArrayList nr = JoinUtil.computeValues(row, joinValues[alias],