Skip to content
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: expose centroids in approx_percentile_cont fluent api #11878

Merged
merged 3 commits into from
Aug 8, 2024

Conversation

Michael-J-Ward
Copy link
Contributor

Which issue does this PR close?

Closes #11877.

Rationale for this change

The UDAF approx_percentile_cont has a third optional argument that the fluent api does not currently expose.

This PR add the 3rd optional argument, consistent with how array_slice and regexp_* fluent APIs expose optional arguments.

What changes are included in this PR?

Add centroids: Option<Expr> to the fluent API.

Are these changes tested?

Yes.

Are there any user-facing changes?

Yes. Any user of the approx_percentile_cont fluent API will need to add None for the optional argument.

@github-actions github-actions bot added the core Core DataFusion crate label Aug 7, 2024
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.

👍

@@ -394,6 +394,21 @@ async fn test_fn_approx_percentile_cont() -> Result<()> {

assert_batches_eq!(expected, &batches);

// with number of centroids set
let expr = approx_percentile_cont(col("b"), lit(0.5), Some(lit(2)));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

NOTE: I don't have SQL Server, so I did not verify that it produces this result.

I chose a choice for centroids that produced a different result than the default.

@Michael-J-Ward Michael-J-Ward changed the title feat: expose centroids in approx_percentile_count fluent api feat: expose centroids in approx_percentile_cont fluent api Aug 8, 2024
@alamb alamb added the api change Changes the API exposed to users of the crate label Aug 8, 2024
@alamb
Copy link
Contributor

alamb commented Aug 8, 2024

I think technically speaking this is an API change as there is a new parameter, so I marked the PR thusly

@alamb alamb merged commit 56f8e35 into apache:main Aug 8, 2024
25 checks passed
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 core Core DataFusion crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose optional num_centroids argument in approx_percentile_cont's fluent API
3 participants