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

Support "IS [NOT] UNKNOWN" syntax #3195

Closed
sarahyurick opened this issue Aug 18, 2022 · 4 comments · Fixed by #3246
Closed

Support "IS [NOT] UNKNOWN" syntax #3195

sarahyurick opened this issue Aug 18, 2022 · 4 comments · Fixed by #3246
Labels
enhancement New feature or request

Comments

@sarahyurick
Copy link
Contributor

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
Similar to the issues regarding "IS NOT TRUE/FALSE" (#2265) and "IS TRUE/FALSE" (#3159), we should also support the "IS [NOT] UNKNOWN" boolean operator as well. Here is the Postgres documentation about how it works: https://www.postgresql.org/docs/current/functions-comparison.html

Describe the solution you'd like
This should be possible now that sqlparser-rs/sqlparser-rs#583 has been merged. I believe the implementation should be similar to the one in #3189

Describe alternatives you've considered
None.

Additional context
None.

@isidentical
Copy link
Contributor

@sarahyurick are you currently working on this (or interested in it) (was wondering whether I can pick it up as my first contribution)?

Also quick question (to both you and @andygrove), I was briefly looking into the implementation of IS UNKNOWN and noticed that Arrow doesn't have a one-to-one mapping of unknown type. Does that mean IS UNKNOWN is going to check whether the value is null or not (like is null)?

@sarahyurick
Copy link
Contributor Author

sarahyurick commented Aug 19, 2022

@sarahyurick are you currently working on this (or interested in it) (was wondering whether I can pick it up as my first contribution)?

Sure, go for it! Feel free to tag me when you open the PR, too.

Also quick question (to both you and @andygrove), I was briefly looking into the implementation of IS UNKNOWN and noticed that Arrow doesn't have a one-to-one mapping of unknown type. Does that mean IS UNKNOWN is going to check whether the value is null or not (like is null)?

From what I understand, IS UNKNOWN should only work on boolean and null types (as opposed to IS NULL which works on all types). This would be consistent with the Postgres documentation.

In my current PR #3189, IS TRUE/FALSE only works on boolean and null types as well. My guess is that you can do pretty much the exact same implementation, and then in common/src/scalar.rs make is_unknown and/or is_not_unknown functions that are like the existing is_null function, except they only allow 2 types and error for all other types.

@isidentical
Copy link
Contributor

Thanks a lot for your answer @sarahyurick! Really happy to work on it (I'll probably wait for #3189 to be merged first to send the PR, so we can reduce the number of conflicts).

@sarahyurick
Copy link
Contributor Author

Sounds good to me - I'll also be opening a PR for #2265 after #3189 merges, so hopefully with both of our contributions we can get all of the boolean operations working!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants