LanceDB.Batch (LanceDB v0.2.0)

Copy Markdown View Source

An immutable native Arrow record batch. Batches may be shared between processes.

Query.stream_batches/2 and Table.add/3 with Source.batches/2 transfer compatible batches without row serialization. Conversion to Elixir maps is explicit through to_rows/1. Retaining a batch retains its Arrow buffers, including buffers shared by slices.

Summary

Functions

Imports every batch in an Arrow IPC stream binary; input is materialized in memory.

Encodes rows against an explicit schema.

Returns the physical ArrowSchema; convert explicitly before table creation.

Returns the number of rows without converting the batch.

Exports one batch as a standard Arrow IPC stream binary.

Converts the batch into string-keyed Elixir row maps.

Types

t()

@opaque t()

Functions

from_ipc(binary)

@spec from_ipc(binary()) :: LanceDB.result([t()])

Imports every batch in an Arrow IPC stream binary; input is materialized in memory.

from_rows(rows, schema)

@spec from_rows([map()], LanceDB.Schema.t()) :: LanceDB.result(t())

Encodes rows against an explicit schema.

schema(batch)

@spec schema(t()) ::
  {:ok, LanceDB.ArrowSchema.t()} | {:error, JSON.decode_error_reason()}

Returns the physical ArrowSchema; convert explicitly before table creation.

size(batch)

@spec size(t()) :: non_neg_integer()

Returns the number of rows without converting the batch.

to_ipc(batch)

@spec to_ipc(t()) :: LanceDB.result(binary())

Exports one batch as a standard Arrow IPC stream binary.

to_rows(batch)

@spec to_rows(t()) :: LanceDB.result([map()])

Converts the batch into string-keyed Elixir row maps.