You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "jonahgao (via GitHub)" <gi...@apache.org> on 2024/05/12 14:51:19 UTC
[PR] feat: allow `array_slice` to take an optional stride parameter [datafusion]
jonahgao opened a new pull request, #10469:
URL: https://github.com/apache/datafusion/pull/10469
## Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
-->
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?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
- Allow array_slice to take an optional stride parameter
## Are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
-->
## Are there any user-facing changes?
No
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: allow `array_slice` to take an optional stride parameter [datafusion]
Posted by "jayzhan211 (via GitHub)" <gi...@apache.org>.
jayzhan211 commented on code in PR #10469:
URL: https://github.com/apache/datafusion/pull/10469#discussion_r1598379495
##########
datafusion/proto/tests/cases/roundtrip_logical_plan.rs:
##########
@@ -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)),
Review Comment:
Maybe add the example that has None for stride?
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: allow `array_slice` to take an optional stride parameter [datafusion]
Posted by "Michael-J-Ward (via GitHub)" <gi...@apache.org>.
Michael-J-Ward commented on PR #10469:
URL: https://github.com/apache/datafusion/pull/10469#issuecomment-2107941566
@jayzhan211, Should I follow this as a template for making UDF arguments optional?
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: allow `array_slice` to take an optional stride parameter [datafusion]
Posted by "jonahgao (via GitHub)" <gi...@apache.org>.
jonahgao commented on code in PR #10469:
URL: https://github.com/apache/datafusion/pull/10469#discussion_r1598536574
##########
datafusion/functions-array/src/macros.rs:
##########
@@ -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) => {
Review Comment:
Applied. This eliminates some duplication of macro codes. Thank you @jayzhan211 .
##########
datafusion/proto/tests/cases/roundtrip_logical_plan.rs:
##########
@@ -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)),
Review Comment:
Added.
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: allow `array_slice` to take an optional stride parameter [datafusion]
Posted by "jayzhan211 (via GitHub)" <gi...@apache.org>.
jayzhan211 merged PR #10469:
URL: https://github.com/apache/datafusion/pull/10469
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: allow `array_slice` to take an optional stride parameter [datafusion]
Posted by "jayzhan211 (via GitHub)" <gi...@apache.org>.
jayzhan211 commented on code in PR #10469:
URL: https://github.com/apache/datafusion/pull/10469#discussion_r1598377661
##########
datafusion/functions-array/src/macros.rs:
##########
@@ -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) => {
Review Comment:
I would recommend to pull out `create_function` like https://github.com/apache/datafusion/blob/main/datafusion/functions-aggregate/src/macros.rs.
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org