Repository navigation
Frequent items: raise a threshold below the maximum error to it, as Java, Go and Rust do - #604
Draft
stojkomilos wants to merge 4 commits into
Draft
stojkomilos wants to merge 4 commits into
stojkomilos wants to merge 4 commits into
Conversation
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>
… as given Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
…TIVES claim Co-authored-by: Isaac <no-reply@databricks.com>
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
NOT READY FOR REVIEW YET
Changes
get_frequent_items(err_type, threshold)now usesmax(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.Why: with
NO_FALSE_POSITIVES, a listed item can have a lower bound at or below the maximum error. A dropped item has a true count of at most the maximum error, so the listed item may be no more frequent than a dropped item. With the threshold at the maximum error, every listed item is more frequent than every dropped item.Java, Go and Rust already clamp the threshold this way:
This makes C++ match them on the clamp. Java clamps the threshold to the maximum error before it applies either error type, and this pull request does the same. Java has only integer weights, so the float rounding case, where
NO_FALSE_NEGATIVESrows can change, is C++-only. The comparison still differs. The docs say>in all four libraries: Java at 028462110 lines 375 and 381, Go at 5aaf53b lines 273 and 277, and C++ and Rust. Java and Go code use>=, which this pull request does not change. This pull request keeps>. The doc comment of the two-argument overload says the clamp, as Java's Javadoc does, and that, for integer weights, it has no effect onNO_FALSE_NEGATIVES.This is a behavior change for existing callers. It changes no signature and no serialized format. Callers with an explicit threshold below the maximum error can get fewer rows. This only affects
NO_FALSE_POSITIVES: a threshold of maximum error minus 1 used to return items whose lower bound equals the maximum error, and it no longer does. With integer weights,NO_FALSE_NEGATIVESresults do not change. The Python binding (datasketches-python) passes a nonzero threshold through, so it changes too. Its threshold 0 already means the maximum error.Checks
frequent items: threshold below the maximum error is raised to itfails on master (NO_FALSE_POSITIVESwith threshold 0 returns item 8) and passes with this change. It also checks that any threshold below the maximum error is raised, and that a threshold at or above it is used as given.fi_testpasses on Release: 30 test cases, 181 assertions.fi_testpasses under ASan and UBSan with no sanitizer reports (GCC 10.5).This pull request and its description were written by Isaac.