diff --git a/arrow/src/array/builder.rs b/arrow/src/array/builder.rs index 00317e6622e1..97403c144f4a 100644 --- a/arrow/src/array/builder.rs +++ b/arrow/src/array/builder.rs @@ -329,7 +329,7 @@ impl BooleanBufferBuilder { } #[inline] - pub fn get_bit(&mut self, index: usize) -> bool { + pub fn get_bit(&self, index: usize) -> bool { bit_util::get_bit(self.buffer.as_slice(), index) } @@ -2551,6 +2551,17 @@ mod tests { assert!(buffer.get_bit(0)); } + #[test] + fn test_bool_buffer_builder_get_first_bit_not_requires_mutability() { + let buffer = { + let mut buffer = BooleanBufferBuilder::new(16); + buffer.append_n(8, true); + buffer + }; + + assert!(buffer.get_bit(0)); + } + #[test] fn test_bool_buffer_builder_get_last_bit() { let mut buffer = BooleanBufferBuilder::new(16);