Skip to content

Commit

Permalink
Expose boolean builder contents (#5760)
Browse files Browse the repository at this point in the history
* Expose boolean builder contents

* Suggest using arrow-provided utility for boolean unpacking
  • Loading branch information
HadrienG2 committed May 14, 2024
1 parent 7d465b8 commit 78bda14
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions arrow-array/src/builder/boolean_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,14 @@ impl BooleanBuilder {
BooleanArray::from(array_data)
}

/// Returns the current values buffer as a slice
///
/// Boolean values are bit-packed into bytes. To extract the i-th boolean
/// from the bytes, you can use `arrow_buffer::bit_util::get_bit()`.
pub fn values_slice(&self) -> &[u8] {
self.values_builder.as_slice()
}

/// Returns the current null buffer as a slice
pub fn validity_slice(&self) -> Option<&[u8]> {
self.null_buffer_builder.as_slice()
Expand Down

0 comments on commit 78bda14

Please sign in to comment.