kgyrtkirk commented on code in PR #15402:
URL: https://github.com/apache/druid/pull/15402#discussion_r1399740823
##########
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:
not sure about the case you were thinking - but I'm afraid that check might
not be that usefull for these cases; consider the following:
* lets have
* a `results` with `{1 dim}+{1 aggs}+{1 postagg} = 3`
* a `resultRow` with `{1 dim}+{1 aggs}+{2 postagg} = 4` (for whatever
reason ?)
* since in these cases the system is already facing a serious error - I'm
not sure what value a nicer error message will give - as such error could not
be fixed easily for sure
* I think a more reasonable check would be to ensure that `results.size() ==
resultRow.size()` - so that we can remove the checking of all these iterators -
as they are trying to do the same in a more complicated way
I've added an `if` to throw an exception in case there are no next when
there should be one; but all these conditionals are kinda redundant as the
iterator was created for a list
--
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]