Table of Contents

Class VariantMetadataBuilder

Namespace
Apache.Arrow.Scalars.Variant
Assembly
Apache.Arrow.Scalars.dll

Collects unique field names and builds the sorted binary metadata dictionary used by variant objects.

public sealed class VariantMetadataBuilder
Inheritance
VariantMetadataBuilder
Inherited Members

Properties

Count

Gets the number of unique field names.

public int Count { get; }

Property Value

int

Methods

Add(string)

Adds a field name to the dictionary. Returns the assigned field ID. If the name already exists, returns the existing ID.

public int Add(string name)

Parameters

name string

Returns

int

Build()

Builds the binary metadata. Use this overload when you don't need the ID remap.

public byte[] Build()

Returns

byte[]

Build(out int[])

Builds the binary metadata with the dictionary sorted by UTF-8 byte order.

public byte[] Build(out int[] idRemap)

Parameters

idRemap int[]

Maps original (insertion-order) field IDs to sorted field IDs. idRemap[originalId] = sortedId.

Returns

byte[]

The binary metadata bytes.

CollectFieldNames(VariantReader)

Recursively walks source and adds every field name it references to this builder. Use during the metadata-collection phase of a two-pass encode — build the metadata first, finalize it via Build(out int[]), then pass the resulting remap to a VariantValueWriter and call CopyValue(VariantReader).

public void CollectFieldNames(VariantReader source)

Parameters

source VariantReader

GetId(string)

Gets the field ID for an already-added name.

public int GetId(string name)

Parameters

name string

Returns

int