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
impl ShreddedVariantFieldArray
Sourcepub fn try_new(inner: &dyn Array) -> Result<Self, ArrowError>
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
-
An optional field named
value
that is binary, large_binary, or binary_view -
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.
Sourcepub fn shredding_state(&self) -> &ShreddingState
pub fn shredding_state(&self) -> &ShreddingState
Return the shredding state of this VariantArray
Sourcepub fn value_field(&self) -> Option<&BinaryViewArray>
pub fn value_field(&self) -> Option<&BinaryViewArray>
Return a reference to the value field of the StructArray
Sourcepub fn typed_value_field(&self) -> Option<&ArrayRef>
pub fn typed_value_field(&self) -> Option<&ArrayRef>
Return a reference to the typed_value field of the StructArray
, if present
pub(crate) fn from_parts( value: Option<BinaryViewArray>, typed_value: Option<ArrayRef>, nulls: Option<NullBuffer>, ) -> Self
Sourcepub fn into_inner(self) -> StructArray
pub fn into_inner(self) -> StructArray
Returns the inner [StructArray
], consuming self