Repository navigation
Export the Delta Lake commit metadata without the Apache Arrow C++ library - #131768
Conversation
…brary `WriteTransaction` gave delta-kernel the add-file records of a commit as an Arrow record batch built with `CHColumnToArrowColumn` and exported with Arrow's C bridge. Add a native exporter to the Arrow C data interface (`ArrowIPC/ArrowCData`) that wraps the buffers of `RecordBatchEncoder`, the encoder of the native `Arrow` format, and use it instead. The Arrow types are the ones the `Arrow` format writes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Workflow [PR], commit [c2cda91] Summary: ✅
AI ReviewSummaryThe PR replaces Apache Arrow C++ conversion of Delta Lake commit metadata with an Arrow C data exporter backed by the native encoder. The previous allocation-failure leak is addressed by owning children before building them. No new actionable findings remain. The exported representation's consumers are Missing context / blind spots
Final VerdictStatus: ✅ Approve. |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes5 object files changed (+133.64 KiB total), 1 added.
711 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units9 translation units recompiled, 16 s compile time in total, 8 of them have a recent master baseline. |
`WriteTransaction::commit` declared the exported structs as the kernel's `ffi::FFI_ArrowSchema`/`ffi::FFI_ArrowArray` and called their `release` callbacks through those types, while the callbacks are defined for `ArrowSchema`/`ArrowArray`. UBSan (`-fsanitize=function`) reports this as "call to function ... through pointer to incorrect function type", which failed every Delta Lake write in the sanitizer builds. Declare the structs with the C data interface types and cast only when passing them to the kernel. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=131768&sha=latest&name_0=PR PR: #131768 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…them throws The children of an exported `ArrowSchema`/`ArrowArray` were built into a temporary `unique_ptr` and only then pushed into the parent's vector. If the push threw (e.g. `MEMORY_LIMIT_EXCEEDED` from `VectorWithMemoryTracking`), the child's `release` callback was never called and its `ExportedArray` kept the shared batch body alive. Insert the zero-initialized child into the parent first and build it in place: the parent's destructor then releases it, and a child whose build threw has no `release` set and is just freed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
alexey-milovidov
left a comment
There was a problem hiding this comment.
This is not the best looking code, but it is required for this purpose.
Part of removing the Apache Arrow C++ library: Delta Lake writes no longer use it.
WriteTransaction::commitgave delta-kernel the add-file records of a commit (path, partition values, size, modification time,numRecordsstats) as an Arrow record batch built withCHColumnToArrowColumnand exported with Arrow's C bridge. This adds a native exporter to the Arrow C data interface,ArrowIPC/ArrowCData, and uses it instead.The exporter does not need Arrow-specific encoding code of its own. It runs
RecordBatchEncoderandbuildSchemaMessage, the encoder and schema builder of the nativeArrowoutput format. Then it wraps the resulting pre-ordered field nodes and buffers into a tree ofArrowArrays and the parsed schema intoArrowSchemas, following the buffer layout thatRecordBatchDecoder::advanceFieldwalks. The arrays share one reference-counted body and can be moved and released independently, as the C data interface requires.LowCardinalityis exported as plain values. The Arrow types are the ones theArrowformat writes, which match whatCHColumnToArrowColumnproduced for these columns (entries/key/valuemap fields included). Metadata too large for one record batch is still added as several batches, now split withmaxRowsFittingOneArrowBatch.The Vortex format will use the same exporter when it moves off the Arrow library.
Tested locally: the 31 stateless tests that write to Delta Lake tables pass, except the parts that need S3 (no MinIO in my environment).
Delta Lake still needs the Arrow library for reading the change data feed until #130062 is merged; after that,
USE_DELTA_KERNEL_RScan stop requiringch_contrib::parquet.Related: #130062
Related: #131763
Changelog category (leave one):
🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/131768]
Version info
26.11.1.2778-master(included in26.11and later)