Table of Contents

Class VariantArray

Namespace
Apache.Arrow
Assembly
Apache.Arrow.dll

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

storage IArrowArray

VariantArray(VariantType, IArrowArray)

public VariantArray(VariantType variantType, IArrowArray storage)

Parameters

variantType VariantType
storage IArrowArray

Properties

Count

public int Count { get; }

Property Value

int

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

bool

this[int]

public VariantValue this[int index] { get; }

Parameters

index int

Property Value

VariantValue

StorageArray

public StructArray StorageArray { get; }

Property Value

StructArray

TypedValueArray

The typed_value child array when the column is shredded; otherwise null.

public IArrowArray TypedValueArray { get; }

Property Value

IArrowArray

VariantType

The variant type metadata describing which columns are present.

public VariantType VariantType { get; }

Property Value

VariantType

Methods

GetEnumerator()

public IEnumerator<VariantValue> GetEnumerator()

Returns

IEnumerator<VariantValue>

GetMetadataBytes(int)

Gets the metadata bytes for the element at the given index.

public ReadOnlySpan<byte> GetMetadataBytes(int index)

Parameters

index int

Returns

ReadOnlySpan<byte>

GetValueBytes(int)

Gets the value bytes for the element at the given index.

public ReadOnlySpan<byte> GetValueBytes(int index)

Parameters

index int

Returns

ReadOnlySpan<byte>

Exceptions

InvalidOperationException

If the column has no value field.

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

index int

Returns

VariantReader

Exceptions

ArgumentOutOfRangeException

If index is out of range.

InvalidOperationException

If the element at index is null, or the column is shredded (a VariantReader over residual bytes alone does not represent the logical variant — use Apache.Arrow.Operations.Shredding instead).

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

index int

Returns

VariantValue

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

index int
value ReadOnlySpan<byte>

Returns

bool