chenkovsky commented on code in PR #17220:
URL: https://github.com/apache/datafusion/pull/17220#discussion_r2297727202


##########
datafusion/expr/src/udf.rs:
##########
@@ -714,6 +774,58 @@ pub trait ScalarUDFImpl: Debug + DynEq + DynHash + Send + 
Sync {
     fn documentation(&self) -> Option<&Documentation> {
         None
     }
+
+    /// Attempts to optimize or transform the function call.
+    ///
+    /// This method allows UDF implementations to provide optimized versions
+    /// of function calls or transform them into different expressions.
+    /// Returns `None` if no optimization is available.
+    ///
+    /// # Arguments
+    /// * `_args` - The function arguments to potentially optimize
+    ///
+    /// # Returns
+    /// An optional optimized expression, or None if no optimization is 
available
+    fn try_call(&self, _args: &[Expr]) -> Result<Option<Expr>> {

Review Comment:
   it's same as simplify, except invoking timing. I tried simplify before, but 
an error is thrown, because simplify is called in optimize stage. but we need 
this function to be called at the very beginning. maybe we can reuse simplify, 
but I'm not sure whether this will break other functions.



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to