apache / apache/datafusion

Change tdigest centroids number for better accuracy

Open
#3,806 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
9.3k
Forks
2.4k
Avg merge
3d 7h
Merged PRs (30d)
344

Description

**Is your feature request related to a problem or challenge? Please describe what you are trying to do.**
We have a lot of use in approx_percentile in our product. which base on `tdigest`, we facing large amount data we face the issue which loss a lot accuracy.
In the paper, centroids number means how many sample data in your `tdigest`, so i think we should increase centroids number default size.

like in clickhouse set to 2048

https://github.com/ClickHouse/ClickHouse/blob/927af1255adb37ace1b95cc3ec4316553b4cb4b4/src/AggregateFunctions/QuantileTDigest.h#L71-L87

in spark and hive set to 10000 . https://github.com/apache/hive/blob/7b3ecf617a6d46f48a3b6f77e0339fd4ad95a420/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFPercentileApprox.java#L58-L59

**Describe the solution you'd like**
Change DEFAULT_MAX_SIZE to 10000

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.

Contributor guide

Open the contributing guide

Research direction

Search the Rust source for DEFAULT_MAX_SIZE and trace how it is used by approx_percentile and the tdigest implementation. Check the surrounding aggregation tests or add coverage for the requested centroid limit, then confirm that the new default improves accuracy without unacceptable regressions.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
data-engineering
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.