jmalkin commented on issue #405:
URL: 
https://github.com/apache/datasketches-cpp/issues/405#issuecomment-1799349103

   You shouldn't need to edit anything. Just define your own serde object that 
implements the methods and pass it iun when you call `serialize()`
   
   From the comment in that file:
   Each implementation must extend the PyObjectSerDe class and define three 
methods:
      * get_size(item) returns an int of the number of bytes needed to
        serialize the given item
      * to_bytes(item) returns a bytes object representing a serialized
        version of the given item
      * from_bytes(data, offset) takes a bytes object (data) and an offset
        indicating where in the data array to start reading. The method
        returns a tuple with the newly reconstructed object and the
        total number of bytes beyond the offset read from the input data.
   
   
   And there's an example of using the serde in the tests for the fi sketch:
   `    fi_bytes = fi.serialize(PyIntsSerDe())
       self.assertEqual(len(fi_bytes), 
fi.get_serialized_size_bytes(PyIntsSerDe()))
       new_fi = frequent_items_sketch.deserialize(fi_bytes, PyIntsSerDe())`
   
   


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