fulmicoton opened a new issue, #115:
URL: https://github.com/apache/datasketches-rust/issues/115

   Minimal reproducing test.
   
   When serializing/deserializing a sketch we create a "compact" version of the 
datasketch.
   For List, this means the array of values is as long as the len of the lists.
   
   The update code on the end, attempts to append the value by scanning through 
the list of values, 
   up to the point where a SENTINEL value is reached (value 0) and inserts it 
there.
   
   Due to the compact representation of lists, we are never able to add an 
element.
   
   If the end of the list is reached, we do not panic, and exit silently.
   After updating, we see if we need to upgrade the list to a set.
   
   ```rust
   
       #[test]
       fn hll_serialize_deserialize_then_update() {
           const LG_K: u8 = 11;
           let mut sketch = HllSketch::new(LG_K, HllType::Hll4);
   
           sketch.update(1);
   
           // Serialize / Deserialize round-trip
           let bytes = sketch.serialize();
           let mut sketch = HllSketch::deserialize(&bytes).unwrap();
           sketch.update(2);
   
           // The sketch should have observed 3 distinct coupons
           let est = sketch.estimate();
           assert!(
               (est - 2.0).abs() < 0.1,
               "expected estimate close to 2, got {est}"
           );
       }```
   


-- 
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