-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Spaceship operator (<=>) not supported #14098
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
Comments
It looks to me like the I also double checked that sqlparser already supports spaceship: https://docs.rs/sqlparser/latest/sqlparser/ast/enum.BinaryOperator.html#variant.Spaceship Thus, implementing this feature would be a relatively simple matter
|
Planning support might be as simple as adding the appropriate translation here:
|
@alamb thanks for the pointers! I will take a look over the weekend to add this :D |
@ion-elgreco @alamb if it is fine by you, can I work on this? I am just getting familiar with the codebase with a few commits here and there :D |
@Spaarsh go ahead! :) |
Apologies for the delay! @ion-elgreco is this the output you are expecting? If so, I shall make a PR including some tests as well! |
Yess, you could add also a sanity test: format!("{Value1} = {value2} OR (value1} IS NULL AND {value2} IS NULL)"), |
@ion-elgreco sure! I am still trying to figure how tests are written but as soon as I figure that out, I'll include your suggestion! |
I think this document describes how to write tests pretty well: https://github.com/apache/datafusion/blob/main/datafusion/sqllogictest/README.md Thanks @Spaarsh |
@ion-elgreco based on your suggestion, I added a sanity test as well. It is as follows:
My previous sanity test was:
But it failed in the last two cases since the right-hand side of the queries reduced to: Hence, in order to address this, the test needed to be changed. Please correct me if this is problematic! |
@Spaarsh actually I missed the null propagation part ; ) So I would discard my suggestion |
@ion-elgreco no issues. Should I discard the sanity test then? It does work logically. If both are NULL values, they both are assigned the false value, returning a true value. If neither value is NULL, it works as a normal equal to sign. If either of them is NULL, a number is checked for equality against false, returning a false value. |
Is your feature request related to a problem or challenge?
I am trying to add support for Generated Columns in Delta-rs. For this to be functional, we need the spaceship operator to be implemented in datafusion SQL. Currently it's not supported as we can see here:
Describe the solution you'd like
Add support for parsing <=> if it exists in a sql statement.
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: