Skip to content

fix: Parquet wide-row writes, both fixes and all their tests together - #120029

Closed
erezrokah wants to merge 4 commits into
ClickHouse:masterfrom
cloudquery:parquet-wide-rows-end-to-end
Closed

erezrokah wants to merge 4 commits into
ClickHouse:masterfrom
cloudquery:parquet-wide-rows-end-to-end

Conversation

@erezrokah

@erezrokah erezrokah commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Related: #119300
Related: #120027
Related: #120028

The three changes the wide-row parquet case needs, together, so CI exercises them as one: the
s3() tests from #119300, the batch byte bound from #120028, and the size-statistics reset plus
the ParquetMetadata field from #120027.

Writing 1024 rows of ~2.1 MB, the case #119300 measures:

write unencoded_byte_array_data_bytes on fallback peak RSS
master array cannot contain more than 2147483646 bytes doubled 6.59 GB
#120028 alone writes still doubled 2.57 GB
#120027 alone still fails, fallback never reached unchanged 6.60 GB
this PR writes, round-trips exactly correct 2.57 GB

If the maintainers prefer a single pull request, this supersedes the three above; if they prefer
the slices, this one can be closed.

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, and fixed such a column chunk reporting its size statistics twice when it falls back from dictionary encoding. The ParquetMetadata format now also reports size_statistics for each column chunk.

Carries the three changes that the wide-row case needs, so that CI exercises them as
one: the s3 integration tests, the batch byte bound that stops the 32-bit overflow,
and the size-statistics reset on the dictionary fallback.

Neither fix is sufficient on its own. The byte bound makes the write succeed but still
reports the doubled statistics whenever the dictionary falls back, and the statistics
reset is unreachable for a wide column because the write throws before it. The
integration tests only measure the failure; they do not fix it.
@clickhouse-gh clickhouse-gh Bot added comp-formats Input/output formats (CSV/JSON/Parquet/ORC/Arrow/Protobuf/etc.). external Author is not a member of the ClickHouse organization labels Sep 14, 2026
The wide-row tests were taken from a branch cut before several changes to
test_storage_s3, and copying that whole file back dropped them: restricted_dummy
lost remote_servers.xml, and the eight-query remote host filter test, which covers
s3Cluster, icebergS3, icebergS3Cluster and IcebergS3 DDL, was replaced by two older
checks. Only the wide-row additions are applied now.

wide_rows_memory_matrix.sh appended its test block only when the file did not already
contain it, so a checkout left over from an earlier run kept the tests it was first
given. It also discarded the runner's exit status and picked the newest result JSON in
ci/tmp, which can belong to a previous run. The test file is now reset before the block
is appended, only results written after the run started are read, and a runner that
exits non-zero without producing results is reported instead of passing silently.
Carries the two review fixes from the split pull requests: a record larger than 1 GiB is
now split wherever it happens to be, dropping the column and offset indexes for that
chunk because neither can describe pages that start mid-record, and
02718_parquet_metadata_format's reference is updated for the new size_statistics field.
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.
@rschu1ze

Copy link
Copy Markdown
Member

Thanks @erezrokah . This PR is an amalgamation of #119300, #120027 and #120028. It's preferred to submit the PRs one by one.

@rschu1ze rschu1ze closed this Sep 16, 2026
@erezrokah

Copy link
Copy Markdown
Contributor Author

Thanks @erezrokah . This PR is an amalgamation of #119300, #120027 and #120028. It's preferred to submit the PRs one by one.

Thanks @rschu1ze, agree with closing. Mostly opened this as otherwise we can't have the new tests passing on a single PR

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.). external Author is not a member of the ClickHouse organization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants