Skip to content

Commit 78bda14

Browse files
authored
Expose boolean builder contents (#5760)
* Expose boolean builder contents * Suggest using arrow-provided utility for boolean unpacking
1 parent 7d465b8 commit 78bda14

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

arrow-array/src/builder/boolean_builder.rs

+8
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,14 @@ impl BooleanBuilder {
166166
BooleanArray::from(array_data)
167167
}
168168

169+
/// Returns the current values buffer as a slice
170+
///
171+
/// Boolean values are bit-packed into bytes. To extract the i-th boolean
172+
/// from the bytes, you can use `arrow_buffer::bit_util::get_bit()`.
173+
pub fn values_slice(&self) -> &[u8] {
174+
self.values_builder.as_slice()
175+
}
176+
169177
/// Returns the current null buffer as a slice
170178
pub fn validity_slice(&self) -> Option<&[u8]> {
171179
self.null_buffer_builder.as_slice()

0 commit comments

Comments
 (0)