Skip to content

Commit dff5d97

Browse files
Ian LaiCheng-Yuan-Lai
Ian Lai
authored and
Cheng-Yuan-Lai
committed
add more diagnostic note
1 parent 5a705d9 commit dff5d97

File tree

1 file changed

+12
-1
lines changed
  • datafusion/common/src/utils

1 file changed

+12
-1
lines changed

datafusion/common/src/utils/mod.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1005,13 +1005,24 @@ pub fn take_function_args_with_diag<const N: usize, T>(
10051005
v.len()
10061006
);
10071007

1008-
let diagnostic = Diagnostic::new_error(
1008+
let mut diagnostic = Diagnostic::new_error(
10091009
format!(
10101010
"Wrong number of arguments for {} function call",
10111011
function_name
10121012
),
10131013
function_call_site,
10141014
);
1015+
diagnostic.add_note(
1016+
format!(
1017+
"Function {} takes exactly {} {}, but {} were provided",
1018+
function_name,
1019+
N,
1020+
if N == 1 { "argument" } else { "arguments" },
1021+
v.len(),
1022+
),
1023+
None,
1024+
);
1025+
10151026
base_error.with_diagnostic(diagnostic)
10161027
})
10171028
}

0 commit comments

Comments
 (0)