Arrow IPC record batch decoder for Arrow Flight query results.
Converts a list of FlightData messages (received from a DoGet gRPC
stream) into a list of Elixir row maps.
Arrow IPC Format Overview
Each FlightData message carries two binary blobs:
data_header— serialised Arrow IPCMessageflatbuffer. The first message in a stream contains aSchemamessage; subsequent messages containRecordBatchmessages with buffer offset/length metadata.data_body— raw column buffer bytes referenced by the batch metadata.
Schema and record batch metadata is parsed using a proper FlatBuffer
binary reader (InfluxElixir.Flight.FlatBuffer), following the Arrow
IPC FlatBuffer schema specification exactly.
Supported Column Types
| Arrow Type | Elixir type |
|---|---|
| Int8-64 | integer() |
| UInt8-64 | integer() |
| Float32/64 | float() |
| Bool | boolean() |
| Utf8 | binary() |
| Timestamp | integer() |
Null bitmaps are supported; null values become nil.
Limitations
- Dictionary-encoded columns are not yet decoded.
- Nested / list / struct types are not supported.
Summary
Types
Parsed column schema entry
Functions
Decodes a list of FlightData messages into row maps.
Extracts column name/type pairs from an Arrow IPC Schema message header.
Types
@type column_schema() :: %{name: binary(), type_id: non_neg_integer()}
Parsed column schema entry
Functions
@spec decode_flight_data([InfluxElixir.Flight.Proto.FlightData.t()]) :: {:ok, [map()]} | {:error, term()}
Decodes a list of FlightData messages into row maps.
The first element of flight_data_list is expected to be the schema message
(typically with an empty data_body). Subsequent elements are record batch
messages.
Returns {:ok, [map()]} on success or {:error, reason} on parse failure.
Parameters
flight_data_list— ordered list ofFlightDatastructs from a DoGet stream
Example
iex> InfluxElixir.Flight.Reader.decode_flight_data([])
{:ok, []}
@spec parse_schema(binary() | nil) :: {:ok, [column_schema()]} | {:error, term()}
Extracts column name/type pairs from an Arrow IPC Schema message header.
Parses the FlatBuffer metadata according to the Arrow IPC specification: Message → Schema → Field[] → name + Type union.
Returns {:ok, [column_schema()]} or {:error, reason}.