Skip to content

parquet: byte-budget mini-batches round up on nullable columns, limiting DELTA_BYTE_ARRAY dedup for over-limit values #10538

Closed

Description

@adriangb

Is your feature request related to a problem or challenge?

Follow-up to #10505 (which fixes #10489). The mechanism described here is on main today and dates to #9972; #10505 raises its cost but does not introduce it.

When write_batch_internal must sub-batch a chunk because values might overflow the data page byte budget, byte_budget_sub_batch_size computes how many values fit and converts that to a level count using the chunk-wide level:value ratio, rounded up:

(values_per_subbatch * chunk_size).div_ceil(vals_in_chunk).max(1)

For a chunk with no nulls this is exact. With at least one null in the chunk, one value maps to two levels (17 levels : 16 values gives ceil(17/16) = 2), and write_granular_chunk slices the whole chunk into uniform two-level windows, most of which carry two values.

Two observable effects for values larger than data_page_size_limit:

Worked example (pinned by test_column_writer_delta_byte_array_nullable_shared_prefix_partial_dedup in #10505): 16 identical 64 KiB values with one null at index 8, against a 16 KiB page limit. Result is pages of [2, 2, 2, 2, 9] levels with ~5 values stored in full, vs ~1 ideally. Null position sets the severity: a null early in the chunk costs almost nothing, a null at the end means about half the chunk's values are stored in full.

Describe the solution you'd like

Cut mini-batch windows after an exact number of values rather than a ratio-scaled number of levels, in the granular path only. Shape-wise: either the chunker returns a value count and write_granular_chunk ends each window by walking def levels until it has covered that many values, or the chunker produces per-window boundaries.

Cost: the walk only runs in the granular path (values already overflowing a page budget) and touches each of the chunk's levels once; that path already does full def-level (value_count) and rep-level (record alignment) passes. Values in this regime are larger than the page limit by definition, so the walk is noise next to the value writes, and the change strictly reduces bytes written and page count where it fires.

Acceptance criterion: the worked example becomes one ~64 KiB page of 17 levels. The pinning test then fails with the improved layout and should be re-pinned; its comment says exactly that.

Scope note: for repeated columns, records never span pages, so a single record containing several over-limit values can never yield a one-value opening window. That case is inherent; the improvement targets flat nullable columns.

Describe alternatives you've considered

Additional context

#9972 introduced byte-budget sub-batching; #10489 reports the dedup regression; #10505 restores dedup (fully for chunks without nulls) and pins the nullable gap as a known limitation.

Activity

  1. added 5 commits that reference this issue on Aug 4, 2026
    5af13c0
    9a4c021
    3671a55
    de7a544
    9ac4026
  2. added 5 commits that reference this issue on Aug 18, 2026
    6584407
    bd66b9e
    a8b0515
    aa00d82
    d096d94
  3. added a commit that references this issue on Aug 24, 2026
    c7591d1
  4. added a commit that references this issue on Aug 26, 2026
    a2e0d90
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions