This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/main by this push:
new 3208e4f62e test: cover signed integers and bool in
BitReader::get_batch test (#10180)
3208e4f62e is described below
commit 3208e4f62ef105e7655b205d30bde23bb040b90e
Author: Andrew Lamb <[email protected]>
AuthorDate: Mon Jun 22 15:37:04 2026 -0400
test: cover signed integers and bool in BitReader::get_batch test (#10180)
# Which issue does this PR close?
- related to
https://github.com/apache/arrow-rs/pull/10172#pullrequestreview-4547106475
# Rationale for this change
`test_get_batch` in `parquet/src/util/bit_util.rs` only exercised the
unsigned
types (`u8`/`u16`/`u32`/`u64`). `BitReader::get_batch` is also generic
over the
signed integer types (`i8`/`i16`/`i32`/`i64`) and `bool`, each with its
own
`FromBitpacked` implementation, but none of those were covered by the
test.
# What changes are included in this PR?
Extend `test_get_batch` to also run the signed counterpart of each width
and
`bool` (at its only supported bit width of 1), reusing the existing
`test_get_batch_helper`.
# Are these changes tested?
it is all testes
# Are there any user-facing changes?
No.
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
---
parquet/src/util/bit_util.rs | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/parquet/src/util/bit_util.rs b/parquet/src/util/bit_util.rs
index d0b13072dc..8599e13342 100644
--- a/parquet/src/util/bit_util.rs
+++ b/parquet/src/util/bit_util.rs
@@ -1223,11 +1223,30 @@ mod tests {
const SIZE: &[usize] = &[1, 31, 32, 33, 128, 129];
for s in SIZE {
for i in 0..=64 {
+ // `get_batch` is generic over all of these types, so exercise
the
+ // signed integer types and `bool` alongside the unsigned
types rather
+ // than relying on the unsigned coverage alone.
match i {
- 0..=8 => test_get_batch_helper::<u8>(*s, i),
- 9..=16 => test_get_batch_helper::<u16>(*s, i),
- 17..=32 => test_get_batch_helper::<u32>(*s, i),
- _ => test_get_batch_helper::<u64>(*s, i),
+ 0..=8 => {
+ test_get_batch_helper::<u8>(*s, i);
+ test_get_batch_helper::<i8>(*s, i);
+ }
+ 9..=16 => {
+ test_get_batch_helper::<u16>(*s, i);
+ test_get_batch_helper::<i16>(*s, i);
+ }
+ 17..=32 => {
+ test_get_batch_helper::<u32>(*s, i);
+ test_get_batch_helper::<i32>(*s, i);
+ }
+ _ => {
+ test_get_batch_helper::<u64>(*s, i);
+ test_get_batch_helper::<i64>(*s, i);
+ }
+ }
+ // `bool` only supports a bit width of 1.
+ if i == 1 {
+ test_get_batch_helper::<bool>(*s, i);
}
}
}