Fix summary row issues in case postaggregations are happening#15232
Merged
soumyava merged 11 commits intoapache:masterfrom Oct 25, 2023
Merged
Fix summary row issues in case postaggregations are happening#15232soumyava merged 11 commits intoapache:masterfrom
soumyava merged 11 commits intoapache:masterfrom
Conversation
abhishekagarwal87
approved these changes
Oct 23, 2023
clintropolis
approved these changes
Oct 23, 2023
| for (int i = 0; i < aggSpec.size(); i++) { | ||
| values[i] = aggSpec.get(i).factorize(new AllNullColumnSelectorFactory()).get(); | ||
| resultRow.set(i, aggSpec.get(i).factorize(new AllNullColumnSelectorFactory()).get()); | ||
| } |
Member
There was a problem hiding this comment.
oh, I think you need to actually compute the postaggs... which is why the test is failing in default value mode, see mergeResults for an example, something like
private static Iterator<ResultRow> summaryRowIterator(GroupByQuery q)
{
List<AggregatorFactory> aggSpec = q.getAggregatorSpecs();
ResultRow resultRow = ResultRow.create(q.getResultRowSizeWithPostAggregators());
for (int i = 0; i < aggSpec.size(); i++) {
resultRow.set(i, aggSpec.get(i).factorize(new AllNullColumnSelectorFactory()).get());
}
Map<String, Object> map = resultRow.toMap(q);
for (int i = 0; i < q.getPostAggregatorSpecs().size(); i++) {
final PostAggregator postAggregator = q.getPostAggregatorSpecs().get(i);
final Object value = postAggregator.compute(map);
resultRow.set(q.getResultRowPostAggregatorStart() + i, value);
map.put(postAggregator.getName(), value);
}
return Collections.singleton(resultRow).iterator();
}
makes the test pass in both modes for me
Member
Author
There was a problem hiding this comment.
thank you @clintropolis for taking a look and for the suggested fix :)
LakshSingla
added a commit
to LakshSingla/druid
that referenced
this pull request
Oct 25, 2023
CaseyPan
pushed a commit
to CaseyPan/druid
that referenced
this pull request
Nov 17, 2023
…#15232) * fix-1/2 * add message v1 * extend test to cover for IOB issue * move stuff around * change message * fix testcase string * compute postaggs (thank you Clint!) * enable feature for test * ignore tests in msq --------- Co-authored-by: Soumyava Das <soumyava@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
after the summary row fixes of Count distinct returned incorrect results without useApproximateCountDistinct #14748 ; queries which were computing a postaggregate-s in an empty summary row have encountered AIOOBE-s; because the post aggregation columns were not allocated correctly.
In case the table has no negative values for
m1; the following query could produce such an exception: