etseidl commented on code in PR #12523:
URL: https://github.com/apache/arrow-rs/pull/12523#discussion_r4806689424


##########
parquet/src/arrow/push_decoder/mod.rs:
##########
@@ -1061,6 +1061,41 @@ mod test {
         assert_eq!(all_output, *TEST_BATCH);
     }
 
+    /// A row group with fewer rows than the batch size is read into buffers 
sized for its rows
+    #[test]
+    fn test_decoder_sizes_buffers_for_row_group_rows() {
+        let mut decoder = prefetched_decoder(TEST_BATCH.num_rows());
+
+        let batch = expect_data(decoder.try_decode());
+        assert_eq!(batch.num_rows(), 200);
+        let values = batch.column(0).as_primitive::<Int64Type>().values();
+        assert_eq!(values.inner().capacity(), 200 * size_of::<i64>());

Review Comment:
   I'm a little concerned that this check may be a little brittle. Even the 
`_exact` allocators don't absolutely guarantee the reservation won't exceed the 
request. How about changing this to asserting `capacity < TEST_BATCH.num_rows() 
* size_of::<i64>()`? That at least guards against a small overallocation. Same 
comment for the following test.



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