Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add T-Digest data structure #11665

Closed
wants to merge 1 commit into from

Conversation

Yuhta
Copy link
Contributor

@Yuhta Yuhta commented Nov 26, 2024

Summary:
Add the T-Digest data structure implementation to be used in T-Digest
related functions. Also extract the getRandomSeed test utility that is used
in multiple unit tests.

Differential Revision: D66435741

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 26, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66435741

Copy link

netlify bot commented Nov 26, 2024

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit 816d095
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/6762eca62299d60008706ac1

Yuhta added a commit to Yuhta/velox that referenced this pull request Nov 27, 2024
Summary:

Add the T-Digest data structure implementation to be used in T-Digest
related functions.  Also extract the `getRandomSeed` test utility that is used
in multiple unit tests.

Differential Revision: D66435741
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66435741

Copy link
Collaborator

@assignUser assignUser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 CMake

Yuhta added a commit to Yuhta/velox that referenced this pull request Nov 27, 2024
Summary:

Add the T-Digest data structure implementation to be used in T-Digest
related functions.  Also extract the `getRandomSeed` test utility that is used
in multiple unit tests.

Differential Revision: D66435741
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66435741

velox/functions/lib/TDigest.h Show resolved Hide resolved
velox/functions/lib/TDigest.h Outdated Show resolved Hide resolved
velox/functions/lib/TDigest.h Show resolved Hide resolved
Yuhta added a commit to Yuhta/velox that referenced this pull request Dec 5, 2024
Summary:

Add the T-Digest data structure implementation to be used in T-Digest
related functions.  Also extract the `getRandomSeed` test utility that is used
in multiple unit tests.

Differential Revision: D66435741
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66435741

velox/functions/lib/TDigest.h Show resolved Hide resolved
velox/functions/lib/TDigest.h Show resolved Hide resolved
velox/functions/lib/TDigest.h Show resolved Hide resolved
velox/functions/lib/tests/TDigestTest.cpp Show resolved Hide resolved
}
{
SCOPED_TRACE(
"select to_base64(cast(tdigest_agg(x) as varbinary)) from unnest(sequence(0, 1000)) as t(x)");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Maybe also test ... from unnest(shuffle(sequence(0, 1000)))... ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We got the exactly same binary from this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Yuhta It might be because the default compression is too large? I saw this query returns different binary with and without shuffle().

select to_base64(cast(tdigest_agg(cast(x as double), 1, 0.01) as varbinary)) from unnest(shuffle(sequence(0, 1000))) as t(x)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah compression 0.01 (actually 10 in the implementation) would not satisfy the test error bound though. Also it's preferred to have something deterministic in this case. Let me add one still for sequence in order, but with a smaller compression that still satisfy the error bound.

velox/functions/lib/tests/TDigestTest.cpp Show resolved Hide resolved
Yuhta added a commit to Yuhta/velox that referenced this pull request Dec 17, 2024
Summary:

Add the T-Digest data structure implementation to be used in T-Digest
related functions.  Also extract the `getRandomSeed` test utility that is used
in multiple unit tests.

Differential Revision: D66435741
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66435741

Yuhta added a commit to Yuhta/velox that referenced this pull request Dec 17, 2024
Summary:

Add the T-Digest data structure implementation to be used in T-Digest
related functions.  Also extract the `getRandomSeed` test utility that is used
in multiple unit tests.

Differential Revision: D66435741
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66435741

Summary:

Add the T-Digest data structure implementation to be used in T-Digest
related functions.  Also extract the `getRandomSeed` test utility that is used
in multiple unit tests.

Differential Revision: D66435741
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66435741

Copy link
Contributor

@kagamiori kagamiori left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in efbf68e.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants