findepi commented on code in PR #14513:
URL: https://github.com/apache/datafusion/pull/14513#discussion_r1943355544
##########
datafusion/functions/src/core/nvl2.rs:
##########
@@ -104,27 +105,19 @@ impl ScalarUDFImpl for NVL2Func {
}
fn coerce_types(&self, arg_types: &[DataType]) -> Result<Vec<DataType>> {
- if arg_types.len() != 3 {
- return exec_err!(
- "NVL2 takes exactly three arguments, but got {}",
- arg_types.len()
- );
- }
- let new_type = arg_types.iter().skip(1).try_fold(
- arg_types.first().unwrap().clone(),
- |acc, x| {
- // The coerced types found by `comparison_coercion` are not
guaranteed to be
- // coercible for the arguments. `comparison_coercion` returns
more loose
- // types that can be coerced to both `acc` and `x` for
comparison purpose.
- // See `maybe_data_types` for the actual coercion.
- let coerced_type = comparison_coercion(&acc, x);
- if let Some(coerced_type) = coerced_type {
- Ok(coerced_type)
- } else {
- internal_err!("Coercion from {acc:?} to {x:?} failed.")
- }
- },
- )?;
+ let [a, b, c] = take_function_args(self.name(), arg_types)?;
Review Comment:
done!
--
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]