Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions arrow-array/src/builder/generic_bytes_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,16 +231,31 @@ impl<T: ByteArrayType> GenericByteBuilder<T> {
self.value_builder.as_slice()
}

/// Returns the current values buffer capacity, in bytes.
pub fn values_capacity(&self) -> usize {
self.value_builder.capacity()
}

/// Returns the current offsets buffer as a slice
pub fn offsets_slice(&self) -> &[T::Offset] {
self.offsets_builder.as_slice()
}

/// Returns the current offsets buffer capacity, in offsets.
pub fn offsets_capacity(&self) -> usize {
self.offsets_builder.capacity()
}

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

/// Returns the current null buffer allocated capacity, in bytes.
pub fn validity_capacity(&self) -> usize {
self.null_buffer_builder.allocated_size()
}

/// Returns the current null buffer as a mutable slice
pub fn validity_slice_mut(&mut self) -> Option<&mut [u8]> {
self.null_buffer_builder.as_slice_mut()
Expand Down
10 changes: 10 additions & 0 deletions arrow-array/src/builder/generic_list_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,20 @@ where
self.offsets_builder.as_slice()
}

/// Returns the current offsets buffer capacity, in offsets.
pub fn offsets_capacity(&self) -> usize {
self.offsets_builder.capacity()
}

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

/// Returns the current null buffer allocated capacity, in bytes.
pub fn validity_capacity(&self) -> usize {
self.null_buffer_builder.allocated_size()
}
}

impl<O, B, V, E> Extend<Option<V>> for GenericListBuilder<O, B>
Expand Down
5 changes: 5 additions & 0 deletions arrow-array/src/builder/primitive_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,11 @@ impl<T: ArrowPrimitiveType> PrimitiveBuilder<T> {
self.null_buffer_builder.as_slice()
}

/// Returns the current null buffer allocated capacity, in bytes.
pub fn validity_capacity(&self) -> usize {
self.null_buffer_builder.allocated_size()
}

/// Returns the current null buffer as a mutable slice
pub fn validity_slice_mut(&mut self) -> Option<&mut [u8]> {
self.null_buffer_builder.as_slice_mut()
Expand Down
5 changes: 5 additions & 0 deletions arrow-array/src/builder/struct_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,11 @@ impl StructBuilder {
pub fn validity_slice(&self) -> Option<&[u8]> {
self.null_buffer_builder.as_slice()
}

/// Returns the current null buffer allocated capacity, in bytes.
pub fn validity_capacity(&self) -> usize {
self.null_buffer_builder.allocated_size()
}
}

#[cfg(test)]
Expand Down
Loading