diff --git a/processing/src/main/java/io/druid/query/topn/PooledTopNAlgorithm.java b/processing/src/main/java/io/druid/query/topn/PooledTopNAlgorithm.java index 3a5af0a9146..392026818dc 100644 --- a/processing/src/main/java/io/druid/query/topn/PooledTopNAlgorithm.java +++ b/processing/src/main/java/io/druid/query/topn/PooledTopNAlgorithm.java @@ -165,8 +165,8 @@ public class PooledTopNAlgorithm } final int nAggregators = theAggregators.length; - final int extra = nAggregators - (nAggregators % 4) - 1; - final int ub = (nAggregators / 4) * 4; + final int extra = nAggregators - nAggregators % 4; + final int ub = ((nAggregators / 4) * 4) - 1; while (!cursor.isDone()) { final IndexedInts dimValues = dimSelector.getRow();