Arrow.Field (Arrow v0.1.0)

Copy Markdown

A named column within a schema. Holds the logical type, nullability, an optional per-field metadata map, the child fields used by nested types (List, Struct), and an optional Arrow.Type.DictionaryEncoding when the field is dictionary-encoded.

Dictionary encoding in Arrow is a property of the field, not a type: the type continues to describe what the dictionary stores (e.g. Utf8), while dictionary.index_type describes the integer type used in record batches to reference dictionary entries.

Summary

Functions

Walks the field tree under schema_or_fields and returns the first field whose dictionary annotation has the given id, or nil.

Returns the field with its dictionary annotation stripped — i.e. a field that describes the value type only. Used when decoding the contents of a DictionaryBatch, where the buffers carry the dictionary values rather than indices.

Types

metadata()

@type metadata() :: %{optional(String.t()) => String.t()}

t()

@type t() :: %Arrow.Field{
  children: [t()],
  dictionary: Arrow.Type.DictionaryEncoding.t() | nil,
  metadata: metadata(),
  name: String.t(),
  nullable: boolean(),
  type: Arrow.Type.t()
}

Functions

find_by_dictionary_id(fields, target)

@spec find_by_dictionary_id(Arrow.Schema.t() | [t()], non_neg_integer()) :: t() | nil

Walks the field tree under schema_or_fields and returns the first field whose dictionary annotation has the given id, or nil.

value_field(f)

@spec value_field(t()) :: t()

Returns the field with its dictionary annotation stripped — i.e. a field that describes the value type only. Used when decoding the contents of a DictionaryBatch, where the buffers carry the dictionary values rather than indices.