Skip to content

Commit 4695776

Browse files
authored
feat: decimal support for percentile_cont and median (apache#24419)
## Which issue does this PR close? - Closes apache#22042. ## Rationale for this change UDF `percentile_cont` uses floating-point arithmetic to find a percentile, which doesn't work well for decimals. The `median` UDF already supports decimals. Let's implement decimals in `percentile_cont` and build `median` on top of it. A follow-up to apache#21988, refines apache#23954. ## What changes are included in this PR? - Exact decimal support for `percentile_cont`, without float coercion - Linear interpolation for both float (old code) and decimal code paths (new code) - Implement `median` on top of `percentile_cont` UDF by prepending a `0.5f` argument - Add SLTs to verify code - Make `percentile_cont(NULL)` return NULL (see changes below), under a new SLT test case - Tuned `test_oom` to call UDF directly with float parameters (it used integers before without adhering to coercion rules) ## Are these changes tested? - Extend SLTs - Unit tests for `percentile_cont` ## Are there any user-facing changes? - `percentile_cont(NULL)` now returns a NULL type instead of a Float64 type, aligning with other aggregate UDFs
1 parent beb1237 commit 4695776

4 files changed

Lines changed: 738 additions & 738 deletions

File tree

0 commit comments

Comments
 (0)