Source:
public void advance() throws IOException { int firstStreamIdx; if (sortedStreamReaders.length == 0) { numRowsInResult += inputQualifyingSet.getPositionCount(); inputQualifyingSet.eraseBelowRow(inputQualifyingSet.getEnd()); return; } QualifyingSet qualifyingSet; makeResultBudget(0, inputQualifyingSet.getPositionCount()); qualifyingSet = inputQualifyingSet; int numStreams = sortedStreamReaders.length; for (int streamIdx = 0; streamIdx < numStreams; ++streamIdx) { long startTime = 0; StreamReader reader = sortedStreamReaders[streamIdx]; Filter filter = reader.getFilter(); reader.setInputQualifyingSet(qualifyingSet); if (!hasFilter(streamIdx)) { reader.setOutputQualifyingSet(null); } if (reorderFilters && filter != null) { startTime = System.nanoTime(); } reader.scan(); if (filter != null) { QualifyingSet input = qualifyingSet; qualifyingSet = reader.getOutputQualifyingSet(); filter.updateStats(input.getPositionCount(), qualifyingSet.getPositionCount(), reorderFilters ? System.nanoTime() - startTime : 100); if (qualifyingSet.isEmpty()) { alignResultsAndRemoveFromQualifyingSet(0, streamIdx); return; } } if (filterFunctionOrder != null && streamIdx < filterFunctionOrder.length && filterFunctionOrder[streamIdx] != null) { qualifyingSet = evaluateFilterFunction(streamIdx, qualifyingSet); if (qualifyingSet.isEmpty()) { alignResultsAndRemoveFromQualifyingSet(0, streamIdx); return; } } } int numAdded = qualifyingSet.getPositionCount(); if (sortedStreamReaders.length > 0) { alignResultsAndRemoveFromQualifyingSet(numAdded, sortedStreamReaders.length - 1); } else { inputQualifyingSet.eraseBelowRow(inputQualifyingSet.getEnd()); } numRowsInResult += numAdded; }

Target:
public void advance() throws IOException { if (sortedStreamReaders.length == 0) { numRowsInResult += inputQualifyingSet.getPositionCount(); inputQualifyingSet.eraseBelowRow(inputQualifyingSet.getEnd()); return; } QualifyingSet qualifyingSet = inputQualifyingSet; makeResultBudget(qualifyingSet.getPositionCount()); int numStreams = sortedStreamReaders.length; for (int streamIdx = 0; streamIdx < numStreams; ++streamIdx) { long startTime = 0; StreamReader reader = sortedStreamReaders[streamIdx]; Filter filter = reader.getFilter(); reader.setInputQualifyingSet(qualifyingSet); if (!hasFilter(streamIdx)) { reader.setOutputQualifyingSet(null); } if (reorderFilters && filter != null) { startTime = System.nanoTime(); } reader.scan(); if (filter != null) { QualifyingSet input = qualifyingSet; qualifyingSet = reader.getOutputQualifyingSet(); filter.updateStats(input.getPositionCount(), qualifyingSet.getPositionCount(), reorderFilters ? System.nanoTime() - startTime : 100); if (qualifyingSet.isEmpty()) { alignResultsAndRemoveFromQualifyingSet(0, streamIdx); return; } } if (filterFunctionOrder != null && streamIdx < filterFunctionOrder.length && filterFunctionOrder[streamIdx] != null) { qualifyingSet = evaluateFilterFunction(streamIdx, qualifyingSet); if (qualifyingSet.isEmpty()) { alignResultsAndRemoveFromQualifyingSet(0, streamIdx); return; } } } int numAdded = qualifyingSet.getPositionCount(); if (sortedStreamReaders.length > 0) { alignResultsAndRemoveFromQualifyingSet(numAdded, sortedStreamReaders.length - 1); } else { inputQualifyingSet.eraseBelowRow(inputQualifyingSet.getEnd()); } numRowsInResult += numAdded; }