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() with NULL literals does not work: can't be evaluated because the expression's type is Utf8, not boolean #1191

Closed
Tracked by #1184
alamb opened this issue Oct 28, 2021 · 2 comments · Fixed by #2144
Assignees
Labels
bug Something isn't working datafusion Changes in the datafusion crate

Comments

@alamb
Copy link
Contributor

alamb commented Oct 28, 2021

Reproducer:

> select not null;
Internal("NOT 'Literal { value: Utf8(NULL) }' can't be evaluated because the expression's type is Utf8, not boolean")

> select not(null);
Internal("NOT 'Literal { value: Utf8(NULL) }' can't be evaluated because the expression's type is Utf8, not boolean")

The correct output is null

I think the solution will likely be to teach Expr::Not about type coercion (as is done in BinaryExpr and function calls) once coercion knows about the null type (and that it can be cast to any other type). See #1184 for more details

@alamb alamb changed the title not() with NULL literals does not work not() with NULL literals does not work: can't be evaluated because the expression's type is Utf8, not boolean Oct 28, 2021
@alamb alamb added datafusion Changes in the datafusion crate bug Something isn't working labels Oct 28, 2021
@WinkerDu
Copy link
Contributor

WinkerDu commented Apr 3, 2022

@alamb plz assign this issue to me, thank you.

@WinkerDu
Copy link
Contributor

WinkerDu commented Apr 3, 2022

A raw fix here: #2144

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working datafusion Changes in the datafusion crate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants