Skip to content

Commit

Permalink
feat: attach Diagnostic to 'wrong number of arguments' error
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Lai authored and Ian Lai committed Feb 13, 2025
1 parent 3e6d70e commit ade724e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions datafusion/expr/src/type_coercion/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use datafusion_common::{
exec_err, internal_datafusion_err, internal_err, not_impl_err, plan_err,
types::{LogicalType, NativeType},
utils::list_ndims,
Result,
Diagnostic, Result, Span,
};
use datafusion_expr_common::{
signature::{
Expand Down Expand Up @@ -469,7 +469,15 @@ fn get_valid_types(
if length != expected_length {
return plan_err!(
"Function '{function_name}' expects {expected_length} arguments but received {length}"
);
).map_err(|err| {
err.with_diagnostic(
Diagnostic::new_error(
format!("Function '{function_name}' expects {expected_length} arguments but received {length}"),
Span::new(0, 0),

)
)
});
}
Ok(())
}
Expand Down

0 comments on commit ade724e

Please sign in to comment.