jsai28 commented on issue #15276:
URL: https://github.com/apache/datafusion/issues/15276#issuecomment-2832788966

   @eliaperantoni No worries! I had some follow-ups.
   
   > I think it would be the diagnose function itself that creates an error, 
because otherwise there's none
   
   Isn't there already a DataFusion error if incorrect arguments are supplied 
to a UDF? 
[This](https://github.com/apache/datafusion/blob/19a1e58071cd60e74faabab805d97fd269418925/datafusion/expr/src/expr_schema.rs#L428)
 one. My understanding is that the `data_types_with_scalar_udf` function is 
called during the logical planning of a Scalar UDF and checks whether the right 
arguments were supplied (or whether they can be coerced). My thinking was that 
the diagnose trait function would be called when there is an error and supply 
more detailed diagnostic information. 
   
   Or is the `diagnose` trait function for errors that go beyond just incorrect 
function arguments and are more specific to the UDF? Maybe like a UDF that for 
example doesn't accept numbers larger than 50, then the `diagnose` function is 
where the implementor can produce that error and highlight the exact argument? 
If this is the case, then yes I agree with your other point that we should 
default to a standard error rather than have the implementor create their own 
`DataFusionError`. They should just return a `Vec<Diagnostic` which we can 
consume to make a `DataFusionError` for them, and attach the relevant 
diagnostics to 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: 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