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
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.
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_dictionary_offset(&self) -> Result<()>
Trait Implementations
sourceimpl<OffsetSize: OffsetSizeTrait> From<ArrayData> for GenericBinaryArray<OffsetSize>
impl<OffsetSize: OffsetSizeTrait> From<ArrayData> for GenericBinaryArray<OffsetSize>
sourceimpl<OffsetSize: OffsetSizeTrait> From<ArrayData> for GenericStringArray<OffsetSize>
impl<OffsetSize: OffsetSizeTrait> From<ArrayData> for GenericStringArray<OffsetSize>
sourceimpl From<ArrayData> for StructArray
impl From<ArrayData> for StructArray
sourceimpl From<ArrayData> for UnionArray
impl From<ArrayData> for UnionArray
sourceimpl From<ArrayData> for FixedSizeBinaryArray
impl From<ArrayData> for FixedSizeBinaryArray
sourceimpl From<ArrayData> for DecimalArray
impl From<ArrayData> for DecimalArray
sourceimpl From<ArrayData> for BooleanArray
impl From<ArrayData> for BooleanArray
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<OffsetSize: OffsetSizeTrait> From<ArrayData> for GenericListArray<OffsetSize>
impl<OffsetSize: OffsetSizeTrait> From<ArrayData> for GenericListArray<OffsetSize>
sourceimpl From<ArrayData> for FixedSizeListArray
impl From<ArrayData> for FixedSizeListArray
sourceimpl<T: ArrowPrimitiveType> From<ArrayData> for PrimitiveArray<T>
impl<T: ArrowPrimitiveType> From<ArrayData> for PrimitiveArray<T>
Constructs a PrimitiveArray
from an array data reference.
sourceimpl From<DecimalArray> for ArrayData
impl From<DecimalArray> for ArrayData
sourcefn from(array: DecimalArray) -> Self
fn from(array: DecimalArray) -> Self
Converts to this type from the input type.
sourceimpl TryFrom<ArrayData> for ArrowArray
impl TryFrom<ArrayData> for ArrowArray
sourceimpl TryFrom<ArrowArray> for ArrayData
impl TryFrom<ArrowArray> for ArrayData
type Error = ArrowError
type Error = ArrowError
The type returned in the event of a conversion error.
sourcefn try_from(value: ArrowArray) -> Result<Self>
fn try_from(value: ArrowArray) -> Result<Self>
Performs the conversion.
Auto Trait Implementations
impl RefUnwindSafe for ArrayData
impl Send for ArrayData
impl Sync for ArrayData
impl Unpin for ArrayData
impl UnwindSafe for ArrayData
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more