Skip to content

Frequent items: raise a threshold below the maximum error to it, as Java, Go and Rust do - #604

Draft
stojkomilos wants to merge 1 commit into
apache:masterfrom
stojkomilos:milosh-stojko/fi-threshold-at-least-max-error
Draft

stojkomilos wants to merge 1 commit into
apache:masterfrom
stojkomilos:milosh-stojko/fi-threshold-at-least-max-error

Conversation

@stojkomilos

Copy link
Copy Markdown
Contributor

Changes

get_frequent_items(err_type, threshold) now uses max(threshold, get_maximum_error()) as its threshold. Before, it used the threshold as passed. The one-argument overload already passed the maximum error, so it does not change.

Java, Go and Rust already do this:

This makes C++ match them. The doc comment of the two-argument overload says the same.

Callers with an explicit threshold below the maximum error get fewer rows. With NO_FALSE_POSITIVES, an item whose lower bound is at or below the offset could be returned before, even though the sketch may have dropped items as frequent as it. The Python binding (datasketches-python) passes a nonzero threshold through, so it changes too. Its threshold 0 already means the maximum error.

Checks

  • New test frequent items: threshold below the maximum error is raised to it fails on master (NO_FALSE_POSITIVES with threshold 0 returns item 8) and passes with this change.
  • fi_test passes on Release: 30 test cases, 175 assertions.
  • fi_test passes under ASan and UBSan with no sanitizer reports (GCC 10.5).

This pull request and its description were written by Isaac.

get_frequent_items(err_type, threshold) now uses max(threshold, offset),
as datasketches-java, -go and -rust do. The one-argument overload already
passed the maximum error.

Co-authored-by: Isaac <no-reply@databricks.com>

This branch has not been deployed

No deployments
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.

1 participant