Skip to content

Conversation

@jonahgao
Copy link
Member

@jonahgao jonahgao commented May 12, 2024

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?

  • Allow array_slice to take an optional stride parameter

Are these changes tested?

Not sure whether it's necessary to write a test for this.

Are there any user-facing changes?

Yes

}
};
// This pattern does not generate the "fluent expr_fn" style function, it should be provided externally.
($UDF:ty, $SCALAR_UDF_FN:ident) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

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 .

lit(1),
lit(2),
lit(1),
Some(lit(1)),
Copy link
Contributor

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

Copy link
Contributor

@jayzhan211 jayzhan211 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@alamb alamb added the api change Changes the API exposed to users of the crate label May 13, 2024
Copy link
Contributor

@alamb alamb left a 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

@jayzhan211 jayzhan211 merged commit 18fc376 into apache:main May 13, 2024
@jonahgao jonahgao deleted the array_slice_args branch May 13, 2024 23:49
findepi pushed a commit to findepi/datafusion that referenced this pull request Jul 16, 2024
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api change Changes the API exposed to users of the crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

stride is not optional for new array_slice UDF

3 participants