[mosaic] Support Arrow bundle writes - #9100
Conversation
|
Thanks for working on this. I wonder whether As I understand it, this flag does not actually guarantee a zero-copy or native write. It only controls whether long rowCount = bundle.rowCount();
if (auxiliaryFileWriters.isEmpty()
&& sequenceNumberTracker.supportsRowCountUpdate()
&& !requiresPerRecordStats()) {
super.writeBundle(bundle);
sequenceNumberTracker.updateByRowCount(rowCount);
return;
}
for (InternalRow row : bundle) {
write(row);
}The existing abstractions already provide the remaining dispatch:
In other words, whether to copy or use a native batch path looks like a format-writer implementation detail. The extra boolean duplicates that dispatch and is slightly misleading: Could we remove |
- Remove the producer-side direct-write flag. - Require row-equivalent writes and safe borrowed-buffer handling. - Add schema and allocator fallback checks. - Fix row-count and shredding consistency. - Add regression tests for Arrow, Lance, Mosaic, and Vortex.
…saic writers Preserve existing Arrow, Lance, and Vortex writer behavior by keeping them on the row path unless a writer explicitly supports row-equivalent bundle writes. Enforce the shredding inference bound and keep Mosaic native writes behind schema and allocator-root compatibility checks with safe row fallback.
Purpose
Support writing eligible Paimon
BundleRecordsas Arrow batches in Mosaic, avoiding row-by-row materialization when the format writer can preserve the same values, order, accounting, and buffer lifetime as normal row writes.Mosaic currently requires the input vectors and writer to share one Arrow allocator root. apache/paimon-mosaic#73 adds safe Arrow batch writes across allocator roots. This PR remains correct without that change: it keeps the same-root check and falls back to the existing row path when direct batch consumption is not compatible.
Changes
BundleFormatWriter.supportsRowEquivalentBundleWrite()opt-in contract;writeBundle()remains implemented by each format writer.RowDataFileWriteronly when the underlying writer opts in and no auxiliary writer, row tracking, or per-record statistics require row iteration.ArrowBundleRecordsas one batch; otherwise iterate the bundle through the existing row writer.variant.shredding.maxInferBufferRowwhile consuming bundles so a large first bundle cannot bypass the configured inference limit.Tests
masterat30bfd4a60.git diff --checkpassed, and the pushed PR merge tree matches the locally validated integration tree.