private void processResults(List<KeyValue> result, boolean hasLimit) throws IOException {
if (result.isEmpty())
return;
ProjectedValueTuple tuple = projector.projectResults(new ResultTuple(new Result(result)));
if (joinInfo == null) {
resultQueue.offer(tuple);
return;
}
if (hasLimit)
throw new UnsupportedOperationException("Cannot support join operations in scans with limit");
int count = joinInfo.getJoinIds().length;
boolean cont = true;
for (int i = 0; i < count; i++) {
if (!(joinInfo.earlyEvaluation()[i]))
continue;
ImmutableBytesPtr key = TupleUtil.getConcatenatedValue(tuple, joinInfo.getJoinExpressions()[i]);
tempTuples[i] = hashCaches[i].get(key);
JoinType type = joinInfo.getJoinTypes()[i];
if (type == JoinType.Inner && (tempTuples[i] == null || tempTuples[i].isEmpty())) {
cont = false;
break;
}
}
if (cont) {
KeyValueSchema schema = joinInfo.getJoinedSchema();
resultQueue.offer(tuple);
for (int i = 0; i < count; i++) {
boolean earlyEvaluation = joinInfo.earlyEvaluation()[i];
if (earlyEvaluation &&
(tempTuples[i] == null || tempTuples[i].isEmpty()))
continue;
int j = resultQueue.size();
while (j-- > 0) {
ProjectedValueTuple lhs = resultQueue.poll();
if (!earlyEvaluation) {
ImmutableBytesPtr key = TupleUtil.getConcatenatedValue(lhs, joinInfo.getJoinExpressions()[i]);
tempTuples[i] = hashCaches[i].get(key);
if (tempTuples[i] == null || tempTuples[i].isEmpty()) {
if (joinInfo.getJoinTypes()[i] != JoinType.Inner) {
resultQueue.offer(lhs);
}
continue;
}
}
for (Tuple t : tempTuples[i]) {
ProjectedValueTuple joined = tempSrcBitSet[i] == ValueBitSet.EMPTY_VALUE_BITSET ?
lhs : ScanProjector.mergeProjectedValue(
lhs, schema, tempDestBitSet,
t, joinInfo.getSchemas()[i], tempSrcBitSet[i],
joinInfo.getFieldPositions()[i]);
resultQueue.offer(joined);
}
}
}
// apply post-join filter
Expression postFilter = joinInfo.getPostJoinFilterExpression();
if (postFilter != null) {
for (Iterator<ProjectedValueTuple> iter = resultQueue.iterator(); iter.hasNext();) {
ProjectedValueTuple t = iter.next();
ImmutableBytesWritable tempPtr = new ImmutableBytesWritable();
try {
if (!postFilter.evaluate(t, tempPtr)) {
iter.remove();
continue;