diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/MapJoinOperator.java ql/src/java/org/apache/hadoop/hive/ql/exec/MapJoinOperator.java index b08c984..8c1905b 100644 --- ql/src/java/org/apache/hadoop/hive/ql/exec/MapJoinOperator.java +++ ql/src/java/org/apache/hadoop/hive/ql/exec/MapJoinOperator.java @@ -226,14 +226,8 @@ public void processOp(Object row, int tag) throws HiveException { // compute keys and values as StandardObjects AbstractMapJoinKey key = JoinUtil.computeMapJoinKeys(row, joinKeys.get(alias), joinKeysObjectInspectors.get(alias)); - ArrayList value = JoinUtil.computeValues(row, joinValues.get(alias), - joinValuesObjectInspectors.get(alias), joinFilters.get(alias), joinFilterObjectInspectors - .get(alias), filterMap == null ? null : filterMap[alias]); - - - // Add the value to the ArrayList - storage.get(alias).add(value); + boolean joinNeeded = false; for (byte pos = 0; pos < order.length; pos++) { if (pos != alias) { @@ -242,23 +236,31 @@ public void processOp(Object row, int tag) throws HiveException { // there is no join-value or join-key has all null elements if (o == null || key.hasAnyNulls(nullsafes)) { - if (noOuterJoin) { - storage.put(pos, emptyList); - } else { + if (!noOuterJoin) { storage.put(pos, dummyObjVectors[pos]); } } else { + joinNeeded = true; rowContainer.reset(o.getObj()); storage.put(pos, rowContainer); } } } - // generate the output records - checkAndGenObject(); + if (joinNeeded) { + ArrayList value = JoinUtil.computeValues(row, joinValues.get(alias), + joinValuesObjectInspectors.get(alias), joinFilters.get(alias), joinFilterObjectInspectors + .get(alias), filterMap == null ? null : filterMap[alias]); + + // Add the value to the ArrayList + storage.get((byte) tag).add(value); - // done with the row - storage.get((byte) tag).clear(); + // generate the output records + checkAndGenObject(); + + // done with the row + storage.get((byte) tag).clear(); + } for (byte pos = 0; pos < order.length; pos++) { if (pos != tag) {