Struct re_sdk::external::arrow2::array::UnionArray
pub struct UnionArray {
types: Buffer<i8>,
map: Option<[usize; 127]>,
fields: Vec<Box<dyn Array>>,
offsets: Option<Buffer<i32>>,
data_type: DataType,
offset: usize,
}
Expand description
UnionArray
represents an array whose each slot can contain different values.
Fields§
§types: Buffer<i8>
§map: Option<[usize; 127]>
§fields: Vec<Box<dyn Array>>
§offsets: Option<Buffer<i32>>
§data_type: DataType
§offset: usize
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<Box<dyn Array>>,
offsets: Option<Buffer<i32>>
) -> Result<UnionArray, Error>
pub fn try_new( data_type: DataType, types: Buffer<i8>, fields: Vec<Box<dyn Array>>, offsets: Option<Buffer<i32>> ) -> Result<UnionArray, Error>
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 - The number of
fields
is larger thani8::MAX
- 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<Box<dyn Array>>,
offsets: Option<Buffer<i32>>
) -> UnionArray
pub fn new( data_type: DataType, types: Buffer<i8>, fields: Vec<Box<dyn Array>>, 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 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(&mut self, offset: usize, length: usize)
pub fn slice(&mut self, offset: usize, length: usize)
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(&mut self, offset: usize, length: usize)
pub unsafe fn slice_unchecked(&mut self, offset: usize, length: usize)
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()
.
pub fn sliced(self, offset: usize, length: usize) -> UnionArray
pub fn sliced(self, offset: usize, length: usize) -> UnionArray
pub unsafe fn sliced_unchecked(self, offset: usize, length: usize) -> UnionArray
pub unsafe fn sliced_unchecked(self, offset: usize, length: usize) -> UnionArray
pub fn boxed(self) -> Box<dyn Array>
pub fn boxed(self) -> Box<dyn Array>
Boxes this array into a Box<dyn Array>
.
pub fn arced(self) -> Arc<dyn Array>
pub fn arced(self) -> Arc<dyn Array>
Arcs this array into a std::sync::Arc<dyn Array>
.
§impl UnionArray
impl UnionArray
pub fn index(&self, index: usize) -> (usize, usize)
pub fn index(&self, index: usize) -> (usize, usize)
Returns the index and slot of the field to select from self.fields
.
pub unsafe fn index_unchecked(&self, index: usize) -> (usize, usize)
pub unsafe fn index_unchecked(&self, index: usize) -> (usize, usize)
Returns the index and slot of the field to select from self.fields
.
The first value is guaranteed to be < self.fields().len()
§Safety
This function is safe iff index < self.len
.
§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 Arrow2Arrow for UnionArray
impl Arrow2Arrow for UnionArray
§impl Array for UnionArray
impl Array for UnionArray
§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Any
, which enables downcasting to concrete types.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Any
, which enables mutable downcasting to concrete types.§fn len(&self) -> usize
fn len(&self) -> usize
Array
. Every array has a length corresponding to the number of
elements (slots).§fn data_type(&self) -> &DataType
fn data_type(&self) -> &DataType
DataType
of the Array
. In combination with Array::as_any
, this can be
used to downcast trait objects (dyn Array
) to concrete arrays.§fn null_count(&self) -> usize
fn null_count(&self) -> usize
§unsafe fn is_null_unchecked(&self, i: usize) -> bool
unsafe fn is_null_unchecked(&self, i: usize) -> bool
i
is null. Read more§impl Clone for UnionArray
impl Clone for UnionArray
§fn clone(&self) -> UnionArray
fn clone(&self) -> UnionArray
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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
§impl<'a> IntoIterator for &'a UnionArray
impl<'a> IntoIterator for &'a UnionArray
§impl PartialEq<&(dyn Array + 'static)> for UnionArray
impl PartialEq<&(dyn Array + 'static)> for UnionArray
§impl PartialEq for UnionArray
impl PartialEq for UnionArray
§fn eq(&self, other: &UnionArray) -> bool
fn eq(&self, other: &UnionArray) -> bool
self
and other
values to be equal, and is used
by ==
.Auto Trait Implementations§
impl Freeze for UnionArray
impl !RefUnwindSafe for UnionArray
impl Send for UnionArray
impl Sync for UnionArray
impl Unpin for UnionArray
impl !UnwindSafe for UnionArray
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more