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

Internal error when negating strings #9060

Closed
alamb opened this issue Jan 29, 2024 · 5 comments · Fixed by #9066
Closed

Internal error when negating strings #9060

alamb opened this issue Jan 29, 2024 · 5 comments · Fixed by #9066
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@alamb
Copy link
Contributor

alamb commented Jan 29, 2024

Describe the bug

Negating an string results in an internal error

To Reproduce

select -'100';
Internal error: Can't create negative physical expr for (- 'Literal { value: Utf8("100") }'), the type of child expr is Utf8, not signed numeric.
This was likely caused by a bug in DataFusion's code and we would welcome that you file an bug report in our issue tracker

However, if the explicit cast is added things work great:

select -'100'::int;
+-----------------+
| (- Utf8("100")) |
+-----------------+
| -100            |

Expected behavior

The query should probably an error that says something like negate only supports numeric types

Related PR: #8982 can be applied here too

Additional context

No response

@alamb alamb added the bug Something isn't working label Jan 29, 2024
@alamb alamb added the good first issue Good for newcomers label Jan 29, 2024
@alamb
Copy link
Contributor Author

alamb commented Jan 29, 2024

I think this would be a reasonable first issue that would teach someone about the datafusion codebase

@yyy1000
Copy link
Contributor

yyy1000 commented Jan 29, 2024

Can I help it ? (Or left it as an issue for a new comer) 😃

@alamb
Copy link
Contributor Author

alamb commented Jan 29, 2024

Can I help it ? (Or left it as an issue for a new comer) 😃

how about we wait a day or two to see if anyone else is interested ?

Thank you !

@yyy1000
Copy link
Contributor

yyy1000 commented Jan 29, 2024

Can I help it ? (Or left it as an issue for a new comer) 😃

how about we wait a day or two to see if anyone else is interested ?

Thank you !

🤣That's OK.
I can try to help other old issues now.😆

@trungda
Copy link
Contributor

trungda commented Jan 30, 2024

I took the liberty and submitted a PR :) Thanks @yyy1000 and @alamb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants