diff --git a/datafusion/common/src/error.rs b/datafusion/common/src/error.rs index aee40fc7971e..240194d86819 100644 --- a/datafusion/common/src/error.rs +++ b/datafusion/common/src/error.rs @@ -446,7 +446,7 @@ macro_rules! make_error { }; } -// DataFusionError::Plan +// Exposes a macro to create `DataFusionError::Plan` make_error!(plan_err, Plan); #[cfg(test)] diff --git a/datafusion/expr/src/type_coercion/aggregates.rs b/datafusion/expr/src/type_coercion/aggregates.rs index fb93cb07cd09..f057aaba97c7 100644 --- a/datafusion/expr/src/type_coercion/aggregates.rs +++ b/datafusion/expr/src/type_coercion/aggregates.rs @@ -184,7 +184,7 @@ pub fn coerce_types( } AggregateFunction::Correlation => { if !is_correlation_support_arg_type(&input_types[0]) { - return Err(DataFusionError::Plan(format!( + return plan_err!( "The function {:?} does not support inputs of type {:?}.", agg_fun, input_types[0] @@ -197,7 +197,7 @@ pub fn coerce_types( let input_types_valid = // number of input already checked before valid_types.contains(&input_types[0]) && valid_types.contains(&input_types[1]); if !input_types_valid { - return Err(DataFusionError::Plan(format!( + return plan_err!( "The function {:?} does not support inputs of type {:?}.", agg_fun, input_types[0]