-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
-
(negation) with NULL literals does not work: can't be evaluated because the expression's type is Utf8, not signed
#1192
Comments
-
(negation) with NULL literals does not work-
(negation) with NULL literals does not work: can't be evaluated because the expression's type is Utf8, not signed
@alamb plz assign to me, thank you. |
I tested postgres=# select -null;
ERROR: operator is not unique: - unknown
LINE 1: select -null;
^
HINT: Could not choose a best candidate operator. You might need to add explicit type casts. Do you need this syntax in iox? @alamb |
@xudong963 Thanks for the test! I agree we can discuss more on it. |
We do not need this syntax in IOx (and if we do I can always add it at that time) |
@alamb @xudong963 Maybe we can introduce this syntax, and keep the contract that operators comes out result |
It's better to make it consistent with PG in SQL dialect. |
I feel free to close the pr #2249 since more conservative opinions of introducing |
I think this issue can be closed. |
🤔 I just tried the query again, and it now gives a different error: ❯ select -null;
Internal("(- 'Literal { value: NULL }') can't be evaluated because the expression's type is Null, not signed numeric") I think we are getting closer... |
I bet this is a fairly straightforward matter of adding a case in the evaluation kernels |
It is indeed an additional condition in expressions/negative.rs. Here is the PR #3771. |
Reproducer:
The correct output is
null
I think the solution will likely be to teach
Expr::Negative
about type coercion (as is done inBinaryExpr
and function calls) once coercion knows about the null type (and that it can be cast to any other type). See #1184 for more detailsThe text was updated successfully, but these errors were encountered: