-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix: DynamicFilterPhysicalExpr violates Hash/Eq contract #19659
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
base: main
Are you sure you want to change the base?
Conversation
|
cc @adriangb |
|
Thanks for working on this. Were there any alternatives considered? I've thought about it a little bit and think this is probably the best path forward, but maybe there are other alternatives; it would be good to document why we chose this option. At least one would be to make |
|
Thanks for the feedback, I did some analysis before implementation to best of my understanding;
Current Implementation:
The panic approach is reasonable but would be a breaking change(I think). Happy to discuss further if you think the explicitness outweighs the compatibility benefit. |
|
Sound good to me. Could we look for any potential call sites and update them to use |
|
I wonder if we could somehow use |
adriangb
left a 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.
I'm approving because this seems like the best choice and is better than the status quo. I imagine there may be uses where a different behavior is desired, we've tried to think through them but can't pretend to have covered them all. For future readers: if a different behavior is required please comment on this PR or open a new issue.
|
(let's wait a day before merging this) |
|
I think we should include this in datafusion-52 so I added it to the list on |
Which issue does this PR close?
Rationale for this change
DynamicFilterPhysicalExprviolates theHash/Eqcontract because theHashandPartialEqimplementations each callself.current()which acquires separateRwLock::read()locks. This allows the underlying expression to change betweenhash()andeq()calls viaupdate(), causing:What changes are included in this PR?
Replaced content-based Hash/Eq with identity-based implementations:
Arc::as_ptr(&self.inner)instead of hashing the mutable expression contentArc::ptr_eq(&self.inner)instead of comparing expression content via locksAre these changes tested?
Yes
Are there any user-facing changes?