Is your feature request related to a problem or challenge?
As part of consolidating ScalarUDFs in #10098, @Omega359 and @haohuaijin noted that there is still a special case for coalesce. Specifically, #10098 (comment)_
Describe the solution you'd like
Adding the new API `is_short_circuits()`(default to false, when need set to true) to `ScalarUDF` and `ScalarUDFImpl` might be a good way to do this because users may want to define their own short-circuit functions.
So that would me add a function to ScalarUDFImpl like the following (and remove the check for "coalsce" in the code)
trait ScalarUDFImpl {
..
/// Returns true if some of this `exprs` subexpressions may not be evaluated
/// and thus any side effects (like divide by zero) may not be encountered
/// Setting this to true prevents certain optimizations such as common subexpression elimination
fn short_circuits() -> bool {
false
}
Then return true in the implementation of Coalsce
Originally posted by @haohuaijin in #10098 (comment)