ddn.data.arrow.c_data

The Arrow interchange layer of ddn.df (ADR-2026-10-24-15): the C Data Interface (the ArrowArray/ArrowSchema ABI structs with release callbacks), implemented natively in D with no external dependency. Export is zero-copy where the sealed-buffer layout matches Arrow's (validity, fixed-width values, offsets); import copies into fresh sealed chunks (the immutable-buffer invariant; foreign memory is never held after the import returns).

Types 4

Fields
const(char) * format
const(char) * name
const(char) * metadata
long flags
long n_children
ArrowSchema * * children
ArrowSchema * dictionary
void function(ArrowSchema *) release
void * private_data
Fields
long length
long null_count
long offset
long n_buffers
long n_children
const(void) * * buffers
ArrowArray * * children
ArrowArray * dictionary
void function(ArrowArray *) release
void * private_data
private structSchemaStorage
Fields
char[] nameBuf
char[] formatBuf
ArrowSchema[] childSchemas
ArrowSchema dictSchema
private structExportedBuffers
Fields
const(void) *[] bufs
ArrowArray[] childStorage
ArrowArray * dictStorage
ubyte[] wideBytes
ulong[] validityWords

Functions 17

fnstring arrowFormatOf(DataType dtype) @safeMaps a flat `DataType` to its Arrow C Data Interface format string (verified against pyarrow 21.0.0's `export_to_c`): STRING maps to `"U"` (large_string — our offsets are int64), DATETIME to `"ts...
fnDataType dtypeOfArrowFormat(scope const(char)[] format) @safeMaps an Arrow format string to a `DataType`. The admitted flat set: the fixed-width kinds, `"u"`/`"U"` (utf8 and large_utf8; the 32-bit-offset form imports by widening), `"tsn:"` (nanosecond timest...
private fnptrdiff_t indexOf(scope const(char)[] s, char c) @safe pure nothrow
private fnvoid releaseSchema(ArrowSchema * s) extern(C)
fnArrowSchema exportSchema(DataType dtype, string name = null) @trustedBuilds the `ArrowSchema` for one dtype: the verified format string, an optional name, null metadata, and the rich kinds' wiring - LIST carries its element child ("item"), CATEGORICAL carries its la...
private fnstring cstr(const(char) * p) @trusted pure nothrowReads one NUL-terminated C string into a D slice (null pointers become the empty slice).
fnDataType dtypeOfSchema(const ArrowSchema * s) @safeDerives the dtype an `ArrowSchema` describes. The flat tier maps through `dtypeOfArrowFormat`; the rich tier parses the tree: `+L`/`+l` with one flat element child becomes LIST (the 32-bit `+l` off...
private fnvoid releaseArray(ArrowArray * arr) extern(C)
fnArrowArray exportArray(const ArrayData chunk) @trustedExports one sealed chunk as an `ArrowArray`. The buffers reference the chunk's immutable storage (zero-copy); the release callback frees only the C-side bookkeeping, not the data.
fnArrayData importArray(const ArrowArray arr, DataType dtype, bool largeOffsets = true, const ArrowSchema * schema = null) @trustedImports an `ArrowArray` into a fresh sealed chunk (copy-on-import: the foreign buffers are copied, the source's release fires normally, and no foreign memory is held after the return). The ABI's `o...
fnArrayData importArray(const ArrowArray arr, const ArrowSchema * schema) @trustedDitto, schema-driven: the dtype and the offsets width come from the paired `ArrowSchema` (the ABI's intended entry).
fnArrowArray[] exportColumn(Series column) @trustedExports a whole column: one `ArrowArray` per chunk, in chunk order. A chunked column is several C Data arrays (one array per contiguous buffer set); the chunk boundaries are the column's own and ar...
fnSeries importColumn(string name, scope const(ArrowArray)[] arrays, DataType dtype) @trustedImports a column from its exported chunk arrays: each array seals into one chunk, in order (the counterpart of `exportColumn`).
private fnArrayData importArrayS(const ArrowArray arr, const ArrowSchema * schema) @trusted
private fnBitmap importValidity(const ArrowArray arr, size_t off, size_t len) @trusted
private fnvoid copyBits(const(ulong) * src, size_t srcBit, ubyte[] dst, size_t nBits) @trusted pure nothrow
private fnsize_t physicalSizeOf(Kind k) @safe pure nothrow