gianm commented on code in PR #17565:
URL: https://github.com/apache/druid/pull/17565#discussion_r1884554341
##########
processing/src/main/java/org/apache/druid/query/topn/TopNQueryEngine.java:
##########
@@ -245,6 +245,11 @@ private static boolean canUsePooledAlgorithm(
final int numBytesPerRecord
)
{
+ if (cardinality < 0) {
+ // unknown cardinality doesn't work with the pooled algorith which
requires an exact count of dictionary ids
Review Comment:
algorithm (spelling)
##########
processing/src/main/java/org/apache/druid/query/topn/Generic1AggPooledTopNScannerPrototype.java:
##########
@@ -54,25 +54,27 @@ public long scanAndAggregate(
{
long processedRows = 0;
int positionToAllocate = 0;
- while (!cursor.isDoneOrInterrupted()) {
- final IndexedInts dimValues = dimensionSelector.getRow();
- final int dimSize = dimValues.size();
- for (int i = 0; i < dimSize; i++) {
- int dimIndex = dimValues.get(i);
- int position = positions[dimIndex];
- if (position >= 0) {
- aggregator.aggregate(resultsBuffer, position);
- } else if (position == TopNAlgorithm.INIT_POSITION_VALUE) {
- positions[dimIndex] = positionToAllocate;
- position = positionToAllocate;
- aggregator.init(resultsBuffer, position);
- aggregator.aggregate(resultsBuffer, position);
- positionToAllocate += aggregatorSize;
+ if (granularizer.currentOffsetWithinBucket()) {
Review Comment:
was the `granularizer.currentOffsetWithinBucket()` check added here (& the
other prototypes) to enable skipping of empty granular buckets?
##########
processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/GroupByQueryEngine.java:
##########
@@ -391,7 +391,7 @@ public boolean hasNext()
if (delegate != null && delegate.hasNext()) {
return true;
} else {
- if (!cursor.isDone() && granularizer.currentOffsetWithinBucket()) {
+ if (granularizer.currentOffsetWithinBucket()) {
Review Comment:
was the `cursor.isDone()` here removed simply because it's redundant?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]