pepijnve commented on code in PR #18921:
URL: https://github.com/apache/datafusion/pull/18921#discussion_r3017194842


##########
datafusion/expr/src/expr_schema.rs:
##########
@@ -199,6 +203,13 @@ impl ExprSchemable for Expr {
                 // Grouping sets do not really have a type and do not appear 
in projections
                 Ok(DataType::Null)
             }
+            Expr::HigherOrderFunction(_func) => {
+                Ok(self.to_field(schema)?.1.data_type().clone())
+            }
+            Expr::Lambda(Lambda { params: _, body }) => body.get_type(schema),

Review Comment:
   Is it an issue that this is technically incorrect? The type of the lambda 
expression itself is actually a function type, where here it's presented as 
just its return type. Can this lead to incorrect type analysis?
   
   I haven't thought this through fully, but would it maybe be better to not 
have lambda functions be an `Expr`? Lambda functions don't really fit into the 
arrow type system. You would then have ot use an enum type that's either `Expr` 
or `Lambda` for the higher-order function parameters. Maybe that greatly 
complicates everything else?



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