Skip to content

Bound a parquet write batch by bytes, not only by rows - #122482

Merged
alexey-milovidov merged 33 commits into
masterfrom
continue-pr-120028-parquet-batch-byte-bound
Oct 8, 2026
Merged

alexey-milovidov merged 33 commits into
masterfrom
continue-pr-120028-parquet-batch-byte-bound

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Sep 26, 2026 •

Copy link
Copy Markdown
Member

Supersedes #120028 by @erezrokah, whose branch lives in an organization-owned fork that maintainers cannot push to. The original commits are kept, so the authorship stays with @erezrokah; thank you for the work and the thorough measurements.

Related: #120028
Related: #119300
Related: #120027
Related: #117754
Extended by: #120538

writeColumnImpl bites off a batch by row count alone (output_format_parquet_batch_size, 1024
rows), whatever those rows weigh, so 1024 values of a few MB reach the encoder as one
multi-gigabyte batch. That overruns the 32-bit offsets of the BinaryBuilder behind the dictionary
encoder, and then the 32-bit size of the data page.

Writing 1024 rows of ~2.1 MB:

String FixedString(2100016) peak RSS
master array cannot contain more than 2147483646 bytes, have 2148302982 ... have 2148316368 6.59 GB
moving the dictionary check alone Uncompressed page is too big: 2150407082 same 10.90 GB
this PR writes, round-trips exactly writes, round-trips exactly 2.57 GB

A batch is cut at the first record boundary at or after 64 MiB, so ordinary data is written byte for
byte as before. A record that would not fit a page at all is split wherever it happens to be,
dropping that chunk's column and offset indexes, since neither can describe pages starting mid-record.

On top of #120028 this addresses the AI review blockers there, porting the relevant parts of #120538:

  • the cut measures plain BYTE_ARRAY by what the encoding writes (4 + len per value), not payload alone;
  • fixed-width physical types are budgeted by sizeof(c_type), so one huge Array(UInt64) record is split too;
  • 05175_parquet_wide_values_no_32bit_overflow no longer gets OOM-killed on CI: the oversized-record case peaked at 8.8 GB because parallel encoding copied the whole column; it now peaks at 2.5 GB. It also covers FixedString written as BYTE_ARRAY.
  • the page budget also counts the worst-case encoded rep/def levels and, with a dictionary, the indexes, so a nested repeated column of narrow values (e.g. one huge Array(Array(FixedString(1))) row) cannot push a page past the 32-bit size through its levels; the pre-flush covers dictionary-encoded pages too.
  • a long record is handed to the converter in slices of at most max(output_format_parquet_batch_size, 65536) values, so getBatch no longer allocates per value for the whole record before the byte cut; the slices go into the same page, which still ends on a record boundary. For all physical types except BYTE_ARRAY the byte cut happens before conversion.
  • JSON values are serialized one at a time during the byte cut, so only the values that make it into the batch are serialized, not the whole row-count batch.
  • 05338_parquet_wide_batch_plain_encoding writes the same >2 GiB batch with plain encoding and no compression, checksums, bloom filter or page index, so it takes seconds in the debug build and lets the bugfix validation reproduce the bug (Uncompressed page is too big on master), which 05175 cannot since it is excluded from debug and sanitizer builds.

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Fixed Parquet output failing with Capacity error: array cannot contain more than 2147483646 bytes or Uncompressed page is too big when a batch of rows held more than 2 GiB of String or FixedString data. A batch is now bounded by bytes as well as by rows, which also lowers the peak memory of the write.

🤖 Generated with Claude Code


Workflow [PR]
Sync PR [sync-upstream/pr/122482]

Version info

  • Merged into: 26.10.1.1873-master (included in 26.10 and later)

erezrokah and others added 19 commits September 21, 2026 12:26
writeColumnImpl bit off a batch by row count alone (output_format_parquet_batch_size,
1024 rows), whatever those rows weighed, so 1024 values of a few MB reached the
encoder as one multi-gigabyte batch and overran two separate 32-bit limits.

arrow keeps the dictionary of BYTE_ARRAY and FIXED_LEN_BYTE_ARRAY in a BinaryBuilder
addressed with 32-bit offsets. The existing fallback to plain encoding asked whether
the dictionary had grown too big only after Put, so a batch over that limit threw
inside Put before the fallback could run. Checking before Put is not enough on its
own: the same batch then becomes one data page, whose size is 32-bit as well, and the
write fails with `Uncompressed page is too big` instead.

A batch is now cut at the first record boundary at or after 64 MiB. The budget only
has to keep those 32-bit quantities out of reach, so it sits far above any page a
caller would ask for and ordinary data comes out byte for byte as it did before. The
dictionary check is also made before Put and extended to FIXED_LEN_BYTE_ARRAY, which
shares that builder.
The bound was only applied at record boundaries, because that is where pages have to
start when the page index is written, and output_format_parquet_write_page_index is on
by default. A single Array(String) row larger than 2 GiB therefore stayed in one batch
and still failed with `Uncompressed page is too big`.

Such a record is now split at 1 GiB wherever it happens to be. Neither the column index
nor the offset index can describe a chunk whose pages start mid-record, so both are
dropped for it rather than written wrong: the offset index addresses whole rows through
first_row_index, and a continuation page has no row of its own to point at.
The threshold was 1 GiB, well below the page size that forces the split, so a record
between 1 GiB and 2 GiB was split and lost its page index even though master writes it
whole with a valid one. It is now just under the limit that makes the split necessary,
so only a record that would otherwise fail to write is affected.
The test timed out on the stateless runs. It peaked around 15 GB: the oversized record was
built by mapping over a range of 2200 million-byte strings, and read back with a GROUP BY
on a 2.2 GB array. The record is now collected with groupArray over many small values,
which costs 4.7 GB, and the read backs no longer group by a huge value or take uniqExact
over one - a hash of it answers the same question. Runtime goes from 12s to 3s locally.

The record still holds 2.2 GB, more than a page can address, so it is still split: with the
bound disabled the write fails with `Uncompressed page is too big: 2208800020`.
limit_batch_by_bytes ran on the converted values, so the converter had already built the whole
batch by the time it was measured. ConverterJSON serializes each value into storage of its own,
which meant a batch of wide Object values was materialized in full before being shrunk.

The batch is now cut from the source column's sizes first, and measured again afterwards because
serializing a value can grow it. Writing 1024 rows of ~2.1 MB JSON goes from 101s to 12s and from
7.58 GB to 6.62 GB peak RSS.
Cutting the batch from ColumnObject::byteSizeAt does not work: it counts the values but
not the keys or the punctuation SerializationJSON writes back out, which is why
getSerializedValueSize returns nullopt for it. Rows with many long keys and small values
stayed under the cut and were still materialized in full.

ConverterJSON now stops serializing once the batch reaches the budget and reports how much
of it it produced, and the caller shrinks the batch to that. Only for a column with no
repetition levels: a shorter batch has to stay a whole number of records when pages follow
record boundaries, and the values that would complete one have not been converted.

Writing 1024 rows whose keys serialize to ~4 MB each goes from 382s and 4.88 GB peak RSS to
19s and 0.66 GB. The wide `JSON` case in 05175 now uses long keys, which is the shape the
source column's own size does not see.
The budget was only given to a column with no repetition levels, so Array(JSON) and
Map(..., JSON) went back to being cut by ColumnObject::byteSizeAt, which does not measure
what serializing a value costs.

The converter is bounded for those as well now. Where pages follow record boundaries the
batch gives back the tail of the record it stopped inside, and a record that wants more than
the budget on its own is converted whole, because it cannot be split. Writing 1024 rows of
Array(JSON) whose keys serialize to ~4 MB each goes from 369s to 21s.

Peak RSS is unchanged at 8.4 GB for that query: it is the values themselves, not the
converter's buffer, and bounding the batch does not make the column smaller.
When the converter stopped inside the first record of the batch, the fallback asked it for
the whole provisional batch again without a budget. That batch is write_batch_size values
extended to the end of a record, so everything behind the first row was serialized as well,
and then dropped by the cut that follows.

Only the first record is converted now. On 11 rows of 100 JSON values of ~700 KB, where one
batch covers every row: 19s and 3.04 GB peak RSS before, 10.5s and 0.79 GB after, and the
file is byte for byte the same.
Plain BYTE_ARRAY prefixes every value with its 4-byte length, and the cuts counted only the
payload. A record of many small values - FixedString written as BYTE_ARRAY reaches this,
with output_format_parquet_fixed_string_as_fixed_byte_array = 0 - can therefore stay under
max_record_bytes while the page it builds does not fit.

Both cuts now add the per-value overhead: 4 bytes for BYTE_ARRAY, none for
FIXED_LEN_BYTE_ARRAY, which writes values back to back. The total they return is still the
payload alone, because that is what unencoded_byte_array_data_bytes reports.
…atch

Only BYTE_ARRAY and FIXED_LEN_BYTE_ARRAY were budgeted, so a record of fixed-width values
went to the encoder whole however large it was. Array(UInt64) of 280 million elements failed
with `Uncompressed page is too big: 2240000022`; it writes now. A batch of write_batch_size
fixed-width values is a few kilobytes, so ordinary columns never reach the cut.

ConverterJSON also sized buf and stash from the number of values it was asked for, which for
a repeated carrier is the whole record however many values that is - allocating for all of
them before the budget could stop the loop. It now appends the serialized values to one
buffer and hands out pointers into it once that buffer has stopped growing, so both it and
the lengths grow only as far as the budget allows.
The retry disabled the budget outright, so a record larger than a page was serialized whole
however large it was - which for JSON the source column's size does not predict.

It is budgeted by max_record_bytes instead. A record that fits a page is converted whole as
before; one that does not is cut where the budget runs out, which is what the split below
would do with it anyway, at the cost of the page index. The converter's peak is then what a
page can hold rather than whatever the record happens to be.

Checked with the limits lowered to 8 MiB and 32 MiB against a 70 MB record: the write splits
mid-record, the file reads back the same, and the retry stops at the budget instead of
serializing the whole record.
This branch had grown two changes with different standing: the batch byte bound, which is
demonstrable, and converter-level batching for JSON carriers, whose remaining invariants
need more than 2 GiB inside one record and cannot be exercised by a test runner.

Only the byte bound and the oversized-record split are left here. The converter work
continues on parquet-json-converter-budget and opens once this lands, since it builds on
this change.
Bounding the batch is not enough on its own: the page keeps taking batches until it reaches
output_format_parquet_data_page_size, and that setting has no upper bound. Set near the
32-bit page limit, ordinary String data still reached `Uncompressed page is too big`.

The page target is capped at the same limit a record is split on, so it no longer depends on
the setting staying small. The default of 1 MiB is unaffected.
The page size was only checked after `encoder->Put`, against a target of 2 GiB - 64 MiB. A
record can legally be almost that large on its own, so with a raised
`output_format_parquet_data_page_size` a ~1.99 GB `Array(String)` record left the page just under
the target, the next ~200 MB record went in whole, and the page failed with
`Uncompressed page is too big: 2190016121`.

When the page already holds data and the next batch's encoded size would push it past the limit,
the page is flushed first and the batch starts the next one. The check runs before the batch's
statistics and bloom filter hashes are accumulated, so nothing is attributed to the page it no
longer joins. Dictionary-encoded pages hold only indices and are left alone.
…ch cut

Addresses the AI review blockers on this PR. `limit_batch_by_bytes` counted only the payload of a
`BYTE_ARRAY` value, while plain encoding also writes a 4-byte length prefix per value, so a
repeated record of many small values could stay below `max_record_bytes` and still build a page
past `INT32_MAX`. The cut now measures `4 + len` per value; the returned total stays payload-only
because it feeds `unencoded_byte_array_data_bytes`.

Fixed-width physical types were not budgeted at all, so one huge `Array(UInt64)` record still
reached `encoder->Put` whole. They are now budgeted by `sizeof(c_type)`; a batch that cannot reach
the budget skips the walk, so ordinary columns pay nothing.

Both changes are ported from #120538.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The oversized-record case was killed on every CI run (`Stateless tests (arm_binary, sequential)`
and the flaky check): `groupArray` plus parallel encoding, which hands the encoder a copy of the
whole 2.2 GB column, peaked at 8.8 GB. Building the array with `arrayMap` and disabling
`output_format_parquet_parallel_encoding` brings it to 2.5 GB, in line with the other cases.

Also covers `FixedString` written as `BYTE_ARRAY`, which goes through the length-prefix budget.

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=120028&sha=d3c980b416ac2b57d32041db8c4da3fcd38c4ca9&name_0=PR
PR: #120028

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [d664d62]

Summary: ✅


AI Review

Summary

This PR bounds Parquet write batches by bytes as well as rows, adds the missing budget checks for dictionary and level overhead, and introduces regression tests for wide values and long repeated records. The earlier overflow and JSON-specific issues from the prior review threads look fixed in the current code, but I still see one important gap: the large-record regression only passes after disabling output_format_parquet_parallel_encoding, while the default writer path still buffers an entire encoded column chunk in memory, so the claimed peak-memory improvement is incomplete for the shipped default.

Missing context / blind spots
  • ⚠️ Most heavyweight CI jobs were still pending while I reviewed, so I could not confirm the new memory-heavy cases against finished asan, debug, and binary results in the current PR workflow.
Findings

⚠️ Majors

  • [tests/queries/0_stateless/05175_parquet_wide_values_no_32bit_overflow.sh:46] The oversized Array(String) case is only green because the test forces output_format_parquet_parallel_encoding = 0, but the default remains true at src/Core/FormatFactorySettings.h:1348, and the parallel path still buffers the whole encoded column chunk in src/Processors/Formats/Impl/ParquetBlockOutputFormat.cpp:504. That leaves the default writer configuration on the same multi-GiB extra-copy path for exactly this case, so users can still hit MEMORY_LIMIT_EXCEEDED even though writeColumnImpl itself now splits the batch correctly.
    Suggested fix: bypass the parallel buffering path for oversized chunks, or stream worker output directly instead of proving the case only under the sequential fallback.
Final Verdict

⚠️ Needs one more fix before merge: the writeColumnImpl changes themselves look sound, but the default Parquet writer path still keeps the wide-record memory spike that the new test avoids by turning parallel encoding off.

LLVM Coverage Report

Measured on commit d664d62.

Metric Baseline Current Δ
Lines 88.30% 88.30% +0.00%
Functions 92.10% 92.10% +0.00%
Branches 79.70% 79.70% +0.00%

Changed lines: Changed C/C++ lines covered: 154/164 (93.90%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added pr-bugfix Pull request with bugfix, not backported by default comp-formats Input/output formats (CSV/JSON/Parquet/ORC/Arrow/Protobuf/etc.). labels Sep 26, 2026
@clickhouse-gh

clickhouse-gh Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing d664d6297 with master c0289e05c (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Object file sizes

7 object files changed (+255.70 KiB total), 0 added.

Object file Master PR Δ
src/CMakeFiles/dbms.dir/Processors/Formats/Impl/Parquet/Write.cpp.o 1.06 MiB 1.31 MiB +254.75 KiB (+23.44%)

719 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only clickhouse-bundle) and not compared.

Compile time of recompiled translation units

9 translation units recompiled, 29 s compile time in total, 9 of them have a recent master baseline.

Job report

@erezrokah

Copy link
Copy Markdown
Contributor

Thanks @alexey-milovidov for picking this up and carrying it over the line, and for the 05175 memory fix. Sorry the org fork blocked maintainer pushes.

Ubuntu and others added 2 commits October 1, 2026 16:20
Address review: the batch cut and the pre-flush only counted the values,
so a nested repeated column of narrow values could still build a page past
the 32-bit page size. One row of `Array(Array(FixedString(1)))` with inner
arrays of length 2 keeps about 2.08 GiB of values at the split point, and
its repetition levels alone add about 520 MiB, so `flush_page` threw
`Uncompressed page is too big`.

The budget now adds the most the rep and def levels can take, the same
bound `encodeRepDefLevelsRLE` reserves, and, with a dictionary, the most
the RLE of the indexes can take for the dictionary size the batch may
reach. The pre-flush applies to dictionary-encoded pages as well. An
oversized record is now cut before the value that would carry the page
past the bound rather than after it, so one wide value at the boundary
cannot overshoot it either. All of these are worst cases, so pages of
ordinary data stay as they were.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@CLAassistant

CLAassistant commented Oct 1, 2026 •

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 3 committers have signed the CLA.

✅ alexey-milovidov
✅ erezrokah
❌ Ubuntu


Ubuntu seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

clickgapai pushed a commit to clickgapai/ClickHouse that referenced this pull request Oct 2, 2026
…nce per block

`mortonEncode` with two arguments ran one row loop for every argument type
and mask: per row and argument it tested the mask and `is_const`, reloaded
the ratio, switched on the column width and, with a mask, called the
out-of-line `expand` (36 call sites in the arm `executeImpl`). On arm the
speed of the branch-dense paths depends on the binary's layout, so
`space_filling_curve` ClickHouse#1 (constant mask) and ClickHouse#4 (`UInt32` arguments) have
per-build speed modes and flag unrelated PRs in Performance Comparison
(ClickHouse#122482), while ClickHouse#2 (two `UInt64` columns) is stable.

Now each argument is resolved once per call into a contiguous `UInt64` array
with the range expansion applied: a `UInt64` column that needs no expansion
is read in place, other widths are widened with one type dispatch, and a
constant ratio is applied in one loop per ratio value (`expand` is
`ALWAYS_INLINE` and called with a template-constant ratio, so its switch
folds). A per-row mask keeps the per-row `expand`. `nd == 1` writes the
result column directly. The encode loops only encode.

x86, one core, median fix/base of 5 interleaved rounds over the queries of
`space_filling_curve.xml`: ClickHouse#1 0.57 (BMI2) / 0.55 (lookup-table path, built
with `-mno-bmi2`), ClickHouse#2/ClickHouse#3/ClickHouse#6 0.45-0.64, ClickHouse#4 0.86-0.88, untouched functions
0.99-1.03. Results are unchanged: 545 checksums over every width, mask and
ratio are byte-identical before and after on both code paths, and the new
test fails on both paths under two mutations of the change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
alexey-milovidov and others added 2 commits October 3, 2026 18:46
…erflow` within CI memory

The `FixedString(2100016)` case built a 2 GiB `String` column with `concat` and then converted it
with `toFixedString`, whose output is rounded up to a 4 GiB allocation, so with both columns alive
the query needed about 6 GiB and hit the 4.5 GiB limit in `Stateless tests (arm_binary, sequential)`
and the flaky check. Padding the number itself with `toFixedString` keeps the 1024 values distinct
and wide without the intermediate `String` column; the query now peaks at 2.6 GB RSS and the
reference is unchanged.

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=122482&sha=470b8f048b927b87a57e3c5f991b0e93082a3991&name_0=PR
PR: #122482

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Merged master and fixed the 05175_parquet_wide_values_no_32bit_overflow failures in Stateless tests (arm_binary, sequential) and the flaky check (81307a5). The FixedString(2100016) case had built a 2 GiB String with concat and then run toFixedString on it. That function rounds its output up to a 4 GiB allocation, so the query needed about 6.6 GiB, over the 4.5 GiB limit. It now pads the number itself with toFixedString, which peaks at 2.6 GB RSS. The reference output is unchanged, and locally the whole test matches the reference.

@groeneai, thanks for #123354 on the ARM space_filling_curve noise.

The CLA check is still red, and it needs a human decision. Two commits (0a31925 and 470b8f0) were made with a misconfigured identity, Ubuntu <[email protected]>, which no GitHub account can claim. Clearing the check means either a maintainer override or rewriting those two commits, which needs a force-push or a replacement PR. I have not rewritten published history.

alexey-milovidov and others added 2 commits October 5, 2026 08:58
Address review: the byte budget was applied only after `getBatch` had
materialized the whole record, so a converter that allocates per value
(`ConverterFixedString`, `ConverterString`, `ConverterJSON`, ...) still
allocated for every value of a huge repeated record, e.g. ~1.4 billion
`FixedLenByteArray` pointers for one `Array(Array(FixedString(1)))` row.

Now a record is extended into a batch only up to
`max(write_batch_size, 65536)` values; the rest of it goes in following
batches of the same page. A page is flushed only at a record boundary
(unless it would grow past `max_record_bytes`), so pages still start where
the page index says they do. For all types except `BYTE_ARRAY` the batch is
cut by bytes before it is converted, since the value size is known without
converting. The page index is invalidated in `flush_page` whenever a page
ends inside a record, whichever check caused it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

@groeneai

groeneai commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

All three have fixing PRs in progress; I checked each against the logs of the 81307a50 run:

The current head c19fe03e93d0 includes the revert #123789, so these arm_binary jobs do not run on it. #123790 re-adds the ParallelReplicas job and does not touch 05257 or 03008, so those two come back unless #123729 and #123695 land first.

alexey-milovidov and others added 2 commits October 6, 2026 01:40
The fast test build has no `Parquet` format, so the test failed there with
`Unknown format Parquet`. Tag it `no-fasttest`, and give it a number that
does not collide with `05325_parallel_replicas_progress_total_rows` from master.

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=122482&sha=c19fe03e93d01e5942ab950401019995c885b98a&name_0=PR&name_1=Fast%20test
#122482

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Merged master and fixed the Fast test failure (cc94a34): the new test failed there with Unknown format Parquet because the fast test build has no Parquet. It is now tagged no-fasttest and renumbered to 05331_parquet_long_record_converter_slices, since master already has a 05325_ test. It matches its reference locally. The new_tests_check failure in Finish Workflow happened only because the bugfix validation jobs were dropped after the fast test failed.

@groeneai, thanks for linking #123790, #123729 and #123695 for the three unrelated arm_binary failures.

… to the byte cut

`ConverterJSON::getBatch` serialized every row of the batch into its stash before
`limit_batch_by_bytes` could cut it, so 1024 rows of ~2 MiB `JSON` were materialized as
~2 GiB of text before the batch was trimmed to ~64 MiB. The converter now serializes
values one at a time on demand: the byte cut asks for each value's size in order, and
only the values that end up in the batch are serialized.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
alexey-milovidov and others added 3 commits October 7, 2026 05:39
`valueSize` is called per value by the byte cut of a `Parquet` batch, and
`getDefaultSerialization` of `Object` rebuilds the typed-path serializations,
so create it once in the constructor instead of on every call.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`05175_parquet_wide_values_no_32bit_overflow` is excluded from debug and sanitizer builds, which are
the only builds the bugfix validation runs, so the fix could not be validated. The new test writes
the same 1024 rows of ~2.1 MB with plain encoding and without compression, checksums, a bloom filter
and the page index. On master it fails with `Uncompressed page is too big` (and aborts on an
assertion in `writeFileFooter` in the debug build) after about 7 seconds of debug time; with the fix
it round-trips.

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=122482&sha=933913101bf002595d381fe2f0feb4ffba2dea33&name_0=PR&name_1=Finish%20Workflow
#122482

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Merged master and added 05338_parquet_wide_batch_plain_encoding (fbd5d79) for the red Finish Workflow check. The bugfix validation could not reproduce the bug because it only runs debug and sanitizer builds, and 05175 is excluded from all of them. The new test writes the same >2 GiB batch with plain encoding and without compression, checksums, a bloom filter or the page index. That takes about 7 s even with the master arm_debug binary. On master it fails with Uncompressed page is too big: 2150407082 (the release binary throws; the debug binary also aborts on chassert(file.current_row_group.row_group.columns.empty()) in writeFileFooter). With this PR it round-trips.

alexey-milovidov and others added 2 commits October 8, 2026 06:45
…tch_plain_encoding`

Reading the string column back peaks at about 5.6 GB of RSS, more than the 4.5 GiB memory limit of
the CI runners, so the test failed with `MEMORY_LIMIT_EXCEEDED` in the read stage. The regression is
in the writer, so check the result through `ParquetMetadata` and read only the narrow column.

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=122482&sha=latest&name_0=PR&name_1=Finish%20Workflow
#122482

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good.

@alexey-milovidov alexey-milovidov self-assigned this Oct 8, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 8, 2026
Merged via the queue into master with commit 816b254 Oct 8, 2026
153 checks passed
@alexey-milovidov
alexey-milovidov deleted the continue-pr-120028-parquet-batch-byte-bound branch October 8, 2026 22:44
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-formats Input/output formats (CSV/JSON/Parquet/ORC/Arrow/Protobuf/etc.). pr-bugfix Pull request with bugfix, not backported by default pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants