Index: ql/src/java/org/apache/hadoop/hive/ql/optimizer/MapJoinProcessor.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/optimizer/MapJoinProcessor.java (revision 1459223) +++ ql/src/java/org/apache/hadoop/hive/ql/optimizer/MapJoinProcessor.java (working copy) @@ -439,7 +439,7 @@ } if (filterMap != null && filterMap[pos] != null && pos != mapJoinPos) { ExprNodeColumnDesc isFilterDesc = new ExprNodeColumnDesc(TypeInfoFactory - .getPrimitiveTypeInfo(serdeConstants.TINYINT_TYPE_NAME), "filter", "filter", false); + .getPrimitiveTypeInfo(serdeConstants.SMALLINT_TYPE_NAME), "filter", "filter", false); valueFilteredCols.add(isFilterDesc); } Index: ql/src/java/org/apache/hadoop/hive/ql/exec/HashTableSinkOperator.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/exec/HashTableSinkOperator.java (revision 1459223) +++ ql/src/java/org/apache/hadoop/hive/ql/exec/HashTableSinkOperator.java (working copy) @@ -231,7 +231,7 @@ if (filterMap != null && filterMap[alias] != null) { // for each alias, add object inspector for filter tag as the last element rcOIs = new ArrayList(rcOIs); - rcOIs.add(PrimitiveObjectInspectorFactory.writableByteObjectInspector); + rcOIs.add(PrimitiveObjectInspectorFactory.writableShortObjectInspector); } rowContainerObjectInspectors[alias] = rcOIs; } Index: ql/src/java/org/apache/hadoop/hive/ql/exec/JoinUtil.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/exec/JoinUtil.java (revision 1459223) +++ ql/src/java/org/apache/hadoop/hive/ql/exec/JoinUtil.java (working copy) @@ -35,15 +35,15 @@ import org.apache.hadoop.hive.ql.plan.TableDesc; import org.apache.hadoop.hive.serde2.SerDe; import org.apache.hadoop.hive.serde2.SerDeException; +import org.apache.hadoop.hive.serde2.io.ShortWritable; import org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe; import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector; import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorFactory; import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorUtils; +import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorUtils.ObjectInspectorCopyOption; import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector; import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector; -import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorUtils.ObjectInspectorCopyOption; import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory; -import org.apache.hadoop.hive.serde2.io.ByteWritable; import org.apache.hadoop.mapred.Reporter; import org.apache.hadoop.mapred.SequenceFileInputFormat; import org.apache.hadoop.util.ReflectionUtils; @@ -203,7 +203,7 @@ if (filterMap != null) { nr = new Object[valueFields.size()+1]; // add whether the row is filtered or not. - nr[valueFields.size()] = new ByteWritable(isFiltered(row, filters, filtersOI, filterMap)); + nr[valueFields.size()] = new ShortWritable(isFiltered(row, filters, filtersOI, filterMap)); }else{ nr = new Object[valueFields.size()]; } @@ -235,22 +235,29 @@ } if (filterMap != null) { // add whether the row is filtered or not. - nr.add(new ByteWritable(isFiltered(row, filters, filtersOI, filterMap))); + nr.add(new ShortWritable(isFiltered(row, filters, filtersOI, filterMap))); } return nr; } - private static final byte[] MASKS = new byte[] - {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, (byte) 0x80}; + private static final short[] MASKS; + static { + int num = 32; + MASKS = new short[num]; + MASKS[0] = 1; + for (int idx = 1; idx < num; idx++) { + MASKS[idx] = (short)(2 * MASKS[idx-1]); + } + } /** * Returns true if the row does not pass through filters. */ - protected static byte isFiltered(Object row, List filters, + protected static short isFiltered(Object row, List filters, List ois, int[] filterMap) throws HiveException { // apply join filters on the row. - byte ret = 0; + short ret = 0; int j = 0; for (int i = 0; i < filterMap.length; i += 2) { int tag = filterMap[i]; @@ -274,11 +281,11 @@ return ret; } - protected static boolean isFiltered(byte filter, int tag) { + protected static boolean isFiltered(short filter, int tag) { return (filter & MASKS[tag]) != 0; } - protected static boolean hasAnyFiltered(byte tag) { + protected static boolean hasAnyFiltered(short tag) { return tag != 0; } Index: ql/src/java/org/apache/hadoop/hive/ql/exec/CommonJoinOperator.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/exec/CommonJoinOperator.java (revision 1459223) +++ ql/src/java/org/apache/hadoop/hive/ql/exec/CommonJoinOperator.java (working copy) @@ -36,7 +36,7 @@ import org.apache.hadoop.hive.ql.plan.JoinCondDesc; import org.apache.hadoop.hive.ql.plan.JoinDesc; import org.apache.hadoop.hive.ql.plan.TableDesc; -import org.apache.hadoop.hive.serde2.io.ByteWritable; +import org.apache.hadoop.hive.serde2.io.ShortWritable; import org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe; import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector; import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorFactory; @@ -273,18 +273,15 @@ for (Byte alias : order) { ArrayList rcOIs = new ArrayList(); rcOIs.addAll(joinValuesObjectInspectors[alias]); - // for each alias, add object inspector for boolean as the last element + // for each alias, add object inspector for short as the last element rcOIs.add( - PrimitiveObjectInspectorFactory.writableByteObjectInspector); + PrimitiveObjectInspectorFactory.writableShortObjectInspector); rowContainerObjectInspectors[alias] = rcOIs; } rowContainerStandardObjectInspectors = JoinUtil.getStandardObjectInspectors(rowContainerObjectInspectors,NOTSKIPBIGTABLE, tagLen); } - - - dummyObj = new Object[numAliases]; dummyObjVectors = new RowContainer[numAliases]; @@ -309,7 +306,7 @@ // add whether the row is filtered or not // this value does not matter for the dummyObj // because the join values are already null - nr.add(new ByteWritable()); + nr.add(new ShortWritable()); } dummyObj[pos] = nr; // there should be only 1 dummy object in the RowContainer @@ -861,7 +858,7 @@ // returns filter result of left object by filters associated with right alias private boolean isLeftFiltered(int left, int right, List leftObj) { if (joinValues[order[left]].size() < leftObj.size()) { - ByteWritable filter = (ByteWritable) leftObj.get(leftObj.size() - 1); + ShortWritable filter = (ShortWritable) leftObj.get(leftObj.size() - 1); return JoinUtil.isFiltered(filter.get(), right); } return false; @@ -870,7 +867,7 @@ // returns filter result of right object by filters associated with left alias private boolean isRightFiltered(int left, int right, List rightObj) { if (joinValues[order[right]].size() < rightObj.size()) { - ByteWritable filter = (ByteWritable) rightObj.get(rightObj.size() - 1); + ShortWritable filter = (ShortWritable) rightObj.get(rightObj.size() - 1); return JoinUtil.isFiltered(filter.get(), left); } return false; @@ -879,7 +876,7 @@ // returns object has any filtered tag private boolean hasAnyFiltered(int alias, List row) { return row == dummyObj[alias] || - hasFilter(alias) && JoinUtil.hasAnyFiltered(((ByteWritable) row.get(row.size() - 1)).get()); + hasFilter(alias) && JoinUtil.hasAnyFiltered(((ShortWritable) row.get(row.size() - 1)).get()); } protected final boolean hasFilter(int alias) { Index: ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java (revision 1459223) +++ ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java (working copy) @@ -6580,8 +6580,8 @@ } if (!node.getNoOuterJoin() || !target.getNoOuterJoin()) { // todo 8 way could be not enough number - if (node.getRightAliases().length + node.getRightAliases().length + 1 >= 8) { - LOG.info(ErrorMsg.JOINNODE_OUTERJOIN_MORETHAN_8); + if (node.getLeftAliases().length + node.getRightAliases().length + 1 >= 32) { + LOG.info(ErrorMsg.JOINNODE_OUTERJOIN_MORETHAN_32); return false; } } Index: ql/src/java/org/apache/hadoop/hive/ql/ErrorMsg.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/ErrorMsg.java (revision 1459223) +++ ql/src/java/org/apache/hadoop/hive/ql/ErrorMsg.java (working copy) @@ -236,8 +236,8 @@ "Fix the metadata or don't use bucketed mapjoin, by setting " + "hive.enforce.bucketmapjoin to false."), - JOINNODE_OUTERJOIN_MORETHAN_8(10142, "Single join node containing outer join(s) " + - "cannot have more than 8 aliases"), + JOINNODE_OUTERJOIN_MORETHAN_32(10142, "Single join node containing outer join(s) " + + "cannot have more than 32 aliases"), INVALID_JDO_FILTER_EXPRESSION(10043, "Invalid expression for JDO filter"),