Coerce and simplify FixedSizeBinary equality to literal binary#15726
Merged
jayzhan211 merged 6 commits intoapache:mainfrom Apr 18, 2025
Merged
Conversation
c56e280 to
c72a478
Compare
Contributor
Author
|
I now realize I the |
Contributor
Author
|
cc @jayzhan211, could I ask you for a review? |
alamb
approved these changes
Apr 17, 2025
Contributor
alamb
left a comment
There was a problem hiding this comment.
Looks good -- thank you @leoyvens and @jayzhan211
I pushed one more slt test that verifies the cast is removed via an EXPLAIN. This is a very nice improvement I think
alamb
reviewed
Apr 17, 2025
| } | ||
| (Binary, Utf8) | (Utf8, Binary) => Some(Binary), | ||
|
|
||
| // Cast FixedSizeBinary to Binary |
Contributor
There was a problem hiding this comment.
As a follow on PR it might be good to also support BinaryView as well
Contributor
nirnayroy
pushed a commit
to nirnayroy/datafusion
that referenced
this pull request
May 2, 2025
…e#15726) * coerce FixedSizeBinary to Binary * simplify FixedSizeBytes equality to literal * fix clippy * remove redundant ExprSimplifier case * Add explain test to make sure unwrapping is working correctly --------- Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
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.
Which issue does this PR close?
Rationale for this change
See #15686 (comment).
What changes are included in this PR?
The two initial commits have two sequential changes:
FixedSizeBinarytoBinarywhen necessary, as we already do for lists.ExprSimplifierto optimize away the coercion cast when comparing to a literal.Are these changes tested?
There is an
.slttest. An existing one that previously failed to coerce will now evaluate the comparison.Are there any user-facing changes?
No, this should be very transparent.