leerho opened a new pull request, #788: URL: https://github.com/apache/datasketches-java/pull/788
## Problem `ReqSketch.heapify()` reads each compactor's `lgWeight` byte without checking it. The sketch always creates the compactor at level `h` with `lgWeight == h`, so any other value means the image is corrupt. A wrong value doesn't cause an error later. The sorted view weights each compactor's items by `1L << lgWeight` (since #787), so a corrupt byte silently changes every rank and quantile the sketch reports. ## Change `ReqSerDe` now checks that compactor `i` has `lgWeight == i`, in both exact and estimation mode, and throws `SketchesArgumentException` otherwise. Valid images, including the C++ images in the cross-language tests, are unaffected. ## Tests The new `ReqSerDeTest`: - confirms that valid images of 0 to 1,000,000 items still heapify; - rejects a wrong `lgWeight` in the first compactor (70 and 1), in the second compactor, and in the single compactor of an exact-mode image. `mvn verify` passes. 🤖 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]
