Acfboy commented on PR #20086:
URL: https://github.com/apache/datafusion/pull/20086#issuecomment-3875342974

   > This way, operators and UDFs could share a consistent interface and reuse 
utilities like signature checking and user-friendly error messages. I think 
this approach is feasible, though I may be underestimating the difficulty since 
I haven’t worked extensively in these modules; I believe @Jefffrey has a deeper 
understanding here.
   
   After digging deeper, I think since we focus solely on improving signature 
checking and error message handling, it doesn't seem to necessitate introducing 
the UDF framework; what we really need are function signatures.
   
   The existing method for obtaining operator signatures relies on complex 
conditional logic or even directly calling Arrow computations to see if they 
error out. This is quite different from how functions are handled, and in this 
situation, manually specifying signatures requires a lot of work, and would 
likely lead to inconsistencies as the code evolves.
   
   I’m wondering if a 'probing' approach might be more suitable for error 
hints. For example, if a user provides Int32 + Utf8, when an error occurs, we 
could first test Int32 + x across various types of x to see if it succeeds, 
then try x + Utf8, and finally offer suggestions for candidate function 
signatures. Of course, the actual implementation would need to account for 
trying similar types first, the possibility that fixing one operand might still 
not yield a valid suggestion, and cases like subtraction where the order of 
operands matters. @Jefffrey, I’d love to hear your thoughts on this approach. I 
will try to provide a POC.
   


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