l>

documentation

Arrow interop

Read, write, and stream Apache Arrow IPC files from l.

The Arrow interop package is an Apache Arrow IPC reader, writer, and streamer for l. l loads the shared library through 2:.

l-labs/arrow_interop

Load from l

.arrow.read:  `:build/arrow_io 2: (`arrow_read; 1)
.arrow.write: `:build/arrow_io 2: (`arrow_write; 1)
.arrow.stream:`:build/arrow_io 2: (`arrow_stream; 1)

First round trip

.arrow.write[([]sym:`AAPL`GOOG;price:150.5 175.3); `:/tmp/out.arrow]
t:.arrow.read `:/tmp/out.arrow
n:.arrow.stream[`:/tmp/huge.arrow; `:/tmp/db/t]

.arrow.read reads Arrow and Feather v2 files. .arrow.stream splays a large Arrow file to disk while keeping one batch in memory.

Type mapping

l typeArrow typeReadWriteNotes
KB boolBoolyesyesbitpacked on wire, byte-per-value in l
KG byteUInt8yesyesmemcpy
KH, KI, KJInt16, Int32, Int64yesyesnulls use validity bitmap
KE, KFFloat32, Float64yesyesNaN maps to null
KS symbolUtf8yesyesinterned on read
KD dateDate32 dayyesyesepoch shift 2000 to 1970
KT timeTime32 msyesyes
KP timestampTimestamp nsyesyesepoch shift, null-preserving
KN timespanDuration nsyesyesno epoch shift
KZ datetimeTimestamp nsnoyesreads back as KP
dictionary Utf8Dictionary<Int32, Utf8>yesnoindex to interned symbol
listList<T>yesnogeneric list of typed vectors

Nulls map between l sentinels such as 0Ni, 0Nj, and 0n and Arrow validity bitmaps.