API reference
The arrow_mlake package, from arrow-mlake 0.2.1, as published on mojoshelf (commit 178aae6e0da0), by mojo doc from Mojo 1.2.0.
Source.
arrow-mlake.mojo — the Arrow memory layout and the C Data Interface, in pure Mojo.
Part of magmalake: data lake building blocks in Mojo.
from arrow_mlake import ImportedStream
var s = ImportedStream(stream_address) # a producer's ArrowArrayStream
while True:
var got = s.next()
if not got:
break
ref batch = got.value()
print(batch.num_rows, "rows,", batch.num_columns(), "columns")
Seven modules, and no dependencies on anything but std:
arrow_mlake.arrow—ArrowType,ArrayDataandArrayArena: one Arrow array as the columnar spec lays it out, with nesting held in an arena because Mojo does not allow a struct to contain aListof itself.arrow_mlake.carrow— the C Data Interface outbound.export_cturns an array into anArrowSchema/ArrowArraypair any Arrow implementation can consume.arrow_mlake.carrow_import— the same interface inbound, includingArrowArrayStream, which is the shape a scan arrives in.arrow_mlake.carrow_stream—export_stream, the outbound half of that: a sequence of batches as oneArrowArrayStreama consumer pulls from.arrow_mlake.batch—RecordBatch, a run of rows as one array per column.arrow_mlake.ipc— the Arrow IPC stream format:IpcWriterandread_ipc_stream, batches to bytes and back, for files, sockets and shared mappings.arrow_mlake.flatbufis the FlatBuffers builder and reader under it.
This tin is a stopgap. The community Arrow implementation for Mojo is marrow, which is more complete than this and which this should be replaced by as soon as it builds on Mojo 1.x. See the README.
Modules
-
arrow_mlake.arrowArrow types and Arrow array data, in the layout the C Data Interface wants. 3 structs · 18 functions -
arrow_mlake.batchRecordBatch— a run of rows as Arrow arrays, one per column. 1 struct · 8 functions -
arrow_mlake.carrowThe Arrow C Data Interface — this library's public output contract. 3 structs · 7 functions -
arrow_mlake.carrow_importThe Arrow C Data Interface, inbound — another runtime's arrays read into this one. 3 structs · 8 functions -
arrow_mlake.carrow_sharedPublish a batch into a shared mapping, for a consumer in another process. 3 functions -
arrow_mlake.carrow_streamProducing anArrowArrayStream: the C Data Interface, outbound, in batches. 2 functions -
arrow_mlake.flatbufFlatBuffers, as much as Arrow IPC metadata needs: a builder and a reader. 2 structs -
arrow_mlake.ipcThe Arrow IPC stream format:RecordBatches to bytes and back. 2 structs · 3 functions -
arrow_mlake.memory_shimOpening a region, for a caller that does not want the allocator's types. 1 function