clesaec commented on code in PR #2455:
URL: https://github.com/apache/avro/pull/2455#discussion_r1298529034


##########
lang/rust/avro/src/codec.rs:
##########
@@ -82,18 +82,16 @@ impl Codec {
             }
             #[cfg(feature = "snappy")]
             Codec::Snappy => {
-                use byteorder::ByteOrder;
-
                 let mut encoded: Vec<u8> = vec![0; 
snap::raw::max_compress_len(stream.len())];
                 let compressed_size = snap::raw::Encoder::new()
                     .compress(&stream[..], &mut encoded[..])
                     .map_err(Error::SnappyCompress)?;
+                encoded.truncate(compressed_size);

Review Comment:
   As we know we will add u32 checksum, wouldn't it be more efficient with
   `encoded.truncate(compressed_size + 4);`



##########
lang/rust/avro/src/duration.rs:
##########
@@ -28,83 +24,77 @@ pub struct Duration {
 }
 
 #[derive(Debug, Copy, Clone, Eq, PartialEq)]
-pub struct Months(U32<LittleEndian>);
+pub struct Months(u32);

Review Comment:
   Strange duration concept, that is not even Comparable, and Eq is false 
between 1 month, 0 day and 0 months 30 days ... And some month are 31 days ...
   But this PR indeed enhance this.



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

Reply via email to