You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by tu...@apache.org on 2024/05/14 08:28:09 UTC
(arrow-rs) branch master updated: Expose boolean builder contents (#5760)
This is an automated email from the ASF dual-hosted git repository.
tustvold pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/master by this push:
new 78bda14f4ca Expose boolean builder contents (#5760)
78bda14f4ca is described below
commit 78bda14f4ca93e85db6a4302c1a0d265f6d5e40c
Author: Hadrien G <kn...@gmx.com>
AuthorDate: Tue May 14 10:28:01 2024 +0200
Expose boolean builder contents (#5760)
* Expose boolean builder contents
* Suggest using arrow-provided utility for boolean unpacking
---
arrow-array/src/builder/boolean_builder.rs | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arrow-array/src/builder/boolean_builder.rs b/arrow-array/src/builder/boolean_builder.rs
index a4bda89d52e..3a2caf80cff 100644
--- a/arrow-array/src/builder/boolean_builder.rs
+++ b/arrow-array/src/builder/boolean_builder.rs
@@ -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()