-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Simplify wait_complete function #19937
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
Open
LiaCastaneda
wants to merge
5
commits into
apache:main
Choose a base branch
from
LiaCastaneda:lia/return-wait-complete-to-old-signature
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+10
−17
Open
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9cff05d
simplify wait_complete function
LiaCastaneda 022da64
Add comment on usage
LiaCastaneda f556fd7
Add comment on usage in wait_update as well
LiaCastaneda fd12f0f
Remove comment
LiaCastaneda abc077a
Add comment on error
LiaCastaneda 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 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
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
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 think there's a bit of nuance here. This is not because of the
DynamicFilterPhysicalExprAPI itself, it's only because of howHashJoinExecis implemented.Under normal operation it would be a consumer calling
wait_completeand hence it knows that a consumer exists because it is a consumer. In other words, under normal operationwait_completedis only called by consumers and thusis_usedwould always be true.Or put another way, the only way this could go wrong is e.g. in a test or if
HashJoinExecitself calledwait_complete. By definition if more than 1 thing has a reference to the dynamic filter, there is a consumer. If there is only 1 reference, it must be the oneHashJoinExechas (outside of tests). So it would have to beHashJoinExecthat is callingwait_complete()right?So the scenario described here seems more like a programming error or misuse of the APIs, not something that could happen under normal operation of a bug free usage of these APIs, right? In other words: if I was implementing this I could probably put the
is_used()check behind#[cfg(debug_assertions)]or something to catch a programming error on my end, but it wouldn't really make sense to have that check at runtime in production, right?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 agree -- when I implemented this API, I had in mind that it would be used mainly in custom probe nodes of a
HashJoinExec, so yes, ideallywait_completeis always called by consumers (in those cases it's impossible forwait_completeto wait indefinitely).However, I remember when I added
is_usedinHashJoinExec::execute(), I saw in the tests we were waiting indefinitely (but this was mainly because before,is_usedonly checked the inner struct, which is not the case anymore), which is why I then addedis_usedinsidewait_complete.I included this note mainly thinking about a scenario where some third-party node has a reference to the DynamicFilter of the HashJoin but doesn't know if it has a consumer or not. However, in that case, the third-party node would hold a reference and
is_usedwould return true, then filters would be computed andwait_completewould return successfully.So yes, if this happens, it would be a programming error. I will remove the comment.
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.
Or just make it clear that this scenario would only result from a programming error 😄