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



##########
File path: parquet/src/data_type.rs
##########
@@ -661,8 +661,15 @@ pub(crate) mod private {
             _: &mut W,
             bit_writer: &mut BitWriter,
         ) -> Result<()> {
+            if bit_writer.bytes_written() + values.len() >= 
bit_writer.capacity() {
+                bit_writer.extend(256);
+            }
             for value in values {
-                bit_writer.put_value(*value as u64, 1);
+                if !bit_writer.put_value(*value as u64, 1) {

Review comment:
       Since `put_value` returns false if there isn't enough space, you might 
be able to avoid errors with something like:
   
   ```rust
   for value in values {
     if !bit_writer.put_value(*value as u64, 1) {
       bit_writer.extend(256)
       bit_writer.put_value(*value as u64, 1)
     }
   }
   ```
   
   Rather than returning an error




-- 
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:
us...@infra.apache.org


Reply via email to