Chen-Yuan-Lai commented on issue #14432:
URL: https://github.com/apache/datafusion/issues/14432#issuecomment-2658302749
Hi @eliaperantoni sorry for the long delay. I’ve been taking some time to
familiarize myself with this issue. I found that the "wrong number of argument"
error may occur in different places depending on what function is called. For
example,
1. `select sum(1, 2);` (`TypeSignature::UserDefined`) : error message is
"Execution error: sum function requires 1 argument, got 2"
2. `select ascii('abc', 'def');` (`TypeSignature::String` or other) :
error message is "Function 'ascii' expects 1 arguments but received 2"
Should I:
1. Implement a function to check the number of arguments for all the
`TypeSignature `variants, and attach corresponding `Diagnostic ` to
`DataFusionError`?
2. Attach `Diagnostic ` to `DataFusionError` in different places?
Another stupid question is how to test the queries above correctly because I
always get "expected diagnostic" error even though I have attached `Diagnostic
`
```rust
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}"),
None,
)
)
});
```
Is something wrong with this or do I need to do something else?
These are problems I met in this issue, I am looking forward to some hints
or ideas, thanks so mush!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]