You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/06/10 13:25:52 UTC

[GitHub] [arrow-rs] garyanaplan commented on a change in pull request #443: improve BOOLEAN writing logic and report error on encoding fail

garyanaplan commented on a change in pull request #443:
URL: https://github.com/apache/arrow-rs/pull/443#discussion_r649180581



##########
File path: parquet/src/encodings/encoding.rs
##########
@@ -153,7 +155,11 @@ impl<T: DataType> Encoder<T> for PlainEncoder<T> {
 
     #[inline]
     fn put(&mut self, values: &[T::T]) -> Result<()> {
+        if self.bw_bytes_written + values.len() >= self.bit_writer.capacity() {
+            self.bit_writer.extend(256);
+        }
         T::T::encode(values, &mut self.buffer, &mut self.bit_writer)?;
+        self.bw_bytes_written += values.len();

Review comment:
       I'm going to add a comment myself! :-)
   
   I just realised that I only want to do this checking if the encoding is for a Boolean, otherwise it's wasted work/memory. I'll think of the best way to achieve that.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org