leerho opened a new pull request, #546:
URL: https://github.com/apache/datasketches-cpp/pull/546

   `array_tuple_union::update()` and `array_tuple_intersection::update()` (and 
so `array_of_doubles_union` and `array_of_doubles_intersection`) now throw 
`std::invalid_argument` when the sketch's number of values differs from the 
union or intersection policy's. This matches datasketches-java, where 
`ArrayOfDoublesUnion.union()` and `ArrayOfDoublesIntersection.intersect()` 
reject a sketch with a different `numValues`.
   
   Previously the mismatch was not detected and the result was undefined.
   
   The check is in `update()` rather than in the union policy, because entries 
for new keys are copied into the union without calling the policy, and 
`get_result()` builds the result with the policy's number of values. As in 
Java, empty sketches are checked too.
   
   ### Tests
   
   New `aod union: number of values` and `aod intersection: number of values` 
cases in `array_of_doubles_sketch_test.cpp`: matching sketches combine as 
before; a mismatch is rejected for update and compact sketches, with and 
without overlapping keys, and for an empty sketch; a union stays usable after a 
rejected update. Both fail on master and pass here; the full test suite passes 
(macOS, Debug).
   
   🤖 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]

Reply via email to