Skip to content

Commit cd23309

Browse files
committed
mod comment
Signed-off-by: Andrew Duffy <andrew@a10y.dev>
1 parent 932055e commit cd23309

File tree

2 files changed

+40
-11
lines changed

2 files changed

+40
-11
lines changed

encodings/bytebool/public-api.lock

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,11 @@ impl vortex_bytebool::ByteBoolData
7878

7979
pub fn vortex_bytebool::ByteBoolData::buffer(&self) -> &vortex_array::buffer::BufferHandle
8080

81-
pub fn vortex_bytebool::ByteBoolData::from_vec<V: core::convert::Into<vortex_array::validity::Validity>>(data: alloc::vec::Vec<bool>, validity: V) -> Self
82-
8381
pub fn vortex_bytebool::ByteBoolData::is_empty(&self) -> bool
8482

8583
pub fn vortex_bytebool::ByteBoolData::len(&self) -> usize
8684

87-
pub fn vortex_bytebool::ByteBoolData::new(buffer: vortex_array::buffer::BufferHandle, validity: vortex_array::validity::Validity) -> Self
85+
pub fn vortex_bytebool::ByteBoolData::new(buffer: vortex_array::buffer::BufferHandle) -> Self
8886

8987
pub fn vortex_bytebool::ByteBoolData::truthy_bytes(&self) -> &[u8]
9088

@@ -94,14 +92,6 @@ impl core::clone::Clone for vortex_bytebool::ByteBoolData
9492

9593
pub fn vortex_bytebool::ByteBoolData::clone(&self) -> vortex_bytebool::ByteBoolData
9694

97-
impl core::convert::From<alloc::vec::Vec<bool>> for vortex_bytebool::ByteBoolData
98-
99-
pub fn vortex_bytebool::ByteBoolData::from(value: alloc::vec::Vec<bool>) -> Self
100-
101-
impl core::convert::From<alloc::vec::Vec<core::option::Option<bool>>> for vortex_bytebool::ByteBoolData
102-
103-
pub fn vortex_bytebool::ByteBoolData::from(value: alloc::vec::Vec<core::option::Option<bool>>) -> Self
104-
10595
impl core::fmt::Debug for vortex_bytebool::ByteBoolData
10696

10797
pub fn vortex_bytebool::ByteBoolData::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result

encodings/bytebool/src/lib.rs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,45 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

4+
//! A Vortex encoding that mirrors Arrow's [8-bit Boolean canonical extension type][spec].
5+
//!
6+
//! Each element is stored as a single byte. The zero byte represents `false` and any
7+
//! non-zero byte represents `true`, matching the truthy semantics of the Arrow spec. This
8+
//! trades 8x the storage of the bit-packed `Bool` layout for cheaper per-byte access —
9+
//! useful when data arrives from a C ABI or other source that already emits byte-wide
10+
//! booleans. On execution the array materializes into the standard bit-packed
11+
//! [`BoolArray`][vortex_array::arrays::BoolArray].
12+
//!
13+
//! # Examples
14+
//!
15+
//! Any non-zero byte in the backing buffer is treated as `true` when the array executes
16+
//! to a canonical [`BoolArray`][vortex_array::arrays::BoolArray]:
17+
//!
18+
//! ```
19+
//! # use vortex_array::{IntoArray, LEGACY_SESSION, VortexSessionExecute};
20+
//! # use vortex_array::arrays::BoolArray;
21+
//! # use vortex_array::arrays::bool::BoolArrayExt;
22+
//! # use vortex_array::buffer::BufferHandle;
23+
//! # use vortex_array::validity::Validity;
24+
//! # use vortex_buffer::ByteBuffer;
25+
//! # use vortex_bytebool::ByteBool;
26+
//! # use vortex_error::VortexResult;
27+
//! # fn main() -> VortexResult<()> {
28+
//! # let mut ctx = LEGACY_SESSION.create_execution_ctx();
29+
//! let handle = BufferHandle::new_host(ByteBuffer::from(vec![0u8, 1, 42, 0]));
30+
//! let array = ByteBool::new(handle, Validity::NonNullable);
31+
//!
32+
//! let bits = array.into_array().execute::<BoolArray>(&mut ctx)?.to_bit_buffer();
33+
//! assert!(!bits.value(0));
34+
//! assert!(bits.value(1));
35+
//! assert!(bits.value(2)); // byte 42 is truthy
36+
//! assert!(!bits.value(3));
37+
//! # Ok(())
38+
//! # }
39+
//! ```
40+
//!
41+
//! [spec]: https://arrow.apache.org/docs/format/CanonicalExtensions.html#bit-boolean
42+
443
pub use array::*;
544

645
mod array;

0 commit comments

Comments
 (0)