From 006f9369d100823477ba7232ef9087bf71aad086 Mon Sep 17 00:00:00 2001 From: Jeffrey Smith II Date: Fri, 14 Jun 2024 10:50:58 -0400 Subject: [PATCH] chore: update some error messages for clarity --- datafusion/expr/src/expr_schema.rs | 6 +++--- datafusion/expr/src/type_coercion/functions.rs | 14 +++----------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/datafusion/expr/src/expr_schema.rs b/datafusion/expr/src/expr_schema.rs index 57470db2e0d9e..01989065f2111 100644 --- a/datafusion/expr/src/expr_schema.rs +++ b/datafusion/expr/src/expr_schema.rs @@ -141,7 +141,7 @@ impl ExprSchemable for Expr { // verify that function is invoked with correct number and type of arguments as defined in `TypeSignature` data_types_with_scalar_udf(&arg_data_types, func).map_err(|err| { plan_datafusion_err!( - "{} and {}", + "{} {}", err, utils::generate_signature_error_msg( func.name(), @@ -164,7 +164,7 @@ impl ExprSchemable for Expr { WindowFunctionDefinition::AggregateUDF(udf) => { let new_types = data_types_with_aggregate_udf(&data_types, udf).map_err(|err| { plan_datafusion_err!( - "{} and {}", + "{} {}", err, utils::generate_signature_error_msg( fun.name(), @@ -192,7 +192,7 @@ impl ExprSchemable for Expr { AggregateFunctionDefinition::UDF(fun) => { let new_types = data_types_with_aggregate_udf(&data_types, fun).map_err(|err| { plan_datafusion_err!( - "{} and {}", + "{} {}", err, utils::generate_signature_error_msg( fun.name(), diff --git a/datafusion/expr/src/type_coercion/functions.rs b/datafusion/expr/src/type_coercion/functions.rs index 4dd8d6371934f..5f060a4a4f16e 100644 --- a/datafusion/expr/src/type_coercion/functions.rs +++ b/datafusion/expr/src/type_coercion/functions.rs @@ -49,10 +49,7 @@ pub fn data_types_with_scalar_udf( if signature.type_signature.supports_zero_argument() { return Ok(vec![]); } else { - return plan_err!( - "[data_types_with_scalar_udf] signature {:?} does not support zero arguments.", - &signature.type_signature - ); + return plan_err!("{} does not support zero arguments.", func.name()); } } @@ -79,11 +76,7 @@ pub fn data_types_with_aggregate_udf( if signature.type_signature.supports_zero_argument() { return Ok(vec![]); } else { - return plan_err!( - "[data_types_with_aggregate_udf] Coercion from {:?} to the signature {:?} failed.", - current_types, - &signature.type_signature - ); + return plan_err!("{} does not support zero arguments.", func.name()); } } @@ -118,8 +111,7 @@ pub fn data_types( return Ok(vec![]); } else { return plan_err!( - "[data_types] Coercion from {:?} to the signature {:?} failed.", - current_types, + "signature {:?} does not support zero arguments.", &signature.type_signature ); }