Skip to content

Test reading the entire apache/arrow-testing corpus - #125134

Merged
alexey-milovidov merged 36 commits into
masterfrom
arrow-testing-corpus
Nov 4, 2026
Merged

alexey-milovidov merged 36 commits into
masterfrom
arrow-testing-corpus

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Oct 11, 2026 •

Copy link
Copy Markdown
Member

Related: #125130

Add https://github.com/apache/arrow-testing as the contrib/arrow-testing submodule and a stateless test that reads the entire corpus (509 files), each in its format: Arrow IPC files and streams (including the integration files written by several Arrow versions), Parquet, Avro, CSV and TSV, including all fuzzer-generated files. For each file the test records the inferred schema, the row count and an order-independent hash of all values, or the error name if the file cannot be read. The files ClickHouse has no format for (Arrow JSON integration files, Flight certificates, a Protobuf schema) are skipped.

In addition, the test checks that the .arrow_file and .stream variants of all 91 integration files give identical results, and compares blogs.parquet with its expected contents in blogs.json (they match).

The stateless test job does not check out submodules, so ci/jobs/functional_tests.py now checks out contrib/arrow-testing (about 12 MB) when the selected tests include this test (always for a full run). A change of the submodule alone reruns the test in the flaky check.

The test found several bugs in the native Parquet reader on the fuzzer-generated files, fixed here:

  • undefined behavior from an out-of-range repetition_type in the schema (now INCORRECT_DATA);
  • negative column chunk sizes or numbers of values in metadata were converted into huge memory estimates (this is now checked on master in ReadManager, only for the columns whose data is read, so the check from this PR was dropped);
  • column chunks of zero size made the prefetch memory amplification NaN;
  • a DELTA_BINARY_PACKED miniblock bit width larger than the value type was passed to Arrow's BitReader, which only checks it with a DCHECK.

It also found that columns with empty names (e.g. an Arrow field with an empty name, or an empty header in CSVWithNames) are removed from the inferred schema, but not from a schema taken from the schema cache, so the next read of the same file got a column with an empty name (AMBIGUOUS_COLUMN_NAME in release builds, an exception on a chassert in debug and sanitizer builds). Fixed, with a separate test 05401_schema_cache_empty_column_name.

It also found that the native Arrow IPC reader rejected Arrow files whose footer has no metadata version (it reads as the default V1, while the messages are V4), e.g. three Arrow 0.14.1 integration files, since #125224. Such a footer is now read as V4; every message is still checked for its own version.

It also found that the native Arrow IPC reader made a misaligned 8-byte load (reported by UBSan) on a fuzzer-generated stream: flatbuffers::Verifier does not check the alignment of vector elements, and RecordBatch.variadicBufferCounts was placed at an address that is 4 mod 8. The record batch vectors of 8-byte elements and the footer block lists are now checked for alignment after verification (INCORRECT_DATA).

The reference pins the current behavior (Arrow dictionaries with duplicate values are read since #125677), including limitations visible in the corpus: big-endian Arrow IPC, unions, duplicate and empty field names, the null type, intervals, ListView, bzip2 and xz Avro codecs, and ARROW-17100.parquet (compressed pages with the is_compressed flag unset, written by PyArrow 2.0).

Changelog category (leave one):

  • Build/Testing/Packaging Improvement

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

Test reading the entire Arrow test corpus from https://github.com/apache/arrow-testing.

🤖 Generated with Claude Code


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

Version info

  • Merged into: 26.11.1.1286-master (included in 26.11 and later)

… all of it

Add https://github.com/apache/arrow-testing as `contrib/arrow-testing`
and a stateless test that reads every data file in it in its format:
Arrow IPC files and streams (including the integration files of several
Arrow versions), Parquet, Avro, CSV and TSV, including the fuzzer-generated
files. For each file the test prints the inferred schema, the row count and
an order-independent hash of all values, or the error name if the file
cannot be read. The test also checks that the Arrow IPC file and stream
variants of every integration file give the same result, and compares
`blogs.parquet` with its expected contents in `blogs.json`.

The stateless test job does not check out submodules, so
`ci/jobs/functional_tests.py` now checks out `contrib/arrow-testing`
before the tests run.

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

clickhouse-gh Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [4451034]

Summary: ✅


AI Review

Summary

Adds the pinned apache/arrow-testing corpus, CI selection for corpus updates, and reader fixes for malformed metadata, legacy Arrow footers, and cached empty column names. No unresolved findings remain in 44510348a639da532def748d8163da17c59c5cc1.

Missing context / blind spots
  • ⚠️ The latest head's functional and flaky checks are still pending. The preceding d0ede91966c1 CI run passed each of the four new tests 50 times in both release and ASan/UBSan builds. The updated CSV reference matches all five failures from the rejected merge-queue run. Complete the latest CI run to validate the final merged state; no local build or tests were run during this review.
Final Verdict

Status: ✅ Approve. No code changes requested; await successful CI on the latest head before merging.

@clickhouse-gh clickhouse-gh Bot added pr-build Pull request with build/testing/packaging improvement submodule changed At least one submodule changed in this PR. labels Oct 11, 2026
Comment thread .gitmodules Resolved
Comment thread ci/jobs/functional_tests.py Resolved
@clickhouse-gh

clickhouse-gh Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 44510348a with master 88f0adf4b (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.

Compile time of recompiled translation units

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

Job report

alexey-milovidov and others added 5 commits October 12, 2026 00:20
…reading it

Map the `contrib/arrow-testing` submodule to `05361_arrow_testing_corpus` in
`Targeting`, so that a change of the submodule alone reruns the test in the
flaky check, and check out the submodule in the functional test job only when
the selected tests include this test (always for a full run).

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

Found by `05361_arrow_testing_corpus` with UBSan on the fuzzer-generated files
of `apache/arrow-testing`:
- an out-of-range `repetition_type` of a schema element was loaded as an enum
  in `SchemaConverter::processSubtree`; now it is validated and rejected with
  `INCORRECT_DATA`;
- negative sizes or numbers of values of a column chunk produced negative memory
  estimates converted to `size_t` in `ReadManager::scheduleTask`; now they are
  rejected with `INCORRECT_DATA`;
- column chunks of zero size made the memory amplification of a prefetch task
  `0 / 0`, and NaN was converted to `size_t` in `Prefetcher::startPrefetch`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A bit width larger than the value type was passed to `arrow::bit_util::BitReader::GetBatch`,
which only checks it with a `DCHECK`: debug builds threw `STD_EXCEPTION`, release builds read
garbage until the end of the page. Found by `05361_arrow_testing_corpus` on
`clusterfuzz-testcase-parquet-arrow-fuzz-5415048864989184` of `apache/arrow-testing`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…uet metadata handling

Files with an invalid `repetition_type` in the schema are now rejected at schema inference.
Read error messages as text: they may contain binary column names of the fuzzer-generated files.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Comment thread ci/jobs/scripts/find_tests.py Resolved
@clickhouse-gh clickhouse-gh Bot added comp-parquet-reader-v3 Issues related to the native Parquet reader. and removed comp-testing Test content only (no production code). labels Oct 12, 2026
alexey-milovidov and others added 2 commits October 12, 2026 17:57
…nts before the traversal

The traversal looks ahead at descendants, e.g. in `tupleSubtreeIsAllRequired`,
so checking each element only when it is visited still compared out-of-range
enum values. Also initialize the variable to satisfy `clang-tidy`
(`cppcoreguidelines-init-variables`).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
alexey-milovidov and others added 3 commits October 31, 2026 13:22
…is needed

Address review: validating the vectors of every `DictionaryBatch` in
`MessageReader::readNextMessage` made a projected read fail on a corrupted
dictionary of an unrequested column, breaking the contract covered by
`04411_native_arrow_ipc_unrequested_dictionary_corrupt`. Move the check of
the dictionary batch into `decodeDictionaryBatch`, which is reached only for
needed dictionaries; record batches are still checked right after verification.

#125134

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

Address review: a `DictionaryBatch` of an unrequested column whose `nodes`
vector is at 4 mod 8 passes `flatbuffers::Verifier`, and must not fail a
projected read; selecting that column must fail with the misalignment error.

#125134

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

Copy link
Copy Markdown
Member Author

🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=125134&sha=61befa9ad08b191a20ce5b205395b64736a40bdb&name_0=PR&name_1=AST%20fuzzer%20%28amd_release%2C%20oracle%29 (segfault in CrossTabCountsState::merge via AggregateFunctionMerge, tracked in #127800; possibly related to #119401) and provide a fix in a separate PR. If the fix is already in progress, link it here. This PR only touches the Arrow / Parquet readers.

@clickhouse-gh clickhouse-gh Bot added comp-formats Input/output formats (CSV/JSON/Parquet/ORC/Arrow/Protobuf/etc.). and removed comp-parquet-reader-v3 Issues related to the native Parquet reader. labels Oct 31, 2026
@groeneai

Copy link
Copy Markdown
Collaborator

The fix is in progress in #119401 (same STID 2844-3993 as #127800).

The last fuzzed query in this run's fuzzer.log, with the run's make_distributed_plan = 1, distributed_plan_execute_locally = 1, distributed_plan_fallback_to_local_execution = 0, enable_cascades_optimizer = 1:

SELECT round(cramersVBiasCorrectedMerge(dynamicElement(CAST(w, 'Dynamic'), 'AggregateFunction(cramersVBiasCorrected, UInt8, UInt8)')), 4)
FROM (SELECT cramersVBiasCorrectedState(toUInt8(number % 10), toUInt8(number % 6)) OVER () AS w FROM numbers(100) LIMIT 1)

In clickhouse local (plus distributed_plan_workers_num = 2), master 6983f5a16d9 segfaults at CrossTab.h:65 in stage main, as here; #119401's CI build 543a33e6bdc returns 0.3506, the same as without the distributed plan. A CrossTab window state has a different layout than the aggregate state under the same type name, and the deserialized plan decodes it as the aggregate one, so -Merge reads the wrong layout.

alexey-milovidov and others added 3 commits November 1, 2026 13:51
# Conflicts:
#	src/Processors/Formats/Impl/Parquet/Prefetcher.cpp
…`xz` in `Avro`

#127774 added support for the `bzip2` and `xz` codecs
in the `Avro` format, so `data/avro/alltypes_plain.bzip2.avro` and `data/avro/alltypes_plain.xz.avro`
are now read, with the same contents as `data/avro/alltypes_plain.avro`.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=125134&sha=59dd252d208615c700b477812e3bbb00194d6499&name_0=PR
PR: #125134

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@alexey-milovidov alexey-milovidov self-assigned this Nov 2, 2026
@alexey-milovidov

Copy link
Copy Markdown
Member Author

LGTM

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Nov 2, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 2, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Nov 2, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 2, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Nov 3, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 3, 2026
alexey-milovidov and others added 2 commits November 3, 2026 14:57
#128436 changed `CSVFormatReader::readField`
to treat a field starting with `\r` as empty with `input_format_csv_empty_as_default`, so the
fuzzer file `clusterfuzz-testcase-minimized-arrow-csv-fuzz-5085419734892544` now fails with
`CANNOT_PARSE_INPUT_ASSERTION_FAILED` instead of being read as one row. This was the reason
the merge queue rejected the PR:
https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=gh-readonly-queue/master/pr-125134-e347281f9c9d421459e72eefc44846ec85d67c06&sha=35025568ed58256edb98198b0a30fd72fa93fb7d&name_0=MergeQueueCI

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

Copy link
Copy Markdown
Member Author

🕵 The merge queue rejected this PR because 05361_arrow_testing_corpus failed in Stateless tests (amd_binary, flaky check): https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=gh-readonly-queue/master/pr-125134-e347281f9c9d421459e72eefc44846ec85d67c06&sha=35025568ed58256edb98198b0a30fd72fa93fb7d&name_0=MergeQueueCI

The cause is a semantic conflict with #128436, which landed on master after this branch was last merged. It changed CSVFormatReader::readField so that a field starting with \r counts as empty, so the fuzzer file data/csv/fuzzing/clusterfuzz-testcase-minimized-arrow-csv-fuzz-5085419734892544 now fails with CANNOT_PARSE_INPUT_ASSERTION_FAILED instead of being read as one row. I merged master and updated that one line of the reference (4451034). I ran the test locally on the merged tree and the rest of the output matches.

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-build Pull request with build/testing/packaging improvement pr-synced-to-cloud The PR is synced to the cloud repo submodule changed At least one submodule changed in this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants