Skip to content

Return boolean literal when simplifying AND and OR filters#3356

Merged
angelamayxie merged 4 commits intomainfrom
angela/filter_opt
Dec 26, 2025
Merged

Return boolean literal when simplifying AND and OR filters#3356
angelamayxie merged 4 commits intomainfrom
angela/filter_opt

Conversation

@angelamayxie
Copy link
Copy Markdown
Contributor

@angelamayxie angelamayxie commented Dec 26, 2025

fixes dolthub/dolt#10243

Previously, if one of the children of an AND or OR expression was a literal that evaluated to false or true (respectively), we would return the child. However, this caused a typing issue since AND and OR are booleans while its children can be of any type. Take the expression 19 or 's' for example; the left child 19 evaluates to true, making the expression true every time, but returning the left child 19 as a simplification would be incorrect since we would want the expression to simplify to a boolean true, not the number 19.

Now, instead of returning the child that determines the result of an AND or OR expression, we return the boolean value that the expression results to.

@angelamayxie angelamayxie requested a review from jycor December 26, 2025 19:36
@angelamayxie angelamayxie marked this pull request as ready for review December 26, 2025 19:45
Copy link
Copy Markdown
Contributor

@jycor jycor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@angelamayxie angelamayxie merged commit 1ab46ba into main Dec 26, 2025
8 checks passed
@angelamayxie angelamayxie deleted the angela/filter_opt branch December 26, 2025 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unexpected Anti Join Result

2 participants