tisonkun commented on code in PR #23: URL: https://github.com/apache/datasketches-rust/pull/23#discussion_r2623719248
########## src/tdigest/serialization.rs: ########## @@ -1,14 +1,38 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use byteorder::{ByteOrder, LE}; + +use crate::error::SerdeError; use crate::tdigest::TDigest; const PREAMBLE_LONGS_EMPTY_OR_SINGLE: u8 = 1; const PREAMBLE_LONGS_MULTIPLE: u8 = 2; const SERIAL_VERSION: u8 = 1; const TDIGEST_FAMILY_ID: u8 = 20; +const FLAGS_IS_EMPTY: u8 = 1 << 0; +const FLAGS_IS_SINGLE_VALUE: u8 = 1 << 1; +const FLAGS_REVERSE_MERGE: u8 = 1 << 2; impl TDigest { /// Serializes this TDigest to bytes. pub fn serialize(&mut self) -> Vec<u8> { self.compress(); Review Comment: We should compress here. Postpone type param of serde methods later. ########## src/tdigest/serialization.rs: ########## @@ -1,14 +1,38 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use byteorder::{ByteOrder, LE}; + +use crate::error::SerdeError; use crate::tdigest::TDigest; const PREAMBLE_LONGS_EMPTY_OR_SINGLE: u8 = 1; const PREAMBLE_LONGS_MULTIPLE: u8 = 2; const SERIAL_VERSION: u8 = 1; const TDIGEST_FAMILY_ID: u8 = 20; +const FLAGS_IS_EMPTY: u8 = 1 << 0; +const FLAGS_IS_SINGLE_VALUE: u8 = 1 << 1; +const FLAGS_REVERSE_MERGE: u8 = 1 << 2; impl TDigest { /// Serializes this TDigest to bytes. pub fn serialize(&mut self) -> Vec<u8> { self.compress(); Review Comment: We should compress here. Postpone type of param of serde methods later. -- 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]
