Repository: jorgecarleitao/arrow2
Pull request #998 (2022-05-20 21:19:47)

Added support for Decimal in `build_compare`
Fixes Issue #997.

codecov[bot]: # [Codecov](https://codecov.io/gh/jorgecarleitao/arrow2/pull/998?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao) Report
> Merging [#998](https://codecov.io/gh/jorgecarleitao/arrow2/pull/998?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao) (94d3a71) into [main](https://codecov.io/gh/jorgecarleitao/arrow2/commit/267cac048f1e150953a7a92ce5f0f039dca786e1?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao) (267cac0) will **decrease** coverage by `0.00%`.
> The diff coverage is `100.00%`.

```diff
@@            Coverage Diff             @@
##             main     #998      +/-   ##
==========================================
- Coverage   71.41%   71.41%   -0.01%     
==========================================
  Files         357      357              
  Lines       19799    19788      -11     
==========================================
- Hits        14139    14131       -8     
+ Misses       5660     5657       -3     
```


| [Impacted Files](https://codecov.io/gh/jorgecarleitao/arrow2/pull/998?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao) | Coverage Δ | |
|---|---|---|
| [src/array/ord.rs](https://codecov.io/gh/jorgecarleitao/arrow2/pull/998/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao#diff-c3JjL2FycmF5L29yZC5ycw==) | `71.60% <100.00%> (+0.35%)` | :arrow_up: |
| [src/ffi/schema.rs](https://codecov.io/gh/jorgecarleitao/arrow2/pull/998/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao#diff-c3JjL2ZmaS9zY2hlbWEucnM=) | `67.53% <0.00%> (-0.63%)` | :arrow_down: |
| [src/ffi/array.rs](https://codecov.io/gh/jorgecarleitao/arrow2/pull/998/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao#diff-c3JjL2ZmaS9hcnJheS5ycw==) | `82.50% <0.00%> (-0.43%)` | :arrow_down: |
| [src/ffi/stream.rs](https://codecov.io/gh/jorgecarleitao/arrow2/pull/998/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao#diff-c3JjL2ZmaS9zdHJlYW0ucnM=) | `63.21% <0.00%> (+0.29%)` | :arrow_up: |
| [src/io/avro/read/deserialize.rs](https://codecov.io/gh/jorgecarleitao/arrow2/pull/998/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao#diff-c3JjL2lvL2F2cm8vcmVhZC9kZXNlcmlhbGl6ZS5ycw==) | `72.45% <0.00%> (+0.42%)` | :arrow_up: |
| [...c/io/parquet/read/deserialize/binary/dictionary.rs](https://codecov.io/gh/jorgecarleitao/arrow2/pull/998/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao#diff-c3JjL2lvL3BhcnF1ZXQvcmVhZC9kZXNlcmlhbGl6ZS9iaW5hcnkvZGljdGlvbmFyeS5ycw==) | `90.90% <0.00%> (+3.03%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/jorgecarleitao/arrow2/pull/998?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/jorgecarleitao/arrow2/pull/998?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao). Last update [267cac0...94d3a71](https://codecov.io/gh/jorgecarleitao/arrow2/pull/998?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao).


Patch:
diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md
index 2eb378977b..8db39b49b2 100644
--- a/DEVELOPMENT.md
+++ b/DEVELOPMENT.md
@@ -9,7 +9,7 @@ the CI to understand how to test the different parts of this library locally.
 The simplest way to test the crate is to run 
 
 ```bash
-cargo test
+cargo test --tests
 ```
 
 This runs the tests of the crate without features. To run all features, use
@@ -23,12 +23,14 @@ to reduce the feature set - the tests are gated to only the relevant tests
 of that feature set. For example, if improving JSON, you can use
 
 ```bash
-cargo test --features io_json
+cargo test --tests --features io_json
 ```
 
+to only run both non-feature-specific tests and tests for json.
+
 ## Merging
 
-We currently do not have maintaince versions and thus only PR and merge to `main`.
+We currently do not have maintainance versions and thus only PR and merge to `main`.
 
 We use labels to build a changelog - it is very important to label issues and/or PRs
 accordingly. Because our changelog can contain both issues and PRs, when a PR closes
diff --git a/src/array/binary/fmt.rs b/src/array/binary/fmt.rs
index 1d82f2c979..c068d0d365 100644
--- a/src/array/binary/fmt.rs
+++ b/src/array/binary/fmt.rs
@@ -15,7 +15,7 @@ impl<O: Offset> Debug for BinaryArray<O> {
     fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         let writer = |f: &mut Formatter, index| write_value(self, index, f);
 
-        let head = if O::is_large() {
+        let head = if O::IS_LARGE {
             "LargeBinaryArray"
         } else {
             "BinaryArray"
diff --git a/src/array/binary/mod.rs b/src/array/binary/mod.rs
index 7a6aec0fd6..5fbe0f0b13 100644
--- a/src/array/binary/mod.rs
+++ b/src/array/binary/mod.rs
@@ -124,7 +124,7 @@ impl<O: Offset> BinaryArray<O> {
 
     /// Returns the default [`DataType`], `DataType::Binary` or `DataType::LargeBinary`
     pub fn default_data_type() -> DataType {
-        if O::is_large() {
+        if O::IS_LARGE {
             DataType::LargeBinary
         } else {
             DataType::Binary
diff --git a/src/array/list/fmt.rs b/src/array/list/fmt.rs
index 868689a382..e6103ded6c 100644
--- a/src/array/list/fmt.rs
+++ b/src/array/list/fmt.rs
@@ -20,7 +20,7 @@ impl<O: Offset> Debug for ListArray<O> {
     fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         let writer = |f: &mut Formatter, index| write_value(self, index, "None", f);
 
-        let head = if O::is_large() {
+        let head = if O::IS_LARGE {
             "LargeListArray"
         } else {
             "ListArray"
diff --git a/src/array/list/mod.rs b/src/array/list/mod.rs
index 1470cb2b3b..18662a9ee1 100644
--- a/src/array/list/mod.rs
+++ b/src/array/list/mod.rs
@@ -292,7 +292,7 @@ impl<O: Offset> ListArray<O> {
     /// Returns a default [`DataType`]: inner field is named "item" and is nullable
     pub fn default_datatype(data_type: DataType) -> DataType {
         let field = Box::new(Field::new("item", data_type, true));
-        if O::is_large() {
+        if O::IS_LARGE {
             DataType::LargeList(field)
         } else {
             DataType::List(field)
@@ -310,7 +310,7 @@ impl<O: Offset> ListArray<O> {
     /// # Errors
     /// Panics iff the logical type is not consistent with this struct.
     fn try_get_child(data_type: &DataType) -> Result<&Field, ArrowError> {
-        if O::is_large() {
+        if O::IS_LARGE {
             match data_type.to_logical_type() {
                 DataType::LargeList(child) => Ok(child.as_ref()),
                 _ => Err(ArrowError::oos(
diff --git a/src/array/list/mutable.rs b/src/array/list/mutable.rs
index 47695a7f00..5b4a1e3e6f 100644
--- a/src/array/list/mutable.rs
+++ b/src/array/list/mutable.rs
@@ -110,7 +110,7 @@ impl<O: Offset, M: MutableArray> MutableListArray<O, M> {
     /// Creates a new [`MutableListArray`] from a [`MutableArray`].
     pub fn new_with_field(values: M, name: &str, nullable: bool) -> Self {
         let field = Box::new(Field::new(name, values.data_type().clone(), nullable));
-        let data_type = if O::is_large() {
+        let data_type = if O::IS_LARGE {
             DataType::LargeList(field)
         } else {
             DataType::List(field)
diff --git a/src/array/ord.rs b/src/array/ord.rs
index 614f47f583..3bb02ba3e7 100644
--- a/src/array/ord.rs
+++ b/src/array/ord.rs
@@ -211,6 +211,7 @@ pub fn build_compare(left: &dyn Array, right: &dyn Array) -> Result<DynComparato
         | (Duration(Nanosecond), Duration(Nanosecond)) => compare_primitives::<i64>(left, right),
         (Float32, Float32) => compare_f32(left, right),
         (Float64, Float64) => compare_f64(left, right),
+        (Decimal(_, _), Decimal(_, _)) => compare_primitives::<i128>(left, right),
         (Utf8, Utf8) => compare_string::<i32>(left, right),
         (LargeUtf8, LargeUtf8) => compare_string::<i64>(left, right),
         (Binary, Binary) => compare_binary::<i32>(left, right),
diff --git a/src/array/utf8/fmt.rs b/src/array/utf8/fmt.rs
index 3752e2bfbd..6ea28feae1 100644
--- a/src/array/utf8/fmt.rs
+++ b/src/array/utf8/fmt.rs
@@ -12,7 +12,7 @@ impl<O: Offset> Debug for Utf8Array<O> {
     fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         let writer = |f: &mut Formatter, index| write_value(self, index, f);
 
-        let head = if O::is_large() {
+        let head = if O::IS_LARGE {
             "LargeUtf8Array"
         } else {
             "Utf8Array"
diff --git a/src/array/utf8/mod.rs b/src/array/utf8/mod.rs
index 9a75682551..f51f14d008 100644
--- a/src/array/utf8/mod.rs
+++ b/src/array/utf8/mod.rs
@@ -142,7 +142,7 @@ impl<O: Offset> Utf8Array<O> {
 
     /// Returns the default [`DataType`], `DataType::Utf8` or `DataType::LargeUtf8`
     pub fn default_data_type() -> DataType {
-        if O::is_large() {
+        if O::IS_LARGE {
             DataType::LargeUtf8
         } else {
             DataType::Utf8
diff --git a/src/array/utf8/mutable.rs b/src/array/utf8/mutable.rs
index f19e331cfa..b0824702c0 100644
--- a/src/array/utf8/mutable.rs
+++ b/src/array/utf8/mutable.rs
@@ -265,7 +265,7 @@ impl<O: Offset> MutableArray for MutableUtf8Array<O> {
     }
 
     fn data_type(&self) -> &DataType {
-        if O::is_large() {
+        if O::IS_LARGE {
             &DataType::LargeUtf8
         } else {
             &DataType::Utf8
diff --git a/src/bitmap/mod.rs b/src/bitmap/mod.rs
index 703fc1dd40..1ee5c3f301 100644
--- a/src/bitmap/mod.rs
+++ b/src/bitmap/mod.rs
@@ -9,32 +9,3 @@ mod bitmap_ops;
 pub use bitmap_ops::*;
 
 pub mod utils;
-
-#[cfg(test)]
-mod tests {
-    use super::*;
-
-    #[test]
-    fn subslicing_gives_correct_null_count() {
-        let mut base = MutableBitmap::new();
-        base.push(false);
-        base.push(true);
-        base.push(true);
-        base.push(false);
-        base.push(false);
-        base.push(true);
-        base.push(true);
-        base.push(true);
-
-        let base = Bitmap::from(base);
-        assert_eq!(base.null_count(), 3);
-
-        let view1 = base.clone().slice(0, 1);
-        let view2 = base.slice(1, 7);
-        assert_eq!(view1.null_count(), 1);
-        assert_eq!(view2.null_count(), 2);
-
-        let view3 = view2.slice(0, 1);
-        assert_eq!(view3.null_count(), 0);
-    }
-}
diff --git a/src/bitmap/utils/fmt.rs b/src/bitmap/utils/fmt.rs
index ca6b417e60..9575cf18c9 100644
--- a/src/bitmap/utils/fmt.rs
+++ b/src/bitmap/utils/fmt.rs
@@ -70,46 +70,3 @@ pub fn fmt(
     }
     f.write_char(']')
 }
-
-#[cfg(test)]
-mod tests {
-    use super::*;
-
-    struct A<'a>(&'a [u8], usize, usize);
-    impl<'a> std::fmt::Debug for A<'a> {
-        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-            fmt(self.0, self.1, self.2, f)
-        }
-    }
-
-    #[test]
-    fn test_debug() -> std::fmt::Result {
-        assert_eq!(format!("{:?}", A(&[1], 0, 0)), "[]");
-        assert_eq!(format!("{:?}", A(&[0b11000001], 0, 8)), "[0b11000001]");
-        assert_eq!(
-            format!("{:?}", A(&[0b11000001, 1], 0, 9)),
-            "[0b11000001, 0b_______1]"
-        );
-        assert_eq!(format!("{:?}", A(&[1], 0, 2)), "[0b______01]");
-        assert_eq!(format!("{:?}", A(&[1], 1, 2)), "[0b_____00_]");
-        assert_eq!(format!("{:?}", A(&[1], 2, 2)), "[0b____00__]");
-        assert_eq!(format!("{:?}", A(&[1], 3, 2)), "[0b___00___]");
-        assert_eq!(format!("{:?}", A(&[1], 4, 2)), "[0b__00____]");
-        assert_eq!(format!("{:?}", A(&[1], 5, 2)), "[0b_00_____]");
-        assert_eq!(format!("{:?}", A(&[1], 6, 2)), "[0b00______]");
-        assert_eq!(
-            format!("{:?}", A(&[0b11000001, 1], 1, 9)),
-            "[0b1100000_, 0b______01]"
-        );
-        // extra bytes are ignored
-        assert_eq!(
-            format!("{:?}", A(&[0b11000001, 1, 1, 1], 1, 9)),
-            "[0b1100000_, 0b______01]"
-        );
-        assert_eq!(
-            format!("{:?}", A(&[0b11000001, 1, 1], 2, 16)),
-            "[0b110000__, 0b00000001, 0b______01]"
-        );
-        Ok(())
-    }
-}
diff --git a/src/compute/length.rs b/src/compute/length.rs
index cd445d8f43..a8a2a530ab 100644
--- a/src/compute/length.rs
+++ b/src/compute/length.rs
@@ -35,7 +35,7 @@ where
         .map(|offset| op(offset[1] - offset[0]))
         .collect::<Vec<_>>();
 
-    let data_type = if O::is_large() {
+    let data_type = if O::IS_LARGE {
         DataType::Int64
     } else {
         DataType::Int32
diff --git a/src/scalar/binary.rs b/src/scalar/binary.rs
index 7f0d61e025..7b6c0b9824 100644
--- a/src/scalar/binary.rs
+++ b/src/scalar/binary.rs
@@ -46,7 +46,7 @@ impl<O: Offset> Scalar for BinaryScalar<O> {
 
     #[inline]
     fn data_type(&self) -> &DataType {
-        if O::is_large() {
+        if O::IS_LARGE {
             &DataType::LargeBinary
         } else {
             &DataType::Binary
diff --git a/src/scalar/utf8.rs b/src/scalar/utf8.rs
index 6626712785..3fad8a4a48 100644
--- a/src/scalar/utf8.rs
+++ b/src/scalar/utf8.rs
@@ -46,7 +46,7 @@ impl<O: Offset> Scalar for Utf8Scalar<O> {
 
     #[inline]
     fn data_type(&self) -> &DataType {
-        if O::is_large() {
+        if O::IS_LARGE {
             &DataType::LargeUtf8
         } else {
             &DataType::Utf8
diff --git a/src/types/bit_chunk.rs b/src/types/bit_chunk.rs
index 22f677aae4..030a91fcc4 100644
--- a/src/types/bit_chunk.rs
+++ b/src/types/bit_chunk.rs
@@ -103,8 +103,7 @@ impl<T: BitChunk> Iterator for BitChunkIter<T> {
 // a mathematical invariant of this iterator
 unsafe impl<T: BitChunk> crate::trusted_len::TrustedLen for BitChunkIter<T> {}
 
-/// An [`Iterator<Item=usize>`] over a [`BitChunk`].
-/// This iterator returns the postion of bit set.
+/// An [`Iterator<Item=usize>`] over a [`BitChunk`] returning the index of each bit set in the chunk
 /// Refer: https://lemire.me/blog/2018/03/08/iterating-over-set-bits-quickly-simd-edition/
 /// # Example
 /// ```
@@ -154,27 +153,3 @@ impl<T: BitChunk> Iterator for BitChunkOnes<T> {
 // # Safety
 // a mathematical invariant of this iterator
 unsafe impl<T: BitChunk> crate::trusted_len::TrustedLen for BitChunkOnes<T> {}
-
-#[cfg(test)]
-mod tests {
-    use super::*;
-
-    #[test]
-    fn test_basic1() {
-        let a = [0b00000001, 0b00010000]; // 0th and 13th entry
-        let a = u16::from_ne_bytes(a);
-        let iter = BitChunkIter::new(a, 16);
-        let r = iter.collect::<Vec<_>>();
-        assert_eq!(r, (0..16).map(|x| x == 0 || x == 12).collect::<Vec<_>>(),);
-    }
-
-    #[test]
-    fn test_ones() {
-        let a = [0b00000001, 0b00010000]; // 0th and 13th entry
-        let a = u16::from_ne_bytes(a);
-        let mut iter = BitChunkOnes::new(a);
-        assert_eq!(iter.size_hint(), (2, Some(2)));
-        assert_eq!(iter.next(), Some(0));
-        assert_eq!(iter.next(), Some(12));
-    }
-}
diff --git a/src/types/offset.rs b/src/types/offset.rs
index b4ea966130..e68bb7ceb6 100644
--- a/src/types/offset.rs
+++ b/src/types/offset.rs
@@ -4,19 +4,13 @@ use super::Index;
 /// as offsets of variable-length Arrow arrays.
 pub trait Offset: super::private::Sealed + Index {
     /// Whether it is `i32` (false) or `i64` (true).
-    fn is_large() -> bool;
+    const IS_LARGE: bool;
 }
 
 impl Offset for i32 {
-    #[inline]
-    fn is_large() -> bool {
-        false
-    }
+    const IS_LARGE: bool = false;
 }
 
 impl Offset for i64 {
-    #[inline]
-    fn is_large() -> bool {
-        true
-    }
+    const IS_LARGE: bool = true;
 }


Test patch:
diff --git a/tests/it/array/ord.rs b/tests/it/array/ord.rs
index cf2723436d..9f5a07ed83 100644
--- a/tests/it/array/ord.rs
+++ b/tests/it/array/ord.rs
@@ -2,6 +2,7 @@ use std::cmp::Ordering;
 
 use arrow2::array::ord::build_compare;
 use arrow2::array::*;
+use arrow2::datatypes::DataType;
 use arrow2::error::Result;
 
 #[test]
@@ -67,6 +68,19 @@ fn f64_zeros() -> Result<()> {
     Ok(())
 }
 
+#[test]
+fn decimal() -> Result<()> {
+    let array = Int128Array::from_slice(&[1, 2]).to(DataType::Decimal(38, 0));
+
+    let cmp = build_compare(&array, &array)?;
+
+    assert_eq!(Ordering::Less, (cmp)(0, 1));
+    assert_eq!(Ordering::Equal, (cmp)(1, 1));
+    assert_eq!(Ordering::Greater, (cmp)(1, 0));
+
+    Ok(())
+}
+
 #[test]
 fn dict_utf8() -> Result<()> {
     let data = vec!["a", "b", "c", "a", "a", "c", "c"];
diff --git a/tests/it/bitmap/mod.rs b/tests/it/bitmap/mod.rs
index 2151c7b3bb..af0c030f5c 100644
--- a/tests/it/bitmap/mod.rs
+++ b/tests/it/bitmap/mod.rs
@@ -108,3 +108,17 @@ fn not() {
     let expected = create_bitmap([0b00010101], 6);
     assert_eq!(!&lhs, expected);
 }
+
+#[test]
+fn subslicing_gives_correct_null_count() {
+    let base = Bitmap::from([false, true, true, false, false, true, true, true]);
+    assert_eq!(base.null_count(), 3);
+
+    let view1 = base.clone().slice(0, 1);
+    let view2 = base.slice(1, 7);
+    assert_eq!(view1.null_count(), 1);
+    assert_eq!(view2.null_count(), 2);
+
+    let view3 = view2.slice(0, 1);
+    assert_eq!(view3.null_count(), 0);
+}
diff --git a/tests/it/bitmap/utils/fmt.rs b/tests/it/bitmap/utils/fmt.rs
new file mode 100644
index 0000000000..36e748bfe1
--- /dev/null
+++ b/tests/it/bitmap/utils/fmt.rs
@@ -0,0 +1,40 @@
+use arrow2::bitmap::utils::fmt;
+
+struct A<'a>(&'a [u8], usize, usize);
+
+impl<'a> std::fmt::Debug for A<'a> {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        fmt(self.0, self.1, self.2, f)
+    }
+}
+
+#[test]
+fn test_debug() -> std::fmt::Result {
+    assert_eq!(format!("{:?}", A(&[1], 0, 0)), "[]");
+    assert_eq!(format!("{:?}", A(&[0b11000001], 0, 8)), "[0b11000001]");
+    assert_eq!(
+        format!("{:?}", A(&[0b11000001, 1], 0, 9)),
+        "[0b11000001, 0b_______1]"
+    );
+    assert_eq!(format!("{:?}", A(&[1], 0, 2)), "[0b______01]");
+    assert_eq!(format!("{:?}", A(&[1], 1, 2)), "[0b_____00_]");
+    assert_eq!(format!("{:?}", A(&[1], 2, 2)), "[0b____00__]");
+    assert_eq!(format!("{:?}", A(&[1], 3, 2)), "[0b___00___]");
+    assert_eq!(format!("{:?}", A(&[1], 4, 2)), "[0b__00____]");
+    assert_eq!(format!("{:?}", A(&[1], 5, 2)), "[0b_00_____]");
+    assert_eq!(format!("{:?}", A(&[1], 6, 2)), "[0b00______]");
+    assert_eq!(
+        format!("{:?}", A(&[0b11000001, 1], 1, 9)),
+        "[0b1100000_, 0b______01]"
+    );
+    // extra bytes are ignored
+    assert_eq!(
+        format!("{:?}", A(&[0b11000001, 1, 1, 1], 1, 9)),
+        "[0b1100000_, 0b______01]"
+    );
+    assert_eq!(
+        format!("{:?}", A(&[0b11000001, 1, 1], 2, 16)),
+        "[0b110000__, 0b00000001, 0b______01]"
+    );
+    Ok(())
+}
diff --git a/tests/it/bitmap/utils/mod.rs b/tests/it/bitmap/utils/mod.rs
index e92f31124c..1ebce6f7f8 100644
--- a/tests/it/bitmap/utils/mod.rs
+++ b/tests/it/bitmap/utils/mod.rs
@@ -6,6 +6,7 @@ use crate::bitmap::bitmap_strategy;
 
 mod bit_chunks_exact;
 mod chunk_iter;
+mod fmt;
 mod iterator;
 mod slice_iterator;
 mod zip_validity;
diff --git a/tests/it/compute/length.rs b/tests/it/compute/length.rs
index 73d36fc68d..9bb3757695 100644
--- a/tests/it/compute/length.rs
+++ b/tests/it/compute/length.rs
@@ -15,7 +15,7 @@ fn length_test_string<O: Offset>() {
         let array = Utf8Array::<O>::from(&input);
         let result = length(&array).unwrap();
 
-        let data_type = if O::is_large() {
+        let data_type = if O::IS_LARGE {
             DataType::Int64
         } else {
             DataType::Int32
diff --git a/tests/it/main.rs b/tests/it/main.rs
index 96515ebaf6..4c9448ea81 100644
--- a/tests/it/main.rs
+++ b/tests/it/main.rs
@@ -4,6 +4,7 @@ mod buffer;
 mod ffi;
 mod scalar;
 mod temporal_conversions;
+mod types;
 
 mod io;
 mod test_util;
diff --git a/tests/it/types.rs b/tests/it/types.rs
new file mode 100644
index 0000000000..7dfa07cc16
--- /dev/null
+++ b/tests/it/types.rs
@@ -0,0 +1,20 @@
+use arrow2::types::{BitChunkIter, BitChunkOnes};
+
+#[test]
+fn test_basic1() {
+    let a = [0b00000001, 0b00010000]; // 0th and 13th entry
+    let a = u16::from_ne_bytes(a);
+    let iter = BitChunkIter::new(a, 16);
+    let r = iter.collect::<Vec<_>>();
+    assert_eq!(r, (0..16).map(|x| x == 0 || x == 12).collect::<Vec<_>>(),);
+}
+
+#[test]
+fn test_ones() {
+    let a = [0b00000001, 0b00010000]; // 0th and 13th entry
+    let a = u16::from_ne_bytes(a);
+    let mut iter = BitChunkOnes::new(a);
+    assert_eq!(iter.size_hint(), (2, Some(2)));
+    assert_eq!(iter.next(), Some(0));
+    assert_eq!(iter.next(), Some(12));
+}