Class VariantArray
Extension array for Parquet Variant values, backed by a StructArray containing "metadata" and "value" binary fields.
public class VariantArray : ExtensionArray, IArrowArray, IDisposable, IReadOnlyList<VariantValue>, IReadOnlyCollection<VariantValue>, IEnumerable<VariantValue>, IEnumerable
- Inheritance
-
VariantArray
- Implements
- Inherited Members
- Extension Methods
Constructors
VariantArray(IArrowArray)
public VariantArray(IArrowArray storage)
Parameters
storageIArrowArray
VariantArray(VariantType, IArrowArray)
public VariantArray(VariantType variantType, IArrowArray storage)
Parameters
variantTypeVariantTypestorageIArrowArray
Properties
Count
public int Count { get; }
Property Value
IsShredded
True when the underlying column includes shredded data (has a
typed_value column, or lacks a value column). Reads
on shredded columns require Apache.Arrow.Operations.Shredding.
public bool IsShredded { get; }
Property Value
this[int]
public VariantValue this[int index] { get; }
Parameters
indexint
Property Value
StorageArray
public StructArray StorageArray { get; }
Property Value
TypedValueArray
The typed_value child array when the column is shredded; otherwise null.
public IArrowArray TypedValueArray { get; }
Property Value
VariantType
The variant type metadata describing which columns are present.
public VariantType VariantType { get; }
Property Value
Methods
GetEnumerator()
public IEnumerator<VariantValue> GetEnumerator()
Returns
GetMetadataBytes(int)
Gets the metadata bytes for the element at the given index.
public ReadOnlySpan<byte> GetMetadataBytes(int index)
Parameters
indexint
Returns
GetValueBytes(int)
Gets the value bytes for the element at the given index.
public ReadOnlySpan<byte> GetValueBytes(int index)
Parameters
indexint
Returns
Exceptions
- InvalidOperationException
If the column has no
valuefield.
GetVariantReader(int)
Gets a zero-copy VariantReader for the element at the given index. The reader is only valid while the underlying array buffers are alive.
public VariantReader GetVariantReader(int index)
Parameters
indexint
Returns
Exceptions
- ArgumentOutOfRangeException
If
indexis out of range.- InvalidOperationException
If the element at
indexis null, or the column is shredded (a VariantReader over residual bytes alone does not represent the logical variant — useApache.Arrow.Operations.Shreddinginstead).
GetVariantValue(int)
Gets a materialized VariantValue for the element at the given index.
Shredded columns require Apache.Arrow.Operations.Shredding; call the
GetShreddedVariant / GetLogicalVariantValue extension methods instead.
public VariantValue GetVariantValue(int index)
Parameters
indexint
Returns
Exceptions
- InvalidOperationException
If the column is shredded.
TryGetValueBytes(int, out ReadOnlySpan<byte>)
Returns true and sets value when the element at
index has value bytes, false otherwise. Shredded
elements whose residual is null will return false.
public bool TryGetValueBytes(int index, out ReadOnlySpan<byte> value)
Parameters
indexintvalueReadOnlySpan<byte>