use of org.apache.hadoop.hive.ql.exec.persistence.MapJoinEagerRowContainer in project hive by apache.
the class HashTableSinkOperator method process.
/*
* This operator only process small tables Read the key/value pairs Load them into hashtable
*/
@Override
public void process(Object row, int tag) throws HiveException {
byte alias = (byte) tag;
// compute keys and values as StandardObjects. Use non-optimized key (MR).
Object[] currentKey = new Object[joinKeys[alias].size()];
for (int keyIndex = 0; keyIndex < joinKeys[alias].size(); ++keyIndex) {
currentKey[keyIndex] = joinKeys[alias].get(keyIndex).evaluate(row);
}
MapJoinKeyObject key = new MapJoinKeyObject();
key.readFromRow(currentKey, joinKeysObjectInspectors[alias]);
Object[] value = emptyObjectArray;
if ((hasFilter(alias) && filterMaps[alias].length > 0) || joinValues[alias].size() > 0) {
value = JoinUtil.computeMapJoinValues(row, joinValues[alias], joinValuesObjectInspectors[alias], joinFilters[alias], joinFilterObjectInspectors[alias], filterMaps == null ? null : filterMaps[alias]);
}
MapJoinPersistableTableContainer tableContainer = mapJoinTables[alias];
MapJoinRowContainer rowContainer = tableContainer.get(key);
if (rowContainer == null) {
if (value.length != 0) {
rowContainer = new MapJoinEagerRowContainer();
rowContainer.addRow(value);
} else {
rowContainer = emptyRowContainer;
}
rowNumber++;
if (rowNumber > hashTableScale && rowNumber % hashTableScale == 0) {
memoryExhaustionHandler.checkMemoryStatus(tableContainer.size(), rowNumber);
}
tableContainer.put(key, rowContainer);
} else if (rowContainer == emptyRowContainer) {
rowContainer = rowContainer.copy();
rowContainer.addRow(value);
tableContainer.put(key, rowContainer);
} else {
rowContainer.addRow(value);
}
}
Aggregations