LakshSingla commented on code in PR #15402:
URL: https://github.com/apache/druid/pull/15402#discussion_r1399713009


##########
processing/src/main/java/org/apache/druid/query/groupby/GroupByQueryQueryToolChest.java:
##########
@@ -651,9 +650,7 @@ public ResultRow apply(Object input)
             );
 
             if (isResultLevelCache) {
-              Iterator<PostAggregator> postItr = 
query.getPostAggregatorSpecs().iterator();
-              int postPos = 0;
-              while (postItr.hasNext() && results.hasNext()) {
+              for (int postPos = 0; postPos < 
query.getPostAggregatorSpecs().size(); postPos++) {
                 resultRow.set(postAggregatorStart + postPos, results.next());
               }

Review Comment:
   I was also going through this area for a different purpose, and indeed 
there's a check below this code that checks if both the iterators have been 
exhausted completely, so even with the above check, the code would fail below. 
However, the error message would be more descriptive, so I think we should add 
the check back (otherwise it would fail with a generic `NoSuchElementException` 
exception)



-- 
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]

Reply via email to