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 a18e34516d1..f89c79f2507 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();