Skip to content
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

NOT operator not return internal error when args are not boolean value #8982

Merged
merged 4 commits into from
Jan 25, 2024

Conversation

guojidan
Copy link
Contributor

Which issue does this PR close?

Closes #8965.

Rationale for this change

What changes are included in this PR?

in TypeCoercionRewriter return an error if the argument to not can't be coerced to Boolean

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added physical-expr Physical Expressions optimizer Optimizer rules sqllogictest SQL Logic Tests (.slt) labels Jan 24, 2024
@guojidan guojidan marked this pull request as draft January 24, 2024 08:24
@guojidan guojidan marked this pull request as ready for review January 24, 2024 10:01
Copy link
Contributor

@haohuaijin haohuaijin left a comment

Choose a reason for hiding this comment

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

Thank you @guojidan look great to me! I think you can merge main to resolve the conflicts.

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

I agree with @haohuaijin -- very nice @guojidan . Thank you 🙏

I think this PR just needs to merge up from main and resolve the conflict and it will be good to go.

Thank you for the string of excellent PRs @guojidan

Expr::Not(expr) => {
let expr = not(get_casted_expr_for_bool_op(&expr, &self.schema)?);
Ok(expr)
}
Expr::IsTrue(expr) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

It might make sense to remove the catch all from this match expression

https://github.com/apache/arrow-datafusion/blob/bc0ba6a724aaaf312b770451718cbce696de6640/datafusion/optimizer/src/analyzer/type_coercion.rs#L413

And explicitly list out all Expr types so that we don't accidentally another Expr type in the future

Is that something you might be willing to do in another PR @guojidan ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i will do soon

@guojidan
Copy link
Contributor Author

cc @alamb need rerun test case, look like network error

@alamb
Copy link
Contributor

alamb commented Jan 24, 2024

cc @alamb need rerun test case, look like network error

restarted!

BTW another trick I think works is closing and the reopening the PR

@alamb alamb merged commit 4a3986a into apache:main Jan 25, 2024
22 checks passed
@alamb
Copy link
Contributor

alamb commented Jan 25, 2024

Thanks again @guojidan !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
optimizer Optimizer rules physical-expr Physical Expressions sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NOT operator should not return internal error when args are not boolean value
3 participants