pub struct ArrayData { /* private fields */ }
Expand description
An generic representation of Arrow array data which encapsulates common attributes and
operations for Arrow array. Specific operations for different arrays types (e.g.,
primitive, list, struct) are implemented in Array
.
Implementations
sourceimpl ArrayData
impl ArrayData
sourcepub unsafe fn new_unchecked(
data_type: DataType,
len: usize,
null_count: Option<usize>,
null_bit_buffer: Option<Buffer>,
offset: usize,
buffers: Vec<Buffer>,
child_data: Vec<ArrayData>
) -> Self
pub unsafe fn new_unchecked(
data_type: DataType,
len: usize,
null_count: Option<usize>,
null_bit_buffer: Option<Buffer>,
offset: usize,
buffers: Vec<Buffer>,
child_data: Vec<ArrayData>
) -> Self
Create a new ArrayData instance;
If null_count
is not specified, the number of nulls in
null_bit_buffer is calculated.
If the number of nulls is 0 then the null_bit_buffer
is set to None
.
Safety
The input values must form a valid Arrow array for
data_type
, or undefined behavior can results.
Note: This is a low level API and most users of the arrow
crate should create arrays using the methods in the array
module.
sourcepub fn try_new(
data_type: DataType,
len: usize,
null_bit_buffer: Option<Buffer>,
offset: usize,
buffers: Vec<Buffer>,
child_data: Vec<ArrayData>
) -> Result<Self>
pub fn try_new(
data_type: DataType,
len: usize,
null_bit_buffer: Option<Buffer>,
offset: usize,
buffers: Vec<Buffer>,
child_data: Vec<ArrayData>
) -> Result<Self>
Create a new ArrayData, validating that the provided buffers form a valid Arrow array of the specified data type.
If the number of nulls in null_bit_buffer
is 0 then the null_bit_buffer
is set to None
.
Note: This is a low level API and most users of the arrow
crate should create arrays using the methods in the array
module.
sourcepub const fn builder(data_type: DataType) -> ArrayDataBuilder
pub const fn builder(data_type: DataType) -> ArrayDataBuilder
Returns a builder to construct a ArrayData
instance.
sourcepub const fn data_type(&self) -> &DataType
pub const fn data_type(&self) -> &DataType
Returns a reference to the data type of this array data
sourcepub fn child_data(&self) -> &[ArrayData]
pub fn child_data(&self) -> &[ArrayData]
Returns a slice of children data arrays
sourcepub const fn null_bitmap(&self) -> Option<&Bitmap>
pub const fn null_bitmap(&self) -> Option<&Bitmap>
Returns a reference to the null bitmap of this array data
sourcepub fn null_buffer(&self) -> Option<&Buffer>
pub fn null_buffer(&self) -> Option<&Buffer>
Returns a reference to the null buffer of this array data.
pub const fn is_empty(&self) -> bool
sourcepub const fn null_count(&self) -> usize
pub const fn null_count(&self) -> usize
Returns the total number of nulls in this array
sourcepub fn get_buffer_memory_size(&self) -> usize
pub fn get_buffer_memory_size(&self) -> usize
Returns the total number of bytes of memory occupied by the buffers owned by this ArrayData.
sourcepub fn get_array_memory_size(&self) -> usize
pub fn get_array_memory_size(&self) -> usize
Returns the total number of bytes of memory occupied physically by this ArrayData.
sourcepub fn new_empty(data_type: &DataType) -> Self
pub fn new_empty(data_type: &DataType) -> Self
Returns a new empty ArrayData valid for data_type
.
sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
“cheap” validation of an ArrayData
. Ensures buffers are
sufficiently sized to store len
+ offset
total elements of
data_type
and performs other inexpensive consistency checks.
This check is “cheap” in the sense that it does not validate the contents of the buffers (e.g. that all offsets for UTF8 arrays are within the bounds of the values buffer).
See ArrayData::validate_full to validate fully the offset content and the validitiy of utf8 data
sourcepub fn validate_full(&self) -> Result<()>
pub fn validate_full(&self) -> Result<()>
“expensive” validation that ensures:
- Null count is correct
- All offsets are valid
- All String data is valid UTF-8
- All dictionary offsets are valid
Does not (yet) check
- Union type_ids are valid see #85
Note calls
validate()
internally
pub fn validate_values(&self) -> Result<()>
sourcepub fn ptr_eq(&self, other: &Self) -> bool
pub fn ptr_eq(&self, other: &Self) -> bool
Returns true if this ArrayData
is equal to other
, using pointer comparisons
to determine buffer equality. This is cheaper than PartialEq::eq
but may
return false when the arrays are logically equal
sourcepub fn into_builder(self) -> ArrayDataBuilder
pub fn into_builder(self) -> ArrayDataBuilder
Converts this ArrayData
into an ArrayDataBuilder
Trait Implementations
sourceimpl From<ArrayData> for ArrayDataBuilder
impl From<ArrayData> for ArrayDataBuilder
sourceimpl From<ArrayData> for BooleanArray
impl From<ArrayData> for BooleanArray
sourceimpl<T: DecimalType> From<ArrayData> for DecimalArray<T>
impl<T: DecimalType> From<ArrayData> for DecimalArray<T>
sourceimpl<T: ArrowPrimitiveType> From<ArrayData> for DictionaryArray<T>
impl<T: ArrowPrimitiveType> From<ArrayData> for DictionaryArray<T>
Constructs a DictionaryArray
from an array data reference.
sourceimpl From<ArrayData> for FixedSizeBinaryArray
impl From<ArrayData> for FixedSizeBinaryArray
sourceimpl From<ArrayData> for FixedSizeListArray
impl From<ArrayData> for FixedSizeListArray
sourceimpl<OffsetSize: OffsetSizeTrait> From<ArrayData> for GenericBinaryArray<OffsetSize>
impl<OffsetSize: OffsetSizeTrait> From<ArrayData> for GenericBinaryArray<OffsetSize>
sourceimpl<OffsetSize: OffsetSizeTrait> From<ArrayData> for GenericListArray<OffsetSize>
impl<OffsetSize: OffsetSizeTrait> From<ArrayData> for GenericListArray<OffsetSize>
sourceimpl<OffsetSize: OffsetSizeTrait> From<ArrayData> for GenericStringArray<OffsetSize>
impl<OffsetSize: OffsetSizeTrait> From<ArrayData> for GenericStringArray<OffsetSize>
sourceimpl<T: ArrowPrimitiveType> From<ArrayData> for PrimitiveArray<T>
impl<T: ArrowPrimitiveType> From<ArrayData> for PrimitiveArray<T>
Constructs a PrimitiveArray
from an array data reference.