Skip to content

Commit a7383c6

Browse files
adriangbclaude
andcommitted
feat: Add percentile_cont aggregate function
Adds exact percentile_cont aggregate function as the counterpart to the existing approx_percentile_cont function. This implementation: - Calculates exact percentiles by storing all values in memory - Supports WITHIN GROUP (ORDER BY ...) syntax - Uses linear interpolation between values for continuous percentiles - Handles all numeric types (integers, floats, decimals) - Supports DISTINCT mode - Includes GroupsAccumulator for efficient grouped aggregation - Comprehensive test coverage Closes #6714 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent f8ff82a commit a7383c6

File tree

3 files changed

+966
-0
lines changed

3 files changed

+966
-0
lines changed

datafusion/functions-aggregate/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ pub mod hyperloglog;
8181
pub mod median;
8282
pub mod min_max;
8383
pub mod nth_value;
84+
pub mod percentile_cont;
8485
pub mod regr;
8586
pub mod stddev;
8687
pub mod string_agg;
@@ -123,6 +124,7 @@ pub mod expr_fn {
123124
pub use super::min_max::max;
124125
pub use super::min_max::min;
125126
pub use super::nth_value::nth_value;
127+
pub use super::percentile_cont::percentile_cont;
126128
pub use super::regr::regr_avgx;
127129
pub use super::regr::regr_avgy;
128130
pub use super::regr::regr_count;
@@ -171,6 +173,7 @@ pub fn all_default_aggregate_functions() -> Vec<Arc<AggregateUDF>> {
171173
approx_distinct::approx_distinct_udaf(),
172174
approx_percentile_cont_udaf(),
173175
approx_percentile_cont_with_weight_udaf(),
176+
percentile_cont::percentile_cont_udaf(),
174177
string_agg::string_agg_udaf(),
175178
bit_and_or_xor::bit_and_udaf(),
176179
bit_and_or_xor::bit_or_udaf(),

0 commit comments

Comments
 (0)