Repository navigation
Conversation
|
This PR is intended to give reviewers context on the final destination as they review the individual PRs. As those PRs are merged, I’ll keep rebasing this one so that the draft always reflects the most up-to-date version of the remaining work to review. |
|
@etseidl is a review machine, and a lot of the "stack A" commits have already been merged. I’ll rebase this soon so the draft is back up to date! |
|
run benchmarks arrow_writer |
|
🤖 Arrow criterion benchmark running (GKE) | trigger CPU Details (lscpu)Comparing ree (6906adb) to 92b5042 (merge-base) diff Run configurationrun benchmark arrow_writerBENCH_COMMAND=cargo bench --features=arrow,async,test_common,experimental,object_store --bench arrow_writer File an issue against this benchmark runner |
|
Benchmark for this request hit the 7200s job deadline before finishing. Benchmarks requested: Kubernetes messageFile an issue against this benchmark runner |
Sounds great to me. I think there are many parts of the current parquet writer that are hold overs from the original version which was somewhat of a java --> rust transliteration. I am glad that by rethinking the abstractions, things are better I am also glad to see us moving into the third phase of optimization |
|
run benchmarks arrow_writer |
|
🤖 Benchmark starting (GKE) | trigger Target: arrow_writer Sharding factor: 1 (1 workers). Comparing ree (6cec2ae) to 3e03c57 (merge-base) diff Run configurationrun benchmark arrow_writer
env:
BENCH_FILTER: ree
shards: 1
Results will be posted when all workers finish. File an issue against this benchmark runner |
|
super cool stuff here |
|
🤖 Benchmark completed (GKE) | trigger Target: arrow_writer Comparing ree (6cec2ae) to 3e03c57 (merge-base) diff Run configurationrun benchmark arrow_writer
env:
BENCH_FILTER: ree
shards: 1
DetailsPer-runner informationarrow_writer — shard 1/1Node: gk3-benchmark-cluster-nap-legsj59f-d84051f5-dpfq Instance: c4a-highmem-16 (12 vCPU / 65 GiB) uname: BENCH_COMMAND: cargo bench --features=arrow,async,test_common,experimental,object_store --bench arrow_writerCPU Details (lscpu)Resource Usagebase (merge-base)
branch
File an issue against this benchmark runner |
|
run benchmark arrow_writer |
|
🤖 Benchmark starting (GKE) | trigger Target: arrow_writer Sharding factor: 4 (4 workers). Comparing ree (d454d45) to 6b8df9c (merge-base) diff Run configurationrun benchmark arrow_writer
shards: 4
Results will be posted when all workers finish. File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Target: arrow_writer Comparing ree (d454d45) to 6b8df9c (merge-base) diff Run configurationrun benchmark arrow_writer
shards: 4
Comparison results: View the complete native critcmp output. The comparison is published in an unlisted Gist because the original inline report exceeded GitHub's comment limit. Per-runner informationarrow_writer — shard 1/4Node: gk3-benchmark-cluster-nap-1s09vgvi-9c12f25e-b58q Instance: c4a-highmem-16 (12 vCPU / 65 GiB) uname: BENCH_COMMAND: cargo bench --features=arrow,async,test_common,experimental,object_store --bench arrow_writerCPU Details (lscpu)Resource Usagebase (merge-base)
branch
arrow_writer — shard 2/4Node: gk3-benchmark-cluster-nap-1s09vgvi-09904f92-tlnk Instance: c4a-highmem-16 (12 vCPU / 65 GiB) uname: BENCH_COMMAND: cargo bench --features=arrow,async,test_common,experimental,object_store --bench arrow_writerCPU Details (lscpu)Resource Usagebase (merge-base)
branch
arrow_writer — shard 3/4Node: gk3-benchmark-cluster-nap-1s09vgvi-780cabf5-vsqh Instance: c4a-highmem-16 (12 vCPU / 65 GiB) uname: BENCH_COMMAND: cargo bench --features=arrow,async,test_common,experimental,object_store --bench arrow_writerCPU Details (lscpu)Resource Usagebase (merge-base)
branch
arrow_writer — shard 4/4Node: gk3-benchmark-cluster-nap-1s09vgvi-5bd55644-tn6k Instance: c4a-highmem-16 (12 vCPU / 65 GiB) uname: BENCH_COMMAND: cargo bench --features=arrow,async,test_common,experimental,object_store --bench arrow_writerCPU Details (lscpu)Resource Usagebase (merge-base)
branch
File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Target: arrow_writer Comparing ree (cd43e41) to 01a9917 (merge-base) diff Run configurationrun benchmark arrow_writer
shards: 4
Comparison results: View the complete native critcmp output. The comparison is published in an unlisted Gist because the original inline report exceeded GitHub's comment limit. Per-runner informationarrow_writer — shard 1/4Node: gk3-benchmark-cluster-nap-h91vzyol-ad34dca1-9xjk Instance: c4a-highmem-16 (12 vCPU / 65 GiB) uname: BENCH_COMMAND: cargo bench --features=arrow,async,test_common,experimental,object_store --bench arrow_writerCPU Details (lscpu)Resource Usagebase (merge-base)
branch
arrow_writer — shard 2/4Node: gk3-benchmark-cluster-nap-h91vzyol-ad34dca1-nqvt Instance: c4a-highmem-16 (12 vCPU / 65 GiB) uname: BENCH_COMMAND: cargo bench --features=arrow,async,test_common,experimental,object_store --bench arrow_writerCPU Details (lscpu)Resource Usagebase (merge-base)
branch
arrow_writer — shard 3/4Node: gk3-benchmark-cluster-nap-h91vzyol-ad34dca1-2hml Instance: c4a-highmem-16 (12 vCPU / 65 GiB) uname: BENCH_COMMAND: cargo bench --features=arrow,async,test_common,experimental,object_store --bench arrow_writerCPU Details (lscpu)Resource Usagebase (merge-base)
branch
arrow_writer — shard 4/4Node: gk3-benchmark-cluster-nap-h91vzyol-ad34dca1-gjcv Instance: c4a-highmem-16 (12 vCPU / 65 GiB) uname: BENCH_COMMAND: cargo bench --features=arrow,async,test_common,experimental,object_store --bench arrow_writerCPU Details (lscpu)Resource Usagebase (merge-base)
branch
File an issue against this benchmark runner |
…e#11838) # Which issue does this PR close? <!-- It is not necessary to raise an issue, but it is encouraged if it is a non-trivial enhancement/bug. If this PR relates to an existing issue, but does not fully resolve it, please change the wording below from "Closes #NNN" to "Relates to #NNN" or "Part of #NNN" to avoid false closing an issue. --> - Closes apache#11837 - Contributes to apache#9731 - Part of apache#11273 # Rationale for this change <!-- Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed. Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes. Please try to explain the problem you are trying to solve in terms of the user-visible behavior, rather than the implementation. --> See apache#11837. Structural mismatches between the input batch, declared schemas, and column writers should produce descriptive errors rather than silently ignore columns or panic. Map-key schema constraints should also be enforced when an explicit Parquet schema bypasses Arrow-to-Parquet conversion. # What changes are included in this PR? <!-- There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR. --> Reject mismatches between batch columns, planned Parquet leaves, physical column writers, and CDC chunkers instead of silently truncating zipped iteration or panicking on missing writers. Derive per-field leaf ranges from the target Arrow schema and verify the Arrow/Parquet leaf counts when creating column writers. Check batch, writer, and chunker counts before updating row-group accounting, and validate each field's actual leaf count before dispatching its writes. Preserve compatible dense, dictionary, and run-end encoded representations. Validate map-key schemas when creating an Arrow writer, including when an explicitly supplied Parquet schema bypasses Arrow-to-Parquet conversion. # Are these changes tested? <!-- We typically require tests for all PRs in order to: 1. Prevent the code from being accidentally broken by subsequent changes 2. Serve as another way to document the expected behavior of the code If tests are not included in your PR, please explain why (for example, are they covered by existing tests, if so identify these tests)? If this PR claims a performance improvement, please include evidence such as benchmark results. DO NOT simply paste a list of commands ran to verify the code; this is what our CI is for and it pollutes the PR. ONLY explain if testing was included with this PR, or why it wasn't. --> Add regression coverage for shape mismatches, invalid map-key schemas, and reachable versus masked or unreferenced map-key nulls. All tests passing. # Are there any significant user-facing changes? <!-- Significant user-facing changes include: - Breaking public API change - Significant change to existing functionality (e.g. function returns something different) These need to be explicitly called out to ensure we have proper documentation if required and to ensure we follow proper semantic versioning. DO NOT restate the changes of this PR; if a bug was fixed and already explained above, we don't need this to be restated as a user-facing change. --> No public API changes. Invalid schema or column-count combinations that were previously accepted, silently ignored, or caused a panic now return descriptive errors. Signed-off-by: Hippolyte Barraud <[email protected]>
…he#11971) # Which issue does this PR close? <!-- It is not necessary to raise an issue, but it is encouraged if it is a non-trivial enhancement/bug. If this PR relates to an existing issue, but does not fully resolve it, please change the wording below from "Closes #NNN" to "Relates to #NNN" or "Part of #NNN" to avoid false closing an issue. --> - Contributes to apache#9731 - Contributes to apache#9722 - Part of apache#11273 # Rationale for this change <!-- Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed. Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes. Please try to explain the problem you are trying to solve in terms of the user-visible behavior, rather than the implementation. --> The eager Arrow writer repeatedly derives the same schema-only field-to-leaf mapping when creating and validating row groups, even though that metadata is invariant for the lifetime of the writer factory. # What changes are included in this PR? <!-- There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR. --> Build an immutable write-schema plan once per factory and share it across row groups and column writers. Reuse the cached target fields, leaf ranges, and Parquet descriptors for both ordinary and CDC paths, while continuing to derive leaves and levels from each incoming batch. This removes repeated schema traversal without retaining input arrays or changing dense, dictionary, REE, view, required-null, or leaf-ownership semantics. # Are these changes tested? <!-- We typically require tests for all PRs in order to: 1. Prevent the code from being accidentally broken by subsequent changes 2. Serve as another way to document the expected behavior of the code If tests are not included in your PR, please explain why (for example, are they covered by existing tests, if so identify these tests)? If this PR claims a performance improvement, please include evidence such as benchmark results. DO NOT simply paste a list of commands ran to verify the code; this is what our CI is for and it pollutes the PR. ONLY explain if testing was included with this PR, or why it wasn't. --> All tests passing. # Are there any significant user-facing changes? <!-- Significant user-facing changes include: - Breaking public API change - Significant change to existing functionality (e.g. function returns something different) These need to be explicitly called out to ensure we have proper documentation if required and to ensure we follow proper semantic versioning. DO NOT restate the changes of this PR; if a bug was fixed and already explained above, we don't need this to be restated as a user-facing change. --> None. --------- Signed-off-by: Hippolyte Barraud <[email protected]> Co-authored-by: Ed Seidl <[email protected]> Co-authored-by: Andrew Lamb <[email protected]>
|
@alamb I’m happy to report that all of "Stack A" has now been merged upstream! That was the easier part, since those commits were mostly independent bug fixes and small refactors laying the groundwork for the larger changes that follow. As we discussed, I was planning to submit the next stack as native stacked GitHub PRs. Unfortunately, I hadn’t accounted for one limitation: all branches in a native stack, including its target branch, must live in the same repository. That's a bummer, and means I can’t use this workflow to target upstream while hosting the branches on my fork. Would it be possible to arrange for the stack’s branches to be hosted in I think a native stack would give reviewers the best experience: each commit would have a focused diff, while its place in the overall design would remain visible. The commits are individually correct and tested, so submitting them one at a time is possible; my concern is that reviewing them in isolation would make the broader architectural changes harder to follow. If hosting the branches upstream isn’t practical, I’m very happy to find another approach together! Thanks again for all your help getting this upstream 🙇 |
I agree native stacks is probably the best experience, but I think we could get pretty close by just creating multiple PRs and labeling them like
The only people who have write access to the repo are committers on the Arrow project -- https://arrow.apache.org/committers/ -- that that is managed by the ASF / not something I control |
|
In terms of trying to help get this PR / set of PRs in / merged, I would like to suggest we start with a motivating example / benchmark that we can use to motivate the work more explicitly and thus attract reviewer attention -- especially as I think the use case is something that is widely interesting to people. Specifically I think your high level usecase is to implement compaction of multiple parquet files remaining both CPU and memory efficient, which I guaratnee you is SUPER relevant to many others and will be very exciting. However, as currently described "native REE support" making this connection requires quite a bit of intimate knowledge (and I am not sure i would have put it together if I hadn't spoken with you in person first) So, perhaps we can start with:
|
|
Thank you for this PR @HippoBaro -- now I just need to figure out how to find time to help review it |
Store unique `BYTE_ARRAY` values directly in a packed `PLAIN` dictionary-page buffer, preserving first-seen dictionary IDs. Retain typed unique-value storage for the other physical types behind a common storage contract. Consume dictionary storage when the column writer emits its dictionary page, allowing the packed byte buffer to be transferred without another serialization pass or payload copy. Preserve non-consuming `write_dict` access for experimental callers and tests. Add borrowed-byte interning that constructs owned values only on a deduplication miss, preparing for later borrowed batch sinks. The existing slice input path continues to intern typed values. Extract dense dictionary-index buffering and serialization into a helper, include the bit-width header in encoded-size estimates, validate byte-array prefix lengths, and update memory accounting for packed storage. Cover dictionary ordering, duplicate and empty values, page-flush lifecycle, consuming serialization, lazy construction, and length overflow. Signed-off-by: Hippolyte Barraud <[email protected]>
Replace the column encoder's boxed fallback encoder and optional dictionary encoder with a concrete family selected by physical value type. Represent dictionary mode and fallback as variants of one active encoder, preserving eager fallback validation and consuming dictionary-page emission. Introduce `TypedColumnChunkEncoder` and family-specific dispatch for numeric, boolean, byte-array and fixed-length byte-array values. Preserve custom `DataType` marker identity and the existing statistics, Bloom-filter and column-accounting responsibilities. Organize the encoding implementations by physical family and replace the generic byte-delta implementations with shared concrete backends. Retain the private `PLAIN` core's state and encoding operations. Keep `PlainEncoder`, `DeltaLengthByteArrayEncoder` and `DeltaByteArrayEncoder` as deprecated experimental compatibility utilities. Preserve descriptor-free construction, `Default`, generic `DataType` usage, custom markers and relevant trait contracts. Production families use the private implementations directly, without compatibility adapters; `get_encoder` retains its boxed public interface. Cover factory round trips, delta page reset, concrete and generic encoder APIs, custom-marker writers, auto-traits and legacy unsupported-type behavior. Signed-off-by: Hippolyte Barraud <[email protected]>
Introduce internal producer/sink contracts and route existing numeric and Boolean writes through family-specific batch consumers. Borrow contiguous numeric slices directly and gather indexed numeric selections into 128-value stack batches instead of materializing the entire selection. Accumulate numeric extrema and NaN counts in the numeric sink, classifying each value once for both purposes. Preserve signed/unsigned integer, floating-point and INT96 ordering, then merge batch extrema into page statistics. Keep Bloom insertion, value accounting and active-family encoding within the same consumer. Derive Boolean extrema and Bloom membership from the batch's true count. Feed borrowed Boolean slices to the existing PLAIN and RLE encoders, packing PLAIN values without an intermediate packed allocation. Retain the generic slice path for byte and fixed-byte values until their batch consumers are introduced. Boolean indexed gathering also retains the existing collecting adapter; bounded gathering in this change applies to numeric selections. Test gather ordering, empty and partial batches, initialization of only emitted values, and sink-error propagation. Signed-off-by: Hippolyte Barraud <[email protected]>
Route `BYTE_ARRAY` and `FIXED_LEN_BYTE_ARRAY` writes through dedicated borrowed value consumers and remove the shared generic slice consumer. Deliver variable-width payloads in bounded batches of borrowed slice handles. Retain borrowed extrema during each source write and copy only the values needed to update page statistics. Use reusable owned extrema scratch for fixed-length values, whose producers may expose temporary conversion storage. Preserve descriptor-driven byte and decimal ordering, Float16 NaN semantics, geospatial observation and dictionary/fallback lifecycle. Process byte statistics as paired bounds, sharing UTF-8 validation when both bounds reference the same slice. Use one unsigned comparison for eligible singleton-page boundary ordering, and simplify NaN-count bookkeeping without changing its type-specific semantics. Store unique fixed-length dictionary values directly in a contiguous `PLAIN` page without per-value length prefixes. Preserve first-seen IDs and transfer the packed buffer when emitting the dictionary page. Batch fixed-length Bloom-filter updates, account for retained buffers and scratch capacity, and track unencoded `BYTE_ARRAY` payload totals even when ordinary statistics are disabled so offset-index accounting remains available. Return width-mismatch errors from the column-writing and packed-batch `BYTE_STREAM_SPLIT` paths while retaining the legacy direct-slice behavior. Add coverage for these errors, packed dictionary storage and retained fallback allocations. Signed-off-by: Hippolyte Barraud <[email protected]>
Separate input delivery from `ColumnChunkEncoder` through a sliceable `ColumnWriteSource` interface. Coordinate each source window with its definition and repetition levels, distinguishing level entries from the present values they consume. Introduce dense and sparse physical selections and a borrowed `LeafBatch` handoff from the eager Arrow level planner. Recognize contiguous selections without reordering values, and preserve null accounting, level histograms and record boundaries while subdividing writes. Size dictionary mini-batches against the remaining dictionary budget rather than its full configured capacity. Use conservative physical-byte bounds for fixed-width inputs and source-provided estimates for variable-width values, while allowing oversized singletons to make progress. Add fill-based producers for bounded gathering and conservative size hints for bitmap index iterators. Cover selection slicing and ordering, remaining dictionary budgets, page-count boundaries and iterator hints. Signed-off-by: Hippolyte Barraud <[email protected]>
Bind numeric, Boolean and fixed-length Arrow storage to borrowed physical sources, then expose selected windows through `ColumnWriteSource`. Reuse the binding across a leaf write's page windows without retaining the input array beyond the synchronous write. Borrow compatible contiguous numeric buffers directly. Gather sparse selections and perform required integer, Date64 and decimal conversions in 64-value stack batches instead of constructing complete converted arrays or selection-sized value vectors. Keep Boolean input packed, carrying its bit offset and physical selection into the Boolean consumer. Add packed-range writing and bitmap counting while preserving `PLAIN` and `RLE` behavior. Borrow fixed-size binary payload ranges and pack decimal, Float16 and supported interval representations directly into bounded scratch tiles. Add the matching packed fixed-length consumer and encoder operations. Remove `LegacySelectedSlice` and the ordinary fixed-width conversion helpers. Activate the bridges through existing Arrow write paths while retaining dictionary materialization until direct key composition is introduced. Cover packed Boolean/scalar equivalence, bit offsets and selections, packed fixed-length statistics, Decimal32/64 writes, all-null Boolean `RLE` and zero-width `FixedSizeBinary`. Signed-off-by: Hippolyte Barraud <[email protected]>
Route ordinary Arrow binary and string arrays through the physical batch sinks using their native offset and view layouts, rather than the legacy Arrow-specific byte encoder. Support 32-bit and 64-bit offsets and byte views, borrowing eligible contiguous ranges and inline-view descriptors. Gather sparse selections in bounded tiles and estimate page byte requirements from offsets and views without first materializing the selected values. Keep dictionary-backed byte inputs on the existing encoder, isolated in the temporary legacy_byte_array.rs module. This preserves a working dictionary path while making the ordinary byte-layout migration reviewable independently of dictionary-key composition, cache lifetime, and per-page statistics observation. The subsequent dictionary migration introduces direct key/slot mapping and removes this temporary module. Retaining it here is an intermediate migration step, not a second long-term encoding implementation. Signed-off-by: Hippolyte Barraud <[email protected]>
Compose Arrow dictionary keys with physical value selections so dictionary-backed inputs use the native encoding bridges without first materializing decoded arrays. Support all integer key widths and add support for dictionary-backed binary and string views. Reuse source-scoped dictionary-slot mappings across mini-batches, resetting the caches at batch boundaries rather than for each mini-batch or CDC chunk. Preserve per-page statistics observation and logical NaN counts when mappings are cached, and use distinct referenced byte slots for dictionary-budget estimates. Remove the legacy_byte_array.rs module retained by the ordinary byte-layout migration, along with the old fixed-width dictionary materialization. Ordinary and dictionary-backed values now share the physical delivery pipeline instead of requiring separate Arrow byte encoders. Signed-off-by: Hippolyte Barraud <[email protected]>
Represent repeated definition and repetition levels with cumulative runs, retaining uniform and materialized forms and falling back to dense buffers when runs become too short. Support slicing, counting, record-boundary extension and encoding from the compact representation. Add consumers for borrowed multi-range value selections. Coordinate level positions and selected-value ordinals through LeafBatch windows, since null slots occupy level positions without consuming values. Use borrowed windows for CDC writes instead of cloning and rebasing per-chunk level and index buffers. Keep structural traversal and validation eager, and preserve existing CDC framing. Test compact levels against materialized levels, including sliced encoding and record-boundary behavior. Cover representation transitions, coordinated selections, page-value overflow, range byte budgets and packed Boolean selections. Signed-off-by: Hippolyte Barraud <[email protected]>
Bind supported ordinary Arrow arrays and nested structures into a `LevelTree` and emit record-aligned `LeafCursor` tiles containing coordinated levels and value selections. Keep selections compact as ranges or sparse indices and use compact level runs when appropriate. Drive both individual column writers and row-group writes through the cursor, sharing ancestor and list traversal across compatible leaf windows. Preserve target-field nullability and required-null reachability checks. Use slot and row targets to size tiles without splitting records; a single oversized record may exceed the slot target. Retain eager fallback for REE and non-leaf dictionary compositions, and leave internal CDC writing eager until persistent framing is introduced. Exercise binding and shared traversal, and compare cursor output with the eager reference at multiple tile limits, including selected values. Retain ordinary nested and nullable roundtrips, out-of-order list views, fixed-size-list slices and required all-null list/struct controls. Signed-off-by: Hippolyte Barraud <[email protected]>
Introduce `CdcFramer` and `CdcSpan` to describe chunk starts with coordinated level and selected-value windows. Carry per-leaf CDC state across cursor tiles and input batches, preserving its lifetime across row groups. Flush buffered pages before spans that start a new chunk, rather than at incidental cursor boundaries, and make empty page flushes a no-op. Keep CDC boundaries aligned with top-level records; other writer limits may still split a content-defined chunk across multiple pages. Route ordinary CDC writes through individual and shared leaf cursors. Traverse selected source positions alongside their levels and write borrowed batch windows. Retire the old chunk-discovery and level-rebasing adapters while retaining eager fallback for REE and non-leaf dictionary compositions. Test partition invariance, nested boundaries at batch starts, null and empty inputs, oversized records, and value/level alignment. Cover tiny-page nested roundtrips and document that Arrow dictionary key layout can affect chunk boundaries. Signed-off-by: Hippolyte Barraud <[email protected]>
Represent repeated physical values as grouped selections and preserve their counts through selection composition, Arrow value bridges, and physical-family sinks. Buffer repeated dictionary indices as runs and pass their counts to the RLE encoder without first expanding each run into individual indices. Preserve append order when grouped and dense writes mix, materializing pending runs when a subsequent dense append requires it. Preserve logical value counts, NaN multiplicities, and byte-size accounting while observing extrema and Bloom-filter values by group. Retain bounded-batch expansion where encoding still requires individual values, and cover grouped slicing, traversal, and index delivery. Signed-off-by: Hippolyte Barraud <[email protected]>
Bind run-end boundaries, logical slice offsets, and terminal values to indexed leaf cursors. Support Int16, Int32, and Int64 run ends, including terminal dictionary values, and emit grouped physical selections into the counted encoding pipeline. Preserve logical null handling and required-field validation while applying row and slot targets to indexed cursor batches. Activate this path for top-level run-end-encoded arrays whose values are physical leaves or dictionaries of physical leaves. Signed-off-by: Hippolyte Barraud <[email protected]>
Extend indexed leaf cursors to bind non-leaf dictionaries and structs, allowing their compositions with run-end-encoded arrays to use native traversal instead of eager materialization. Compose dictionary keys, run positions, and struct child indices while preserving logical and physical slice offsets. Maintain normalized child-field contracts, parent null propagation, and required-field validation. Signed-off-by: Hippolyte Barraud <[email protected]>
Extend indexed leaf cursors to bind list, map, and list-view child bounds, supporting their compositions with run-end-encoded arrays, dictionaries, and structs without eager structural materialization. Activate native traversal for these shapes in ordinary and content-defined-chunking row-group writes. Preserve nested slice offsets, nullability, and definition and repetition levels while delivering selected values through the physical encoding pipeline. Signed-off-by: Hippolyte Barraud <[email protected]>
Bind repeat probes once per cursor to identify repeated nested records in indexed traversal. Reuse emitted level and value-selection segments across top-level runs and repeated list children instead of walking the same structure for every logical occurrence. Preserve definition levels, repetition-level starts, and null masks during replay, and coalesce adjacent compatible value groups at replay boundaries. Add focused replay and scalar-level regression coverage alongside the existing native composition and CDC tests. Optimize shapes already supported by indexed traversal without changing the remaining eager fallback's scope. Signed-off-by: Hippolyte Barraud <[email protected]>
Route the remaining individual-column cases through leaf cursors and remove the production eager level builder, legacy leaf plans, and fallback selection logic. Use cursor-based traversal for ordinary and run-end-encoded compositions across writer entry points. Keep the existing expected-level fixtures as assertions over collected cursor output instead of emulating the deleted builder interface. Observe planned maximum levels and actual level streams, traverse sliced inputs directly, and check output across cursor batch targets. Preserve independent reader, schema, page-budgeting, dictionary, and CDC regressions, leaving surviving production helpers in place. Signed-off-by: Hippolyte Barraud <[email protected]>
Hi all! This PR adds native run-end-encoded (REE) writes to the Parquet Arrow writer, continuing the run-proportional work tracked in #9731. It avoids expanding REE inputs into dense arrays, preserving repetition through nested traversal, level generation, and physical encoding.
The change
I'm very happy to report that the REE support is now complete! REE can appear at any level of the schema, and arbitrary compositions such as
REE<List<REE<Struct<...>>>>are fully supported. We no longer materialize dense representations for REE inputs anywhere along the write path.At a high level, this required redesigning the Arrow-to-Parquet conversion pipeline. Instead of preparing fully materialized inputs for a collection of encoding paths, the writer now incrementally describes what to write and lets a shared, type-aware backend consume the original Arrow storage directly. Once that underlying architecture was in place, adding REE on top was actually not all that difficult.
This new architecture also makes almost all workloads faster, particularly when the old intermediate representation was less memory-efficient than the original Arrow one. Boolean arrays are an extreme example: Arrow gives us a bitmap, but the old path materializes it into a Rust
[bool]representation, only to eventually turn it back into a bitmap again further down the pipeline. Thebool_non_null/defaultworkload now reduces to essentially a memcpy, resulting in ~97% lower runtime (40× faster) and ~98% lower peak memory usage (61× less). This is an extreme case, but many other workloads benefit as well, includingfixed_size_binary*,decimal128, and most dictionary workloads, to varying degrees (see the performance section below).Proposed upstreaming approach
I originally intended to upstream this entirely through small, independently mergeable PRs, as we started doing with #9653. However, the REE work turned out to be too complex and wide-ranging for me to confidently publish it incrementally without risking having to revisit abstractions that had already been merged. I ultimately had to finish the implementation before I could settle on a practical upstreaming sequence.
That hopefully explains both the long gap and why I’m now showing up with exactly the kind of large PR I had hoped to avoid!
I tried to split the work into small, independently mergeable contributions, but found it difficult to keep every intermediate step both self-contained and performance-neutral without introducing dead code or making individual changes too large. In many cases, a correct and fully tested intermediate abstraction adds overhead that only disappears once its consumers are migrated. With the benchmark suite taking several hours per commit, maintaining all of these constraints across 30+ commits became completely impractical.
I’d therefore like to separate the unit of review from the unit of merging: keep commits small enough to review individually, but group them into GitHub PR stacks whose complete changes are benchmarked and merged together.
I hope this is a reasonable compromise. The 26 commits are organized into four stacks:
FixedSizeBinarydictionaries as FLBA #11262, fix(parquet): preserve distinct-count invalidation across page flushes #11264, fix(parquet): add early rejection of unsupported encodings #11266, bench(parquet): broaden Arrow writer benchmark coverage #11267, bench(parquet): measureArrowWritermemory allocation #11268, refactor(parquet): simplify guarded row-group byte-limit arithmetic #11269).Every commit on the branch remains a correct, working state with all tests, fmt, clippy, doc, etc passing. Performance, however, is guaranteed only at the final commit of each stack. Stack A contains some breaking bug fixes, but stacks B through D preserve the existing API and can be shipped without a major version change.
Performance
I realize this is a substantial amount of code to work through. Hopefully the high-level performance results below provide enough of a carrot to make the review worthwhile 🙇:
We've also integrated these changes into Datadog's private fork, where we're seeing roughly 2× higher write throughput on production-like, non-synthetic data. This isn't directly comparable to the synthetic benchmark suite above, but it gives us confidence that the improvements carry over to real-world workloads.