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 348ad36..310f420 100644 --- ql/src/java/org/apache/hadoop/hive/ql/exec/MapJoinOperator.java +++ ql/src/java/org/apache/hadoop/hive/ql/exec/MapJoinOperator.java @@ -228,14 +228,8 @@ public void processOp(Object row, int tag) throws HiveException { // compute keys and values as StandardObjects AbstractMapJoinKey key = JoinUtil.computeMapJoinKeys(row, joinKeys[alias], joinKeysObjectInspectors[alias]); - ArrayList value = JoinUtil.computeValues(row, joinValues[alias], - joinValuesObjectInspectors[alias], joinFilters[alias], joinFilterObjectInspectors - [alias], filterMap == null ? null : filterMap[alias]); - - - // Add the value to the ArrayList - storage[alias].add(value); + boolean joinNeeded = false; for (byte pos = 0; pos < order.length; pos++) { if (pos != alias) { @@ -244,23 +238,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[pos] = emptyList; - } else { + if (!noOuterJoin) { storage[pos] = dummyObjVectors[pos]; } } else { + joinNeeded = true; rowContainer.reset(o.getObj()); storage[pos] = rowContainer; } } } - // generate the output records - checkAndGenObject(); + if (joinNeeded) { + ArrayList value = JoinUtil.computeValues(row, joinValues[alias], + joinValuesObjectInspectors[alias], joinFilters[alias], joinFilterObjectInspectors + [alias], filterMap == null ? null : filterMap[alias]); + + // Add the value to the ArrayList + storage[alias].add(value); - // done with the row - storage[tag].clear(); + // generate the output records + checkAndGenObject(); + + // done with the row + storage[tag].clear(); + } for (byte pos = 0; pos < order.length; pos++) { if (pos != tag) {