pub struct UnionArray { /* private fields */ }
Expand description
UnionArray
represents an array whose each slot can contain different values.
Implementations
impl<'a> UnionArray
impl<'a> UnionArray
pub fn iter(&'a self) -> UnionIter<'a>
pub fn iter(&'a self) -> UnionIter<'a>
constructs a new iterator
impl UnionArray
impl UnionArray
pub fn try_new(
data_type: DataType,
types: Buffer<i8>,
fields: Vec<Arc<dyn Array + 'static>, Global>,
offsets: Option<Buffer<i32>>
) -> Result<UnionArray, ArrowError>
pub fn try_new(
data_type: DataType,
types: Buffer<i8>,
fields: Vec<Arc<dyn Array + 'static>, Global>,
offsets: Option<Buffer<i32>>
) -> Result<UnionArray, ArrowError>
Returns a new UnionArray
.
Errors
This function errors iff:
data_type
’s physical type is notcrate::datatypes::PhysicalType::Union
.- the fields’s len is different from the
data_type
’s children’s length - any of the values’s data type is different from its corresponding children’ data type
pub fn new(
data_type: DataType,
types: Buffer<i8>,
fields: Vec<Arc<dyn Array + 'static>, Global>,
offsets: Option<Buffer<i32>>
) -> UnionArray
pub fn new(
data_type: DataType,
types: Buffer<i8>,
fields: Vec<Arc<dyn Array + 'static>, Global>,
offsets: Option<Buffer<i32>>
) -> UnionArray
Returns a new UnionArray
.
Panics
This function panics iff:
data_type
’s physical type is notcrate::datatypes::PhysicalType::Union
.- the fields’s len is different from the
data_type
’s children’s length - any of the values’s data type is different from its corresponding children’ data type
pub fn from_data(
data_type: DataType,
types: Buffer<i8>,
fields: Vec<Arc<dyn Array + 'static>, Global>,
offsets: Option<Buffer<i32>>
) -> UnionArray
pub fn from_data(
data_type: DataType,
types: Buffer<i8>,
fields: Vec<Arc<dyn Array + 'static>, Global>,
offsets: Option<Buffer<i32>>
) -> UnionArray
Alias for new
pub fn new_null(data_type: DataType, length: usize) -> UnionArray
pub fn new_null(data_type: DataType, length: usize) -> UnionArray
Creates a new null UnionArray
.
pub fn new_empty(data_type: DataType) -> UnionArray
pub fn new_empty(data_type: DataType) -> UnionArray
Creates a new empty UnionArray
.
impl UnionArray
impl UnionArray
pub fn slice(&self, offset: usize, length: usize) -> UnionArray
pub fn slice(&self, offset: usize, length: usize) -> UnionArray
Returns a slice of this UnionArray
.
Implementation
This operation is O(F)
where F
is the number of fields.
Panic
This function panics iff offset + length >= self.len()
.
pub unsafe fn slice_unchecked(&self, offset: usize, length: usize) -> UnionArray
pub unsafe fn slice_unchecked(&self, offset: usize, length: usize) -> UnionArray
Returns a slice of this UnionArray
.
Implementation
This operation is O(F)
where F
is the number of fields.
Safety
The caller must ensure that offset + length <= self.len()
.
impl UnionArray
impl UnionArray
impl UnionArray
impl UnionArray
pub fn get_fields(data_type: &DataType) -> &[Field]
pub fn get_fields(data_type: &DataType) -> &[Field]
Returns all fields from DataType::Union
.
Panic
Panics iff data_type
’s logical type is not DataType::Union
.
pub fn is_sparse(data_type: &DataType) -> bool
pub fn is_sparse(data_type: &DataType) -> bool
Returns whether the DataType::Union
is sparse or not.
Panic
Panics iff data_type
’s logical type is not DataType::Union
.
Trait Implementations
impl Array for UnionArray
impl Array for UnionArray
fn data_type(&self) -> &DataType
fn data_type(&self) -> &DataType
The DataType
of the Array
. In combination with Array::as_any
, this can be
used to downcast trait objects (dyn Array
) to concrete arrays. Read more
fn to_boxed(&self) -> Box<dyn Array + 'static, Global>
fn to_boxed(&self) -> Box<dyn Array + 'static, Global>
Clone a &dyn Array
to an owned Box<dyn Array>
.
fn null_count(&self) -> usize
fn null_count(&self) -> usize
impl Clone for UnionArray
impl Clone for UnionArray
fn clone(&self) -> UnionArray
fn clone(&self) -> UnionArray
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for UnionArray
impl Debug for UnionArray
impl<'a> From<GrowableUnion<'a>> for UnionArray
impl<'a> From<GrowableUnion<'a>> for UnionArray
fn from(val: GrowableUnion<'a>) -> UnionArray
fn from(val: GrowableUnion<'a>) -> UnionArray
Converts to this type from the input type.
impl<'a> IntoIterator for &'a UnionArray
impl<'a> IntoIterator for &'a UnionArray
type IntoIter = UnionIter<'a>
type IntoIter = UnionIter<'a>
Which kind of iterator are we turning this into?
fn into_iter(self) -> <&'a UnionArray as IntoIterator>::IntoIter
fn into_iter(self) -> <&'a UnionArray as IntoIterator>::IntoIter
Creates an iterator from a value. Read more
impl<'_> PartialEq<&'_ (dyn Array + '_)> for UnionArray
impl<'_> PartialEq<&'_ (dyn Array + '_)> for UnionArray
impl PartialEq<UnionArray> for UnionArray
impl PartialEq<UnionArray> for UnionArray
Auto Trait Implementations
impl !RefUnwindSafe for UnionArray
impl Send for UnionArray
impl Sync for UnionArray
impl Unpin for UnionArray
impl !UnwindSafe for UnionArray
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
impl<T> Pointable for T
impl<T> Pointable for T
impl<A> PolarsArray for A where
A: Array + ?Sized,
impl<A> PolarsArray for A where
A: Array + ?Sized,
fn has_validity(&self) -> bool
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