-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Minor: cleanup datafusion-spark scalar functions #15921
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
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.
Pull Request Overview
This PR simplifies the scalar function testing macros in the DataFusion Spark module by cleaning up the handling of argument fields.
- Explicitly types the owned argument fields for clarity.
- Refactors the construction and passing of argument field references in the function invocation calls.
@@ -28,7 +28,7 @@ pub mod test { | |||
let expected: datafusion_common::Result<Option<$EXPECTED_TYPE>> = $EXPECTED; | |||
let func = $FUNC; | |||
|
|||
let arg_fields_owned = $ARGS | |||
let arg_fields_owned: Vec<arrow::datatypes::Field> = $ARGS |
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.
[nitpick] If $ARGS already yields a Vecarrow::datatypes::Field, the explicit type annotation might be redundant. Consider removing it or adding a comment to clarify its purpose.
let arg_fields_owned: Vec<arrow::datatypes::Field> = $ARGS | |
let arg_fields_owned = $ARGS |
Copilot uses AI. Check for mistakes.
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.
🙏
Thank you for the review @blaginin |
args: $ARGS, | ||
number_rows: cardinality, | ||
return_field: &return_field, | ||
arg_fields: arg_fields.clone(), |
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.
in particular the change is to avoid calling collect
twice and instead create the vec once and reuse it
Which issue does this PR close?
Rationale for this change
I was reviewing the macro added in #15917 and thought I could make it slightly simpler
What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?