brayanjuls commented on code in PR #8985:
URL: https://github.com/apache/arrow-datafusion/pull/8985#discussion_r1483794895


##########
datafusion/expr/src/udf.rs:
##########
@@ -249,6 +261,22 @@ pub trait ScalarUDFImpl: Debug + Send + Sync {
     /// the arguments
     fn return_type(&self, arg_types: &[DataType]) -> Result<DataType>;
 
+    /// What [`DataType`] will be returned by this function, given the types of
+    /// the expr arguments
+    fn return_type_from_exprs(
+        &self,
+        arg_exprs: &[Expr],
+        schema: &DFSchema,
+    ) -> Result<DataType> {

Review Comment:
   @yyy1000 the following changes worked for me. If anyone else have a better 
solution please suggest it. I am still a newbie in rust but trying to help to 
learn. 
   
   expr_schema.rs
   
   <img width="1414" alt="image" 
src="https://github.com/apache/arrow-datafusion/assets/7233005/04b03f96-4469-4858-a1f1-98d66701fd8b";>
   
   <img width="1414" alt="image" 
src="https://github.com/apache/arrow-datafusion/assets/7233005/62d7e6ed-5c0f-4bd3-b07d-81d12adcb1f9";>
   
   return_types_udf.rs
   
   <img width="1414" alt="image" 
src="https://github.com/apache/arrow-datafusion/assets/7233005/42ab80c7-fc3a-45d4-b4df-ef3843d0a08b";>
   
   



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

Reply via email to