-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix resultcache multiple postaggregation restore #15402
Merged
abhishekagarwal87
merged 5 commits into
apache:master
from
kgyrtkirk:resultcache-fix-postagg-restore
Nov 21, 2023
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if this can happen but to be on the safe side?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the contract around here should be to restore the same row that it have saved into the cache - if its not able to do so; I think it should fail with an exception - if it doesn't do that wouldn't that cause incorrect results - or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
exceptionThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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:
results
with{1 dim}+{1 aggs}+{1 postagg} = 3
resultRow
with{1 dim}+{1 aggs}+{2 postagg} = 4
(for whatever reason ?)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 wayI'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 listThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/apache/druid/blob/master/processing/src/main/java/org/apache/druid/query/groupby/GroupByQueryQueryToolChest.java#L660
I was referring to this check. It should also handle the case that you mentioned above right? Perhaps adding the size check that you mentioned earlier is more legible. I am okay with the code either way.