-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add tdigest data structure for statistics (#71)
This pull request implements a simplified version of [Ted Dunning's TDigest algorithm](https://arxiv.org/pdf/1902.04023.pdf) for efficient quantile/cdf computations. It supports a fully parallelizable, memory-bounded computation scheme, along with an easy API. Simplified for two reasons: - The linear interpolation is only done for the quantile, not the cdf. - Linear interpolation in general could be done more efficiently if we leverage unit-weighted centroids at the edges, as described in the paper. Both are marked as TODOs in the code for future work. Most open-source implementations found online had bugs, were incomplete, or were too complex (i.e., **poorly written**). Includes unit tests on uniform and weighted distributions. Next steps: Implementing the HyperLogLog algorithm for NDistinct.
- Loading branch information
Showing
7 changed files
with
410 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,6 @@ members = [ | |
"optd-datafusion-repr", | ||
"optd-sqlplannertest", | ||
"optd-adaptive-demo", | ||
"gungnir", | ||
] | ||
resolver = "2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[package] | ||
name = "gungnir" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
itertools = "0.11" | ||
rand = "0.8" | ||
crossbeam = "0.8" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#![allow(clippy::new_without_default)] | ||
|
||
pub mod stats; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mod tdigest; |
Oops, something went wrong.