Skip to content

Commit

Permalink
Expose boolean builder contents
Browse files Browse the repository at this point in the history
  • Loading branch information
HadrienG2 committed May 13, 2024
1 parent 1c86921 commit f14bfbe
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, so to read the i-th boolean,
/// you must compute `values_slice[i / 8] & (1 << (i % 8)) == 0`.
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 f14bfbe

Please sign in to comment.