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 all boolean operations #719

Conversation

sarahyurick
Copy link
Collaborator

@sarahyurick sarahyurick commented Aug 24, 2022

With the recent updates to DataFusion and minor Dask SQL changes, "IS TRUE/FALSE" and "IS [NOT] UNKNOWN" are functional.

"IS NOT TRUE" and "IS NOT FALSE" should be functional once apache/datafusion#3252 is merged.

UPDATE: As long as all checks pass, this should be ready to merge.

@codecov-commenter
Copy link

codecov-commenter commented Aug 24, 2022

Codecov Report

❗ No coverage uploaded for pull request base (datafusion-sql-planner@ae3a4ad). Click here to learn what that means.
The diff coverage is n/a.

@@                    Coverage Diff                    @@
##             datafusion-sql-planner     #719   +/-   ##
=========================================================
  Coverage                          ?   70.08%           
=========================================================
  Files                             ?       73           
  Lines                             ?     3624           
  Branches                          ?      747           
=========================================================
  Hits                              ?     2540           
  Misses                            ?      941           
  Partials                          ?      143           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@sarahyurick
Copy link
Collaborator Author

Closes #688 and #705

Comment on lines +107 to +109
except TypeError:
literal_type = SqlTypeName.NULL
literal_value = None
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of interest, what type error are we catching here?

@@ -625,7 +625,7 @@ impl PyExpr {
pub fn bool_value(&mut self) -> PyResult<bool> {
match &self.expr {
Expr::Literal(scalar_value) => match scalar_value {
ScalarValue::Boolean(iv) => Ok(iv.unwrap()),
ScalarValue::Boolean(Some(iv)) => Ok(*iv),
Copy link
Collaborator Author

@sarahyurick sarahyurick Aug 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@charlesbluca your question is related to the change here - originally, "IS UNKNOWN" would panic here when the value is null. The change here allows us to throw the type error on the next line.

Not sure if we can come up with a case where it wouldn't be Some(true), Some(false), or None

@sarahyurick
Copy link
Collaborator Author

Hi @charlesbluca @ayushdg @galipremsagar @jdye64 this is ready for review now

Copy link
Collaborator

@jdye64 jdye64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outside of suggestions already made by @charlesbluca the rest looks good to me, will go ahead and approve from my end

@jdye64 jdye64 merged commit d7d4363 into dask-contrib:datafusion-sql-planner Aug 26, 2022
@sarahyurick sarahyurick deleted the datafusion-boolean-operators branch September 21, 2022 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ENH] "IS [NOT] UNKNOWN" syntax [ENH] "IS TRUE/FALSE" and "IS NOT TRUE/FALSE" syntax
4 participants