feat: improve LiteralGuarantee for the case like (a=1 AND b=1) OR (a=2 AND b=3)#16762
Merged
alamb merged 8 commits intoapache:mainfrom Jul 23, 2025
Merged
feat: improve LiteralGuarantee for the case like (a=1 AND b=1) OR (a=2 AND b=3)#16762alamb merged 8 commits intoapache:mainfrom
(a=1 AND b=1) OR (a=2 AND b=3)#16762alamb merged 8 commits intoapache:mainfrom
Conversation
Contributor
Author
(a=1 AND b=1) OR (a=2 AND b=3)(a=1 AND b=1) OR (a=2 AND b=3)
alamb
reviewed
Jul 14, 2025
Contributor
alamb
left a comment
There was a problem hiding this comment.
Thanks @haohuaijin -- this looks like a great start to me
I think we need a few more tests to show it doesn't incorrectly pick up literal guarantees for NOT IN / != terms, but otherwise I think it is good
Contributor
Author
Contributor
|
I am sorry @haohuaijin -- I will review this more carefully soon. I just need to sit down and think through the details to make sure it doesn't have any correctness problems |
alamb
approved these changes
Jul 21, 2025
Contributor
alamb
left a comment
There was a problem hiding this comment.
Thank you @haohuaijin -- I reviewed the code and tests carefully and I think this PR looks good to me.
It is a very nice improvement
Contributor
Author
|
Thanks for you reviews @alamb |
adriangb
pushed a commit
to pydantic/datafusion
that referenced
this pull request
Jul 28, 2025
…=2 AND b=3)` (apache#16762) * feat: imporve LiteralGuarantee for the case like (a=1 AND b=1) OR (a=2 AND b=3) * support inlist * fmt and clippy --------- 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
improve LiteralGuarantee to handle the case like
(a=1 AND b=1) OR (a=2 AND b=3)or(a IN ("foo", "bar") AND b = 5) OR (a IN ("bar") AND b=6)What changes are included in this PR?
add the logical to extract
(a=1 AND b=1) OR (a=2 AND b=3)toin_guarantee("a", [1, 2]), in_guarantee("b", [1, 3]);find_common_columnsfunction that identifies columns present in all termsetsAre these changes tested?
yes, add some test case
Are there any user-facing changes?