Repository navigation
Add a corpus of Parquet files and Iceberg tables from many writers - #128305
Conversation
437 Parquet files from 15 writer versions (pyarrow, Spark, arrow-go, DuckDB, delta-rs, polars, fastparquet, parquet-go, arrow-testing) and 29 Iceberg tables under `tests/queries/0_stateless/data_lake_corpus/`, with stateless tests `05473`-`05478` that compare what ClickHouse reads with what the writer read back, and the generator in `utils/data-lake-corpus/`. Ported from ClickHouse/clickhouse-private#84081. The corpus found three problems in the native Parquet reader that are fixed here, because the tests fail on debug and sanitizer builds without them: - column chunks of zero length made the prefetch memory amplification NaN, which is undefined behavior to convert to `size_t` (UBSan in `Prefetcher::startPrefetch`, then an exception on `chassert(diff.by_stage[i] >= 0)` in `ReadManager::scheduleTasksIfNeeded`); - arrow-go writes data pages V2 that begin in the middle of a row together with an offset index; the reader relied on pages beginning on row boundaries (an exception on `chassert(page.value_idx == 0)` in `Reader::decodePrimitiveColumn`), now such a page is rejected with `INCORRECT_DATA`; - `DELTA_BINARY_PACKED` miniblocks wider than the value type (DuckDB and arrow-go write 33-bit miniblocks in `INT32` columns) left the output uninitialized, so the result was random; now they are rejected with `INCORRECT_DATA`. The two heaviest tests are tagged `long`: their CPU time on sanitizer builds exceeds the 180 s limit of the flaky check.
|
Workflow [PR], commit [3a6ee66] Summary: ✅
AI ReviewSummaryThe PR adds a multi-writer Parquet and Iceberg interoperability corpus, six stateless tests, corpus generators, and three native Parquet reader checks. Reviewing head Missing context / blind spots
Findings❌ Blockers
Final VerdictStatus: ❌ Block. Move the binary corpus out of the main repository before merging and obtain completed results for the new corpus tests on the current head. |
| {"columns": ["id", "s", "p", "ts"], "expected": "expected/158d8c57ebd933bf.jsonl.zst", "file": "iceberg/v2_copy_on_write", "group": "iceberg", "kind": "iceberg", "predicates": [{"count": 0, "where": "`id` < 10"}, {"count": 3, "where": "`id` >= 25"}, {"count": 0, "where": "`id` = 7"}, {"count": 0, "where": "`p` = 2"}], "rows": 3, "size": 153687, "snapshots": [{"columns": ["id", "s", "p", "ts"], "expected": "expected/9cf8adc392cdc2eb.jsonl.zst", "operation": "append", "rows": 30, "snapshot_id": 6397056422203872451, "timestamp_ms": 1793282169157}, {"columns": ["id", "s", "p", "ts"], "expected": "expected/5a13d39f976b7b2c.jsonl.zst", "operation": "append", "rows": 50, "snapshot_id": 2967756849477575088, "timestamp_ms": 1793282169497}, {"columns": ["id", "s", "p", "ts"], "expected": "expected/f82bb3a06d08b5eb.jsonl.zst", "operation": "delete", "rows": 37, "snapshot_id": 2288382876463462810, "timestamp_ms": 1793282170984}, {"columns": ["id", "s", "p", "ts"], "expected": "expected/fcaae5fc3d06ad9c.jsonl.zst", "operation": "overwrite", "rows": 37, "snapshot_id": 4161512870137102635, "timestamp_ms": 1793282171782}, {"columns": ["id", "s", "p", "ts"], "expected": "expected/158d8c57ebd933bf.jsonl.zst", "operation": "overwrite", "rows": 3, "snapshot_id": 3879520367009663832, "timestamp_ms": 1793282172155}, {"columns": ["id", "s", "p", "ts"], "expected": "expected/158d8c57ebd933bf.jsonl.zst", "operation": "replace", "rows": 3, "snapshot_id": 867254101308908265, "timestamp_ms": 1793282175443}], "statements": ["CREATE TABLE local.db.v2_copy_on_write (id BIGINT, s STRING, p INT, ts TIMESTAMP) USING iceberg PARTITIONED BY (p) TBLPROPERTIES ('format-version' = '2')", "INSERT INTO local.db.v2_copy_on_write SELECT id, concat('v', CAST(id AS STRING)) AS s, CAST(id % 4 AS INT) AS p, timestamp_micros(id * 7200000000) AS ts FROM range(0, 30) t(id)", "INSERT INTO local.db.v2_copy_on_write SELECT id, concat('v', CAST(id AS STRING)) AS s, CAST(id % 4 AS INT) AS p, timestamp_micros(id * 7200000000) AS ts FROM range(30, 50) t(id)", "DELETE FROM local.db.v2_copy_on_write WHERE id % 4 = 1", "UPDATE local.db.v2_copy_on_write SET s = 'cow' WHERE id < 5", "INSERT OVERWRITE local.db.v2_copy_on_write SELECT * FROM (SELECT id, concat('v', CAST(id AS STRING)) AS s, CAST(id % 4 AS INT) AS p, timestamp_micros(id * 7200000000) AS ts FROM range(100, 110) t(id)) WHERE p = 0", "CALL local.system.rewrite_data_files(table => 'db.v2_copy_on_write')", "CALL local.system.rewrite_manifests('db.v2_copy_on_write')"], "status": "ok", "subcolumns": [], "writer": "spark+iceberg", "writer_profile": "spark-3.5.5-iceberg-1.12.0", "writer_version": "spark 3.5.5, iceberg 1.12.0"} | ||
| {"columns": ["id", "s", "p", "ts"], "expected": "expected/6f7453ed7198ef43.jsonl.zst", "file": "iceberg/v2_gzip_metadata", "group": "iceberg", "kind": "iceberg", "predicates": [{"count": 10, "where": "`id` < 10"}, {"count": 5, "where": "`id` >= 25"}, {"count": 1, "where": "`id` = 7"}, {"count": 7, "where": "`p` = 2"}], "rows": 30, "size": 28727, "snapshots": [{"columns": ["id", "s", "p", "ts"], "expected": "expected/5ff7b4ee2ced6ac4.jsonl.zst", "operation": "append", "rows": 25, "snapshot_id": 2947062087288793237, "timestamp_ms": 1793282184884}, {"columns": ["id", "s", "p", "ts"], "expected": "expected/6f7453ed7198ef43.jsonl.zst", "operation": "append", "rows": 30, "snapshot_id": 947471234371715281, "timestamp_ms": 1793282185149}], "statements": ["CREATE TABLE local.db.v2_gzip_metadata (id BIGINT, s STRING, p INT, ts TIMESTAMP) USING iceberg TBLPROPERTIES ('format-version' = '2', 'write.metadata.compression-codec' = 'gzip')", "INSERT INTO local.db.v2_gzip_metadata SELECT id, concat('v', CAST(id AS STRING)) AS s, CAST(id % 4 AS INT) AS p, timestamp_micros(id * 7200000000) AS ts FROM range(0, 25) t(id)", "INSERT INTO local.db.v2_gzip_metadata SELECT id, concat('v', CAST(id AS STRING)) AS s, CAST(id % 4 AS INT) AS p, timestamp_micros(id * 7200000000) AS ts FROM range(25, 30) t(id)"], "status": "ok", "subcolumns": [], "writer": "spark+iceberg", "writer_profile": "spark-3.5.5-iceberg-1.12.0", "writer_version": "spark 3.5.5, iceberg 1.12.0"} | ||
| {"columns": ["id", "s", "p", "ts"], "expected": "expected/a2a08585332a7690.jsonl.zst", "file": "iceberg/v2_identity_days", "group": "iceberg", "kind": "iceberg", "predicates": [{"count": 10, "where": "`id` < 10"}, {"count": 15, "where": "`id` >= 25"}, {"count": 1, "where": "`id` = 7"}, {"count": 10, "where": "`p` = 2"}], "rows": 40, "size": 35279, "snapshots": [{"columns": ["id", "s", "p", "ts"], "expected": "expected/a2a08585332a7690.jsonl.zst", "operation": "append", "rows": 40, "snapshot_id": 4210855623675168100, "timestamp_ms": 1793282153172}], "statements": ["CREATE TABLE local.db.v2_identity_days (id BIGINT, s STRING, p INT, ts TIMESTAMP) USING iceberg PARTITIONED BY (p, days(ts)) TBLPROPERTIES ('format-version' = '2')", "INSERT INTO local.db.v2_identity_days SELECT id, concat('v', CAST(id AS STRING)) AS s, CAST(id % 4 AS INT) AS p, timestamp_micros(id * 7200000000) AS ts FROM range(0, 40) t(id)"], "status": "ok", "subcolumns": [], "writer": "spark+iceberg", "writer_profile": "spark-3.5.5-iceberg-1.12.0", "writer_version": "spark 3.5.5, iceberg 1.12.0"} | ||
| {"columns": ["id", "s", "p", "ts"], "expected": "expected/d19e6d7bc23cc6f3.jsonl.zst", "file": "iceberg/v2_mixed_formats_codecs", "group": "iceberg", "kind": "iceberg", "predicates": [{"count": 10, "where": "`id` < 10"}, {"count": 25, "where": "`id` >= 25"}, {"count": 1, "where": "`id` = 7"}, {"count": 12, "where": "`p` = 2"}], "rows": 50, "size": 1163141, "snapshots": [{"columns": ["id", "s", "p", "ts"], "expected": "expected/7f4ed0cc554f85ca.jsonl.zst", "operation": "append", "rows": 10, "snapshot_id": 3099438573052137751, "timestamp_ms": 1793282188466}, {"columns": ["id", "s", "p", "ts"], "expected": "expected/a6b2d97116a1ff2c.jsonl.zst", "operation": "append", "rows": 20, "snapshot_id": 6941196498509420676, "timestamp_ms": 1793282189008}, {"columns": ["id", "s", "p", "ts"], "expected": "expected/ecfcbe9d86706611.jsonl.zst", "operation": "append", "rows": 30, "snapshot_id": 2668364385668635467, "timestamp_ms": 1793282189446}, {"columns": ["id", "s", "p", "ts"], "expected": "expected/03b8850e5c6d68f9.jsonl.zst", "operation": "append", "rows": 40, "snapshot_id": 1610403782763034199, "timestamp_ms": 1793282189947}, {"columns": ["id", "s", "p", "ts"], "expected": "expected/d19e6d7bc23cc6f3.jsonl.zst", "operation": "append", "rows": 50, "snapshot_id": 624117092023252599, "timestamp_ms": 1793282190521}], "statements": ["CREATE TABLE local.db.v2_mixed_formats_codecs (id BIGINT, s STRING, p INT, ts TIMESTAMP) USING iceberg TBLPROPERTIES ('format-version' = '2', 'write.parquet.compression-codec' = 'zstd')", "INSERT INTO local.db.v2_mixed_formats_codecs SELECT id, concat('v', CAST(id AS STRING)) AS s, CAST(id % 4 AS INT) AS p, timestamp_micros(id * 7200000000) AS ts FROM range(0, 10) t(id)", "ALTER TABLE local.db.v2_mixed_formats_codecs SET TBLPROPERTIES ('write.parquet.compression-codec' = 'gzip')", "INSERT INTO local.db.v2_mixed_formats_codecs SELECT id, concat('v', CAST(id AS STRING)) AS s, CAST(id % 4 AS INT) AS p, timestamp_micros(id * 7200000000) AS ts FROM range(10, 20) t(id)", "ALTER TABLE local.db.v2_mixed_formats_codecs SET TBLPROPERTIES ('write.parquet.compression-codec' = 'uncompressed', 'write.parquet.page-row-limit' = '3')", "INSERT INTO local.db.v2_mixed_formats_codecs SELECT id, concat('v', CAST(id AS STRING)) AS s, CAST(id % 4 AS INT) AS p, timestamp_micros(id * 7200000000) AS ts FROM range(20, 30) t(id)", "ALTER TABLE local.db.v2_mixed_formats_codecs SET TBLPROPERTIES ('write.format.default' = 'orc', 'write.orc.compression-codec' = 'snappy')", "INSERT INTO local.db.v2_mixed_formats_codecs SELECT id, concat('v', CAST(id AS STRING)) AS s, CAST(id % 4 AS INT) AS p, timestamp_micros(id * 7200000000) AS ts FROM range(30, 40) t(id)", "ALTER TABLE local.db.v2_mixed_formats_codecs SET TBLPROPERTIES ('write.format.default' = 'parquet', 'write.parquet.compression-codec' = 'snappy', 'write.parquet.bloom-filter-enabled.column.id' = 'true')", "INSERT INTO local.db.v2_mixed_formats_codecs SELECT id, concat('v', CAST(id AS STRING)) AS s, CAST(id % 4 AS INT) AS p, timestamp_micros(id * 7200000000) AS ts FROM range(40, 50) t(id)"], "status": "ok", "subcolumns": [], "writer": "spark+iceberg", "writer_profile": "spark-3.5.5-iceberg-1.12.0", "writer_version": "spark 3.5.5, iceberg 1.12.0"} |
There was a problem hiding this comment.
[P1] Keep the generated binary corpus outside the main Git history
This corpus adds over 10 MB of binary fixtures directly to the repository, including iceberg/v2_mixed_formats_codecs/data/00000-185-2c1f7c59-4239-49f9-9f88-081d0f5fb25e-0-00001.parquet at 1,049,896 bytes. That violates the restriction on committing large binary datasets: the blobs permanently increase clone/history size, and regenerating files with fresh UUIDs and timestamps adds further copies. The absence of third-party writers in CI does not require storing their output in the main repository. Please publish a versioned corpus artifact and download it before running these checks, retaining the generator, manifest, and text references in Git.
There was a problem hiding this comment.
No problem, let's accept.
`PODArray` has no `at`, which broke `Build (arm_tidy, 4/4)`: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=128305&sha=aee9243b930569d6c8c0eaa68009a45d0dae8129&name_0=PR&name_1=Build%20%28arm_tidy%2C%204%2F4%29
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units9 translation units recompiled, 33 s compile time in total, 9 of them have a recent master baseline. |
The test ran 160-211 s in every flaky check (amd_binary, amd_debug, amd_asan_ubsan) and failed on the 180 s limit. Every round trip costs about the same, so the variants that only change the format version, the codec, the page index or the parallel encoder now run on the flat and the nested dataset only, while the variants that change value, page and row-group layout still run on every dataset. 153 round trips become 81; v2.latest is dropped since it is the default. https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=128305&sha=latest&name_0=PR&name_1=Stateless%20tests%20(amd_binary%2C%20flaky%20check) #128305
…olumn reads The corpus test added in ClickHouse#128305 recorded `NOT_FOUND_COLUMN_IN_BLOCK` for `st.x` and `st.y` of the two schema-evolution tables, which is the bug this PR fixes (ClickHouse#128304). With the fix they read correctly. https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=125439&sha=9fe14419561a364025085b57a894cced615832e7&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20parallel%29
…pty-data-pages Picks up ClickHouse#128305, whose 05473_parquet_corpus_pyarrow pins nested.tiny_pages.dpv2.parquet as a known INCORRECT_DATA error. This PR makes that file readable, so the merge queue failed on the pinned line.
The corpus from ClickHouse#128305 records `INCORRECT_DATA` for the `WHERE u64 > 9223372036854775807` checks of the polars 0.20.31 files, whose UInt64 statistics are written in signed order and are inverted. With inverted statistics ignored, these 9 checks now return the count the writer itself reads back (`ok`). No other line of the corpus tests (05359, 05473-05478) changes. The master merge before this commit brings in the corpus, which did not exist on the branch; without it the merge queue fails 05474. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…te test Commit 3a6ee66 in ClickHouse#128305 cut 72 of the 153 round trips of `05478_parquet_corpus_clickhouse_writer` to keep it under the 180 s limit of the flaky check: the format version, codec, page index and parallel encoder variants on the 7 datasets other than the flat and the nested one, and `v2.latest` on every dataset. `05479_parquet_corpus_clickhouse_writer_codecs` runs exactly those 72 round trips, so the two tests together cover the full matrix again and each stays well under the limit.
ClickHouse#128336 ignores inverted Parquet statistics, so the 9 polars 0.20.31 `WHERE u64 > 9223372036854775807` checks that ClickHouse#128305 recorded as `INCORRECT_DATA` now return the count the writer reads back. The merge queue landed ClickHouse#128336 without its commit that updated these rows (a87c586), so master fails this test. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A static corpus of Parquet files and Iceberg tables written by many third-party writers, with stateless tests that compare what ClickHouse reads with what the writer itself read back from the same file.
Related: #104856
Related: #125134
The corpus is 13.8 MB in about 1200 files, comparable to the existing
data_parquetdirectory (47 MB in 134 files). The files of other writers cannot be produced at test time (CI has no pyarrow, Spark, DuckDB, or Go), only the ClickHouse-written files are, by05478.What is in the corpus
tests/queries/0_stateless/data_lake_corpus/(13.8 MB): 437 Parquet files, 29 Iceberg tables, and references for 50 files of thecontrib/parquet-testingsubmodule (read from the submodule, not copied).manifest.jsonlrecords the writer, its version,created_by, and the options of every file.Variety: format versions 1.0/2.4/2.6, data page v1/v2,
PLAIN,RLE_DICTIONARY/PLAIN_DICTIONARYwith dictionary fallback,DELTA_BINARY_PACKED,DELTA_LENGTH_BYTE_ARRAY,DELTA_BYTE_ARRAY,BYTE_STREAM_SPLIT(floats, ints, FLBA, decimals),RLEbooleans; none/snappy/gzip/brotli/zstd/LZ4 (Hadoop framing, from Spark)/LZ4_RAW; page index, bloom filters, checksums, statistics on/off and truncated, INT96, legacy list/map layouts, decimals as INT32/INT64/FLBA/BYTE_ARRAY, UUID, float16, TIME,HUGEINT/UHUGEINT/INTERVAL/UNION/ENUMfrom DuckDB, empty files, empty and single-row row groups, all-null columns, a 200-column schema, column names that need quoting, an encrypted file. Iceberg: format v1/v2/v3, every partition transform, partition evolution (includingvoid), schema evolution chains, position deletes, deletion vectors, copy-on-write, compaction, sort order, gzip metadata, ORC, Avro and mixed data files, name mapping,version-hint.textand SQL-catalog metadata names, time travel over every snapshot.Tests
05473_parquet_corpus_pyarrow,05474_parquet_corpus_writers,05475_parquet_corpus_external: for every file, the inferred types, the content hash against the writer's readback (parsed withJSONEachRowinto the inferred types), the same with stress settings (block size 7, no offset index, no pushdown, preserve order), each column and subcolumn read alone, and filters with counts computed by the generator.05476_parquet_corpus_bad_files: corrupt, out-of-spec, encrypted, and fuzzer files must fail with an error code (no crash, noLOGICAL_ERROR) or be read.05477_iceberg_corpus: the same checks foricebergLocal, for every snapshot withiceberg_snapshot_id.05478_parquet_corpus_clickhouse_writer: every dataset written by ClickHouse with 17 variants of theoutput_format_parquet_*settings and read back.All checks of a test run in a few
clickhouse-localprocesses; a release build needs 2 to 45 seconds per test.05473and05474are taggedlong: in the flaky check (all workers run copies of the same test) their CPU time on ASan exceeds the 180 s limit. The generator isutils/data-lake-corpus/generate.py: every writer runs in its ownuvenvironment with pinned versions (Spark with JDK 17, Go writers fromwriters/go/go.mod).generate.py roundtripreads ClickHouse-written files with pyarrow, DuckDB, polars, fastparquet, and Spark (not part of CI).Fixed here
The tests failed on debug and sanitizer builds (an exception on a
chassertor a UBSan report) on three problems of the native Parquet reader, so they are fixed in this PR:0 / 0, and converting the NaN tosize_tis undefined behavior (Prefetcher::startPrefetch); in debug builds the garbage memory estimate then failedchassert(diff.by_stage[i] >= 0)inReadManager::scheduleTasksIfNeeded. The same fix is in Test reading the entireapache/arrow-testingcorpus #125134.chassert(page.value_idx == 0)inReader::decodePrimitiveColumn, a misleading error in release builds). Such a page is now rejected withINCORRECT_DATA, which suggestsinput_format_parquet_use_offset_index = 0(with it, the file reads correctly).DELTA_BINARY_PACKEDminiblocks wider than the value type are rejected withINCORRECT_DATAinstead of leaving the output uninitialized (the 33-bit miniblocks above). This is the same check as in the private repository, so the references are the same in both.ClickHouse issues found (recorded in the references, not fixed here)
m.keysor onlym.valuesof aMapcolumn directly from Parquet returns empty arrays (also for files written by ClickHouse, also on 26.9). These subcolumn checks are not generated until it is fixed.INCORRECT_DATAfrom the offset index validation (duplicatefirst_row_index),ATTEMPT_TO_READ_AFTER_EOFwithout the offset index. pyarrow reads it.parquet-testing/datapage_v2_empty_datapage.snappy.parquetfails withCANNOT_DECOMPRESSfor a similar reason.INT32DELTA_BINARY_PACKEDcolumns with 33-bit miniblocks, written by DuckDB 2.0 (PARQUET_VERSION V2) and arrow-go for columns with a wide value range, are rejected withINCORRECT_DATAafter the fix above (on master they read as random values). DuckDB and arrow-go read their files back; Arrow C++ rejects them too.ALTER TABLE ... ADD COLUMN st.y, reading the subcolumnst.xorst.yfails withNOT_FOUND_COLUMN_IN_BLOCK(readingstworks).UInt64column of a polars 0.20 file fails withINCORRECT_DATA(Statistics have min_value > max_value): polars 0.20 wrote signed-order statistics forUINT_64. ClickHouse could ignore such statistics instead of failing the query.Time64, which the reader produces for TIME columns.Changelog category (leave one):
Workflow [PR]
Sync PR [sync-upstream/pr/128305]
Version info
26.11.1.985-master(included in26.11and later)