leerho opened a new pull request, #782: URL: https://github.com/apache/datasketches-java/pull/782
Follow-up to #778. It brings the Java theta and tuple `JaccardSimilarity` classes into line with each other, and with C++ (`theta_jaccard_similarity_base.hpp`) and Go (`tuple/jaccard_similarity.go`), which share one implementation for theta and tuple. ## Theta `JaccardSimilarity` - **Seed overloads** for `jaccard`, `exactlyEqual`, `similarityTest` and `dissimilarityTest`. Until now, sketches created with a custom seed couldn't be compared: the internal union and intersection used the default seed and threw "Incompatible Seed Hashes". The existing methods pass the default seed through, so callers see no change. ## Tuple `JaccardSimilarity` - **Shared helpers** `computeUnion`, `newUnion` and `identicalSets`, as theta has since #778. They replace four copies of the union-and-compare code. - **Union size clamped in `exactlyEqual`** to the legal range of nominal entries, as tuple `jaccard`, theta, C++ and Go already do. Unlike theta, tuple never threw here, because tuple sketches don't enforce the range; the change is for consistency. - **Same-sketch check** added to `jaccard(TupleSketch, TupleSketch, ...)`, as in theta, C++ and Go. ## Tuple set operations with a `ThetaSketch` input - `TupleUnion.union`, `TupleIntersection.intersect`, `TupleAnotB.notB` and `TupleAnotB.aNotB` now throw `SketchesArgumentException` when given a non-empty `ThetaSketch` created with a non-default seed. Java tuple sketches always use the default seed, so such input used to give silently wrong results. Empty sketches aren't checked, as in theta. - To support this, `ThetaSketch.getSeedHash()` is now public, matching `get_seed_hash()` in C++. Full custom-seed support for Java tuple sketches, as C++, Go and Rust have, is planned as a separate PR. ## Tests - New `tuple/ThetaSeedHashTest`, plus new tests in both `JaccardSimilarityTest` classes. The seed-rejection tests fail without this change. - `mvn verify` passes: 2298 tests, plus the javadoc and style checks. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
