mirror of https://github.com/apache/druid.git
fix all problems with topNs
This commit is contained in:
parent
b81bd6c959
commit
36b54f7e8f
|
@ -78,8 +78,6 @@ public abstract class BaseTopNAlgorithm<DimValSelector, DimValAggregateStore, Pa
|
|||
while (numProcessed < cardinality) {
|
||||
final int numToProcess = Math.min(params.getNumValuesPerPass(), cardinality - numProcessed);
|
||||
|
||||
params.getCursor().reset();
|
||||
|
||||
DimValSelector theDimValSelector;
|
||||
if (!hasDimValSelector) {
|
||||
theDimValSelector = makeDimValSelector(params, numProcessed, numToProcess);
|
||||
|
@ -96,6 +94,7 @@ public abstract class BaseTopNAlgorithm<DimValSelector, DimValAggregateStore, Pa
|
|||
closeAggregators(aggregatesStore);
|
||||
|
||||
numProcessed += numToProcess;
|
||||
params.getCursor().reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -241,27 +241,22 @@ public class IncrementalIndexStorageAdapter implements StorageAdapter
|
|||
|
||||
if (numAdvanced == -1) {
|
||||
numAdvanced = 0;
|
||||
while (baseIter.hasNext()) {
|
||||
currEntry.set(baseIter.next());
|
||||
if (filterMatcher.matches()) {
|
||||
return;
|
||||
}
|
||||
|
||||
numAdvanced++;
|
||||
}
|
||||
} else {
|
||||
Iterators.advance(baseIter, numAdvanced);
|
||||
while (baseIter.hasNext()) {
|
||||
currEntry.set(baseIter.next());
|
||||
if (filterMatcher.matches()) {
|
||||
break;
|
||||
}
|
||||
|
||||
numAdvanced++;
|
||||
}
|
||||
}
|
||||
|
||||
done = cursorMap.size() == 0 || !baseIter.hasNext();
|
||||
boolean foundMatched = false;
|
||||
while (baseIter.hasNext()) {
|
||||
currEntry.set(baseIter.next());
|
||||
if (filterMatcher.matches()) {
|
||||
foundMatched = true;
|
||||
break;
|
||||
}
|
||||
|
||||
numAdvanced++;
|
||||
}
|
||||
|
||||
done = !foundMatched && (cursorMap.size() == 0 || !baseIter.hasNext());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue