Repository navigation
Conversation
|
|
||
| fn simplify(expr: &Expr) -> Expr { | ||
| match expr { | ||
| Expr::BinaryExpr { left, .. } if is_literal_null(left) => *left.clone(), |
There was a problem hiding this comment.
Thank you @jimexist
I don't think this is true for Operator::IsDistinctFrom and Operator::IsNotDistinctFrom , Operator::And and Operator::Or, so I think we should special case those Operators
Or perhaps to be more conservative make a whitelist of the arithmetic operators.
examples
null IS DISTINCT FROM null --> false (but this PR would rewrite to null I think)
true OR null --> true (but this PR would rewrite it to null I think)
| let expr = | ||
| binary_expr(lit(ScalarValue::Boolean(None)), Operator::And, lit(false)); | ||
| let expr_eq = lit(false); | ||
| let expr_eq = null; |
There was a problem hiding this comment.
I think the original answer of false is correct. Here is the result in postgres:
alamb=# select null and false;
?column?
----------
f
(1 row)
alamb=#
483f8f4 to
c2559ea
Compare
|
I am trying to clean up the list of PRs to review in DataFusion so marking old ones as stale. Please let us know if you plan to work on this soon. Otherwise we will close it down and reopen it when the time is right. |
|
Closing stale PRs, please reopen if this was a mistake and you plan to keep working on this one |
Which issue does this PR close?
Closes #.
Rationale for this change
binary expression should simplify when either operant is null
What changes are included in this PR?
Are there any user-facing changes?