ShreddedVariantFieldArray

Struct ShreddedVariantFieldArray 

Source
pub struct ShreddedVariantFieldArray {
    inner: StructArray,
    shredding_state: ShreddingState,
}
Expand description

One shredded field of a partially or prefectly shredded variant. For example, suppose the shredding schema for variant v treats it as an object with a single field a, where a is itself a struct with the single field b of type INT. Then the physical layout of the column is:

v: VARIANT {
    metadata: BINARY,
    value: BINARY,
    typed_value: STRUCT {
        a: SHREDDED_VARIANT_FIELD {
            value: BINARY,
            typed_value: STRUCT {
                a: SHREDDED_VARIANT_FIELD {
                    value: BINARY,
                    typed_value: INT,
                },
            },
        },
    },
}

In the above, each row of v.value is either a variant value (shredding failed, v was not an object at all) or a variant object (partial shredding, v was an object but included unexpected fields other than a), or is NULL (perfect shredding, v was an object containing only the single expected field a).

A similar story unfolds for each v.typed_value.a.value – a variant value if shredding failed (v:a was not an object at all), or a variant object (v:a was an object with unexpected additional fields), or NULL (v:a was an object containing only the single expected field b).

Finally, v.typed_value.a.typed_value.b.value is either NULL (v:a.b was an integer) or else a variant value (which could be Variant::Null).

Fields§

§inner: StructArray

Reference to the underlying StructArray

§shredding_state: ShreddingState

Implementations§

Source§

impl ShreddedVariantFieldArray

Source

pub fn try_new(inner: &dyn Array) -> Result<Self, ArrowError>

Creates a new ShreddedVariantFieldArray from a [StructArray].

§Arguments
  • inner - The underlying [StructArray] that contains the variant data.
§Returns
  • A new instance of ShreddedVariantFieldArray.
§Errors:
  • If the StructArray does not contain the required fields
§Requirements of the StructArray
  1. An optional field named value that is binary, large_binary, or binary_view

  2. An optional field named typed_value which can be any primitive type or be a list, large_list, list_view or struct

Currently, only value columns of type [BinaryViewArray] are supported.

Source

pub fn shredding_state(&self) -> &ShreddingState

Return the shredding state of this VariantArray

Source

pub fn value_field(&self) -> Option<&BinaryViewArray>

Return a reference to the value field of the StructArray

Source

pub fn typed_value_field(&self) -> Option<&ArrayRef>

Return a reference to the typed_value field of the StructArray, if present

Source

pub fn inner(&self) -> &StructArray

Returns a reference to the underlying [StructArray].

Source

pub(crate) fn from_parts( value: Option<BinaryViewArray>, typed_value: Option<ArrayRef>, nulls: Option<NullBuffer>, ) -> Self

Source

pub fn into_inner(self) -> StructArray

Returns the inner [StructArray], consuming self

Source

pub fn data_type(&self) -> &DataType

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn offset(&self) -> usize

Source

pub fn nulls(&self) -> Option<&NullBuffer>

Source

pub fn is_null(&self, index: usize) -> bool

Is the element at index null?

Source

pub fn is_valid(&self, index: usize) -> bool

Is the element at index valid (not null)?

Trait Implementations§

Source§

impl Debug for ShreddedVariantFieldArray

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<ShreddedVariantFieldArray> for ArrayRef

Source§

fn from(array: ShreddedVariantFieldArray) -> Self

Converts to this type from the input type.
Source§

impl From<ShreddedVariantFieldArray> for StructArray

Source§

fn from(array: ShreddedVariantFieldArray) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> Ungil for T
where T: Send,