Fengzdadi opened a new pull request, #104: URL: https://github.com/apache/datasketches-go/pull/104
## Summary This PR completes the [ReservoirItemsUnion](cci:2://file:///d:/Code/Projects/apache/datasketches-go/sampling/reservoir_items_union.go:37:0-40:1) implementation to align with Java's functionality. ## Changes ### Core Logic Fixes - Fixed `twoWayMergeInternal` to correctly handle 4 merge cases - Added `DownsampledCopy`, `Copy`, `GetImplicitSampleWeight` methods - Added internal helpers: `getValueAtPosition`, `insertValueAtPosition`, `forceIncrementItemsSeen` - Serialization: `ToSlice()`and `NewReservoirItemsUnionFromSlice()` - UpdateFromRaw: Create sketch from raw components (n, k, items) - `String()`: Human-readable summary ### Tests - 17 test cases covering merge logic, serialization, and error handling ## Serialization Format Compatible with Java V2: - Byte 0: preLongs (1) - Byte 1: serVer (2) - Byte 2: familyID (12) - Byte 3: flags - Bytes 4-7: maxK (uint32 LE) - Bytes 8+: gadget data PS: Only V2 serialization is supported (V1 is legacy format from pre-2017). Ref #103 -- 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]
