-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Closed
Copy link
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem or challenge?
approx_percentile_cont's fluent API currently exposes expression and percentile.
| make_udaf_expr_and_func!( | |
| ApproxPercentileCont, | |
| approx_percentile_cont, | |
| expression percentile, | |
| "Computes the approximate percentile continuous of a set of numbers", | |
| approx_percentile_cont_udaf | |
| ); |
However, as described in the datafusion docs, the UDAF accepts a 3rd optional argument, an integer number of centroids for T-Digest
| impl ApproxPercentileCont { | |
| /// Create a new [`ApproxPercentileCont`] aggregate function. | |
| pub fn new() -> Self { | |
| let mut variants = Vec::with_capacity(NUMERICS.len() * (INTEGERS.len() + 1)); | |
| // Accept any numeric value paired with a float64 percentile | |
| for num in NUMERICS { | |
| variants.push(TypeSignature::Exact(vec![num.clone(), DataType::Float64])); | |
| // Additionally accept an integer number of centroids for T-Digest | |
| for int in INTEGERS { | |
| variants.push(TypeSignature::Exact(vec![ | |
| num.clone(), | |
| DataType::Float64, | |
| int.clone(), | |
| ])) | |
| } | |
| } | |
| Self { | |
| signature: Signature::one_of(variants, Volatility::Immutable), | |
| } |
Describe the solution you'd like
Consistent with exposing optional arguments for array_slice and regexp_* fluent apis, add a 3rd optional argument to approx_percentile_cont's fluent API.
Describe alternatives you've considered
No response
Additional context
I'll have a PR for this shortly.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request