tisonkun commented on code in PR #23:
URL: https://github.com/apache/datasketches-rust/pull/23#discussion_r2622256216
##########
src/tdigest/serialization.rs:
##########
@@ -17,6 +41,45 @@ impl TDigest {
});
bytes.push(SERIAL_VERSION);
bytes.push(TDIGEST_FAMILY_ID);
+ LE::write_u16(&mut bytes, self.k);
+ bytes.push({
+ let mut flags = 0;
+ if self.is_empty() {
+ flags |= FLAGS_IS_EMPTY;
+ }
+ if self.is_single_value() {
+ flags |= FLAGS_IS_SINGLE_VALUE;
+ }
+ if self.reverse_merge {
+ flags |= FLAGS_REVERSE_MERGE;
+ }
+ flags
+ });
+ LE::write_u16(&mut bytes, 0); // unused
+ if self.is_empty() {
+ return bytes;
+ }
+ if self.is_single_value() {
+ LE::write_f64(&mut bytes, self.min);
+ return bytes;
+ }
+ LE::write_u32(&mut bytes, self.centroids.len() as u32);
+ LE::write_u32(&mut bytes, 0); // unused
Review Comment:
This is for `self.buffer`. While in Java impl we always compress and thus
skip all for the buffer, the C++ impl may include it.
--
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]