alamb commented on code in PR #26164:
URL: https://github.com/apache/datafusion/pull/26164#discussion_r4234123283


##########
datafusion/expr/src/expr_schema.rs:
##########
@@ -435,6 +435,24 @@ impl ExprSchemable for Expr {
             Expr::ScalarSubquery(subquery) => 
Ok(scalar_subquery_nullable(subquery)),
             Expr::BinaryExpr(BinaryExpr { left, right, op }) => match op {
                 Operator::IsDistinctFrom | Operator::IsNotDistinctFrom => 
Ok(false),
+                Operator::And => {
+                    if contains_is_not_null(left.as_ref(), right.as_ref()) {

Review Comment:
   Maybe we can add some more comments explaining why we need to explicitly 
check IS NOT NULL
   
   ALso, the example you gave above is only valid when the argument (`x`) is on 
both sides
   
   `x IS NOT NULL AND x` 
   
   However it doesn't hold for:
   
   `y IS NOT NULL and x` (different arguments). 
   
   This seems very similar to something @pepijnve  hit a while ago with Case 
nullability  -- specifically that the after simplification the nullability can 
sometimes be smarter than before the simplification. 
   
   I am still missing why we need to make the nullability check smarter (why 
isn't leaving it as `nullable` ok, even if overly conservative)?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to