From 399415c229c66c87f8e4e81825c4eb45bb00b88b Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Sun, 22 Dec 2024 10:50:09 -0500 Subject: [PATCH] fix fmt --- .../expr/src/type_coercion/functions.rs | 50 ++++++++----------- 1 file changed, 21 insertions(+), 29 deletions(-) diff --git a/datafusion/expr/src/type_coercion/functions.rs b/datafusion/expr/src/type_coercion/functions.rs index 0424151a7cca..38e7106e6e64 100644 --- a/datafusion/expr/src/type_coercion/functions.rs +++ b/datafusion/expr/src/type_coercion/functions.rs @@ -55,18 +55,16 @@ pub fn data_types_with_scalar_udf( if current_types.is_empty() { if type_signature.supports_zero_argument() { return Ok(vec![]); + } else if type_signature.used_to_support_zero_arguments() { + // Special error to help during upgrade: https://github.com/apache/datafusion/issues/13763 + return plan_err!("{} does not support zero arguments. Use TypeSignature::Nullary for zero arguments.", func.name()); } else { - if type_signature.used_to_support_zero_arguments() { - // Special error to help during upgrade: https://github.com/apache/datafusion/issues/13763 - return plan_err!("{} does not support zero arguments. Use TypeSignature::Nullary for zero arguments.", func.name()); - } else { - return plan_err!("{} does not support zero arguments.", func.name()); - } + return plan_err!("{} does not support zero arguments.", func.name()); } } let valid_types = - get_valid_types_with_scalar_udf(&type_signature, current_types, func)?; + get_valid_types_with_scalar_udf(type_signature, current_types, func)?; if valid_types .iter() @@ -95,13 +93,11 @@ pub fn data_types_with_aggregate_udf( if current_types.is_empty() { if type_signature.supports_zero_argument() { return Ok(vec![]); + } else if type_signature.used_to_support_zero_arguments() { + // Special error to help during upgrade: https://github.com/apache/datafusion/issues/13763 + return plan_err!("{} does not support zero arguments. Use TypeSignature::Nullary for zero arguments.", func.name()); } else { - if type_signature.used_to_support_zero_arguments() { - // Special error to help during upgrade: https://github.com/apache/datafusion/issues/13763 - return plan_err!("{} does not support zero arguments. Use TypeSignature::Nullary for zero arguments.", func.name()); - } else { - return plan_err!("{} does not support zero arguments.", func.name()); - } + return plan_err!("{} does not support zero arguments.", func.name()); } } @@ -134,13 +130,11 @@ pub fn data_types_with_window_udf( if current_types.is_empty() { if type_signature.supports_zero_argument() { return Ok(vec![]); + } else if type_signature.used_to_support_zero_arguments() { + // Special error to help during upgrade: https://github.com/apache/datafusion/issues/13763 + return plan_err!("{} does not support zero arguments. Use TypeSignature::Nullary for zero arguments.", func.name()); } else { - if type_signature.used_to_support_zero_arguments() { - // Special error to help during upgrade: https://github.com/apache/datafusion/issues/13763 - return plan_err!("{} does not support zero arguments. Use TypeSignature::Nullary for zero arguments.", func.name()); - } else { - return plan_err!("{} does not support zero arguments.", func.name()); - } + return plan_err!("{} does not support zero arguments.", func.name()); } } @@ -173,19 +167,17 @@ pub fn data_types( if current_types.is_empty() { if type_signature.supports_zero_argument() { return Ok(vec![]); - } else { - if type_signature.used_to_support_zero_arguments() { - // Special error to help during upgrade: https://github.com/apache/datafusion/issues/13763 - return plan_err!( + } else if type_signature.used_to_support_zero_arguments() { + // Special error to help during upgrade: https://github.com/apache/datafusion/issues/13763 + return plan_err!( "signature {:?} does not support zero arguments. Use TypeSignature::Nullary for zero arguments.", type_signature ); - } else { - return plan_err!( - "signature {:?} does not support zero arguments.", - type_signature - ); - } + } else { + return plan_err!( + "signature {:?} does not support zero arguments.", + type_signature + ); } }