-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat: allow array_slice
to take an optional stride parameter
#10469
Conversation
@@ -106,4 +105,26 @@ macro_rules! make_udf_function { | |||
} | |||
} | |||
}; | |||
// This pattern does not generate the "fluent expr_fn" style function, it should be provided externally. | |||
($UDF:ty, $SCALAR_UDF_FN:ident) => { |
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.
I would recommend to pull out create_function
like https://github.com/apache/datafusion/blob/main/datafusion/functions-aggregate/src/macros.rs.
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.
Applied. This eliminates some duplication of macro codes. Thank you @jayzhan211 .
@@ -581,7 +581,7 @@ async fn roundtrip_expr_api() -> Result<()> { | |||
make_array(vec![lit(1), lit(2), lit(3)]), | |||
lit(1), | |||
lit(2), | |||
lit(1), | |||
Some(lit(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.
Maybe add the example that has None for stride?
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.
Added.
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.
👍
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 -- thank you @jonahgao and @jayzhan211
…e#10469) * feat: allow array_slice to take an optional stride parameter * Use ScalarUDF::call * Use create_function and add test * format * fix cargo doc
Which issue does this PR close?
Closes #10424.
Rationale for this change
Based on the draft PR #10450, and reuse the existing
make_udf_function
macro as much as possible.What changes are included in this PR?
Are these changes tested?
Not sure whether it's necessary to write a test for this.
Are there any user-facing changes?
Yes