neilconway commented on code in PR #24534:
URL: https://github.com/apache/datafusion/pull/24534#discussion_r3826696130


##########
datafusion/expr/src/expr_schema.rs:
##########
@@ -369,9 +369,8 @@ impl ExprSchemable for Expr {
 
                 Ok(expr_nullable | subquery_nullable)
             }
-            // A scalar subquery may return no rows, in which case it 
evaluates to NULL
-            // regardless of the nullability of its projected field.
-            Expr::ScalarSubquery(_) => Ok(true),
+            Expr::ScalarSubquery(subquery) => Ok(subquery.subquery.min_rows() 
== 0
+                || subquery.subquery.schema().field(0).is_nullable()),

Review Comment:
   I like it!



-- 
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