-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: incorrect error message of function_length_check #14056
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM👍
@jonahgao Thanks for reviewing so quickly. |
@@ -440,13 +440,13 @@ fn get_valid_types( | |||
fn function_length_check(length: usize, expected_length: usize) -> Result<()> { | |||
if length < 1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wondering if this check really needed? would be that enough just to compare with expected_length?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me to remove this check.
However, if it's required to handle the 0 arg case specifically, it's also reasonable to keep this check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, I would expect expected_length to be 0 in this case? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove this check, 0 arg is handled early in
if current_types.is_empty() {
if type_signature.supports_zero_argument() {
return Ok(vec![]);
} else if type_signature.used_to_support_zero_arguments() {
// Special error to help during upgrade: https://github.com/apache/datafusion/issues/13763
return plan_err!("{} does not support zero arguments. Use TypeSignature::Nullary for zero arguments.", func.name());
} else {
return plan_err!("{} does not support zero arguments.", func.name());
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
07aa555
to
f7064f1
Compare
Thanks @niebayes @comphead @jayzhan211 |
Which issue does this PR close?
No
Rationale for this change
The error message of the
function_length_check
is incorrect.What changes are included in this PR?
Place the
expected_length
andlength
at where they should be.Are these changes tested?
Yes, added a simple unit test.
Are there any user-facing changes?
Yes, users will see correct error message when given unexpected number of args.