WIP: experimental building of histograms from tdigest #5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This implements two simple SQL functions, building different types of
histograms from a t-digest. Equi-width histograms are the "usual" type
with each bin covering about 1/N of the domain, while equi-height
histograms have bins representing the same fraction of the data.
The functions are fairly trivial SQL functions, calculating boundaries
on either the domain or frequency, and then computing the other values
using the t-digest.
I'm not sure how accurate the histograms are - considering how t-digests
work, the bins at the ends should be the fine while the bins in the
middle could be somewhat less accurate.
One thing this made me realize is the extension only provides aggregate
functions, so when we need to work with t-digests in non-aggregate
contexts it's necessary to do unnecessary groupings etc. Might be handy
to provide some non-aggregate functions to make that unnecessary.