Skip to content

Bind HLL get_composite_estimate - #70

Merged
leerho merged 1 commit into
apache:mainfrom
jaideeppyne:feat/hll-composite-estimate
Oct 10, 2026
Merged

leerho merged 1 commit into
apache:mainfrom
jaideeppyne:feat/hll-composite-estimate

Conversation

@jaideeppyne

Copy link
Copy Markdown
Contributor

Fixes #68.

get_estimate() is the HIP estimator. It is the more accurate of the two, and it can change with insertion order. The composite estimator is order-independent, and it is what a union uses once HIP can no longer be kept. C++ and Java already expose it. This binds the same method on both hll_sketch and hll_union.

The docstring matches the C++ note that this is the estimator for when order-independence matters, not a replacement for get_estimate().

The test builds the same items in opposite orders and checks that get_composite_estimate() agrees, and that hll_union.get_composite_estimate() matches get_result().get_composite_estimate().

Tests: python -m unittest tests.hll_test.

The composite estimator is order-independent. get_estimate() is the HIP
estimator and can change with insertion order.

@leerho leerho left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

C++ already exposes get_composite_estimate() publicly on both hll_sketch and hll_union (hll.hpp:330 and :480), so there's nothing to change in C++. The C++ documentation says it's "made public only for error characterization software… not intended for normal use". #70's docstrings carry the same caveat ("Intended for error characterization rather than normal use"), so it matches C++ and Java.

@leerho
leerho merged commit b821d1a into apache:main Oct 10, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose get_composite_estimate() on hll_sketch in the Python binding

2 participants