Repository navigation
Remove the Apache Arrow-based ORC reader - #110074
Conversation
The ORC input format had two decoder implementations selected by the `input_format_orc_use_fast_decoder` setting: the native ClickHouse reader (NativeORCBlockInputFormat, the default) and a legacy Apache Arrow-based reader (ORCBlockInputFormat, opt-in via `= 0`). The native reader is a strict superset: it supports the same types and settings, and additionally does filter push-down (stripe/row-group skipping via min/max statistics and bloom filters), dictionary -> LowCardinality, and remote-filesystem prefetch. It has been the default for a long time. The Arrow-based reader added nothing useful over it except a crash surface: for example, a malformed ORC union tag caused a heap-buffer-overflow in Arrow's adapters/orc (util.cc) and in the ORC C++ UnionColumnReader. Always use the native reader and remove ORCBlockInputFormat / ORCSchemaReader. The `input_format_orc_use_fast_decoder` setting is made obsolete (still accepted but ignored) for backward compatibility. Note: the Apache Arrow ORC adapter is still used directly by the Hive storage engine (StorageHive), so it is not yet removed from the build. Porting Hive to the native ORC reader is a separate follow-up. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Workflow [PR], commit [a839800] Summary: ✅
AI ReviewSummaryThis PR removes the legacy Apache Arrow-based Final Verdict✅ No blocking or major issues found on the current head. |
The deleted Arrow-based `ORCSchemaReader` overrode `readNumberOrRows` (via `ORCFileReader::NumberOfRows`), which lets `ReadSchemaUtils` seed `system.schema_inference_cache.number_of_rows`. That count-from-cache fast path answers `COUNT(*)` on `file`/`url`/object-storage ORC sources without rescanning the file. `NativeORCSchemaReader` (now the only ORC schema reader) did not implement it, so after removing the Arrow reader schema inference no longer exposes ORC row counts. Override `readNumberOrRows` here using `orc::Reader::getNumberOfRows`, caching the `orc::Reader` between `readSchema` and `readNumberOrRows` via `initializeIfNeeded` (mirroring `NativeParquetSchemaReader`). Caching the reader also avoids re-reading the input buffer, which the load-into-memory fallback consumes during `readSchema`. Addresses the AI review on #110074 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The AI review noted that this PR removes every stateless ORC query that still
sent `input_format_orc_use_fast_decoder = 0`, leaving the obsolete-setting
compatibility contract ("still accepted, but has no effect") unexercised in CI.
Add a focused ORC read-path regression `04513_orc_fast_decoder_obsolete_setting`
that writes an ORC file and reads it back with the obsolete setting explicitly
set to both values, plus a schema-inference DESC, all going through the surviving
native ORC reader. This mirrors the Parquet coverage for the obsolete
`input_format_parquet_use_native_reader_v3` setting.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…generated format-settings docs Moving `input_format_orc_use_fast_decoder` to `MAKE_OBSOLETE` in `FormatFactorySettings.h` means the format-settings docs autogeneration (`ci/jobs/scripts/docs/autogenerate/sql/format-settings.sql`, which only emits `DECLARE(...)` entries) no longer produces a section for it. Regenerate the effect by removing the setting's section from `formats.mdx` and all localized copies so the published docs stop advertising the removed toggle. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
The `ORC` format documentation moved into `NativeORCBlockInputFormat.cpp` (and the published `docs/en/interfaces/formats/ORC.md` it was copied from) listed Arrow setting names under `## Format settings`, so the source-level format docs pointed users to the wrong settings. Replace those rows with the matching `ORC` settings and their correct defaults: - `output_format_arrow_string_as_string` -> `output_format_orc_string_as_string` (default `true`) - `input_format_arrow_case_insensitive_column_matching` -> `input_format_orc_case_insensitive_column_matching` - `input_format_arrow_allow_missing_columns` -> `input_format_orc_allow_missing_columns` (default `true`) - `input_format_arrow_skip_columns_with_unsupported_types_in_schema_inference` -> `input_format_orc_skip_columns_with_unsupported_types_in_schema_inference` AI Review finding on #110074 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
The Related: #109944 |
|
Confirmed. STID 4811-66fc ( Status of #109944: CI clean (only the chronic stress hung-check remained, owned by #108212/#105905), addressed the nested-wrapped-path review, on review awaiting @Avogar. Head 73f3a77. |
|
That failure (STID 4811-66fc) is the pre-existing master LOGICAL_ERROR from #106877, not a regression in this PR. The fix is #109944: it is ready (CI clean, the only red is the chronic stress hung-check owned by #108212/#105905), the automated review comment is addressed, and it is waiting on @Avogar's review. It will clear on all PRs, including this one, once #109944 lands. No change needed here. |
`NativeORCSchemaReader::readSchema` uses `input_format_orc_skip_columns_with_unsupported_types_in_schema_inference` to decide whether an unsupported ORC column (e.g. a `UNION`) is dropped or the file is rejected with `UNKNOWN_TYPE`. That setting was missing from the schema-inference cache key registered by `registerAdditionalInfoForSchemaCacheGetter` for the `ORC` format, so a query that infers and caches a schema with the setting enabled could poison the cache: a later default-settings query against the same file would reuse the "skipped" schema instead of throwing. Add the setting to the cache key, mirroring the `Arrow` format which already includes its analogous `skip_columns_with_unsupported_types` flag. Add regression test `04514_orc_schema_cache_skip_unsupported_types` on an ORC file with an unsupported `UNION` column: it first infers the schema with the setting enabled (caching the reduced schema) and then infers it again with default settings in the same process, asserting the second query re-infers and throws `UNKNOWN_TYPE` rather than reusing the cached schema. Addresses the AI review (clickhouse-gh) request-changes finding on NativeORCBlockInputFormat.cpp. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Master rewrote the autogenerated format-settings explorer and legacy-route files (#111760), reintroducing the obsolete setting `input_format_orc_use_fast_decoder` into `docs/snippets/components/FormatSettingsExplorer/FormatSettingsExplorer.jsx` and `docs/_site/customizations/settings-legacy-routes/format-settings.js`. Resolved the merge by taking the current master versions and re-running `autogenerate_docs.py --only format-settings --write` with a binary built from this branch, which drops the obsolete setting from the generated data (and refreshes minor generator-output drift in `formats.mdx` and `navigation.json`). `--check` mode passes on the result.
…ader # Conflicts: # docs/snippets/components/FormatSettingsExplorer/FormatSettingsExplorer.jsx
|
Status of the CI reds on head
This PR touches only ORC formats code and docs; CI is re-running on the new head. |
|
Acknowledged. Confirmed via CIDB: this shared |
|
Tracking issue filed: #111892. What I found: the ~90 failures decompose into two distinct sub-modes.
A harness fix is in progress: it bounds every post-budget stage (client reap, liveness probing, teardown) and turns the stuck state into an artifact-carrying FAIL with a deterministic name, so the memory growth becomes attributable from server.log/fuzzer.log. I will link the PR on #111892 when it is up. |
…che key `max_parser_depth` bounds the nesting depth in `parseORCType` during schema inference (throwing `TOO_DEEP_RECURSION` when exceeded), so it changes the result of `NativeORCSchemaReader::readSchema` and must be part of the schema cache key. Otherwise a query could cache a deeply nested ORC schema and a later query with a lower limit would reuse it instead of throwing. Add a regression test that reproduces the cache poisoning on the unfixed binary. Co-Authored-By: Claude Fable 5 <[email protected]>
|
CI status on
@groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=110074&sha=c4dd47606410e6a2c132c407314ce47d1ef01369&name_0=PR&name_1=Upgrade%20check%20%28amd_release%29 and provide a fix in a separate PR. If the fix is already in progress, link it here. The |
|
The Upgrade-check It is not a live restart race. The upgrade runner configures the server object-storage-default (and randomly encrypted) but invokes The arm_debug |
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 152/152 (100.00%) · Uncovered code |
|
The harness fix is up: #111934 (it also links back to #111892). It bounds every post-budget stage in The engine-side accumulation itself stays open on #111892 - there is still no attributed artifact for it, which is what this fix produces. |
|
Hi @alexey-milovidov @yakov-olkhovskiy — while reviewing this PR I found the following:
Could you review the test PR and add the |
After a fuzz run ends, the server can sit above its memory limit while idle: every post-fuzz probe is rejected with the server-global `(total) memory limit exceeded` tracker error and RSS keeps climbing with no queries running. The liveness loop read that as "alive, it will reclaim" and kept looping, and the graceful stop that followed waited on the saturated server without a deadline. The job then drifted into the external job-cancellation ceiling before status.tsv was written or any artifact uploaded, so the query history that would attribute the growth was destroyed. Detect that state and end it ourselves: on consecutive memory-limit-only probes the runner SIGKILLs the server and writes a marker, so the run fails with its artifacts intact. Every post-budget stage is bounded now, and each bounded exit records a watchdog naming its stage, so an escalation can never report OK. Classification follows from those markers. The marker reports one stable name, `Server unresponsive: memory limit exceeded`, so the state is countable in CIDB whichever path produced it, while a genuine earlier parser finding still wins. Because the harness stopped the server itself, the parser is told to ignore the resulting signal line, but only the self-inflicted one: a genuine fatal signal on the way down stays reportable, and a reap-stage escalation, which kills only client-side processes, does not set the flag at all. All sanitized-build OOM leniency is disabled under a marker or watchdog, since our own SIGKILL produces the same "terminated by signal 9" line the leniency looks for. An ERROR decided upstream survives having those rows attached, and the pre-run cleanup of a reused worktree cannot delete state that a fixture seeded as job input. Related: ClickHouse#110074 Co-Authored-By: Claude Fable 5 <[email protected]>
…k server The `old_compatibility` AST fuzzer job was cancelled by the workflow before it could upload anything, so the offending query was unattributable: the server kept growing past its memory limit after the fuzz run, and every stage after the budget could block indefinitely. Bound those stages (the fuzzer-client reap, the graceful-stop probe and the teardown watchdog), SIGKILL a memory-stuck server so the teardown is bounded and still carries its artifacts, and report the memory-stuck condition as its own result instead of letting it masquerade as a test failure. Persist the result BEFORE collecting cores, so the worst case is a report without its core rather than the artifact-less cancellation this change exists to remove, and keep the raw sanitizer logs readable on abnormal runs. Exemplar: AST fuzzer (amd_debug, targeted, old_compatibility) on ClickHouse#110074 head 99589a8, https://github.com/ClickHouse/ClickHouse/actions/runs/30084913668/job/89472316051 Co-Authored-By: Claude Fable 5 <[email protected]>
The deleted Arrow-based `ORCSchemaReader` overrode `readNumberOrRows` (via `ORCFileReader::NumberOfRows`), which lets `ReadSchemaUtils` seed `system.schema_inference_cache.number_of_rows`. That count-from-cache fast path answers `COUNT(*)` on `file`/`url`/object-storage ORC sources without rescanning the file. `NativeORCSchemaReader` (now the only ORC schema reader) did not implement it, so after removing the Arrow reader schema inference no longer exposes ORC row counts. Override `readNumberOrRows` here using `orc::Reader::getNumberOfRows`, caching the `orc::Reader` between `readSchema` and `readNumberOrRows` via `initializeIfNeeded` (mirroring `NativeParquetSchemaReader`). Caching the reader also avoids re-reading the input buffer, which the load-into-memory fallback consumes during `readSchema`. Addresses the AI review on ClickHouse#110074 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The `ORC` format documentation moved into `NativeORCBlockInputFormat.cpp` (and the published `docs/en/interfaces/formats/ORC.md` it was copied from) listed Arrow setting names under `## Format settings`, so the source-level format docs pointed users to the wrong settings. Replace those rows with the matching `ORC` settings and their correct defaults: - `output_format_arrow_string_as_string` -> `output_format_orc_string_as_string` (default `true`) - `input_format_arrow_case_insensitive_column_matching` -> `input_format_orc_case_insensitive_column_matching` - `input_format_arrow_allow_missing_columns` -> `input_format_orc_allow_missing_columns` (default `true`) - `input_format_arrow_skip_columns_with_unsupported_types_in_schema_inference` -> `input_format_orc_skip_columns_with_unsupported_types_in_schema_inference` AI Review finding on ClickHouse#110074 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…-reader Remove the Apache Arrow-based ORC reader
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Removed the legacy Apache Arrow-based ORC reader. The ORC input format now always uses the native ClickHouse decoder (previously the default). The
input_format_orc_use_fast_decodersetting is obsolete (still accepted, but has no effect).Documentation entry for user-facing changes
The
input_format_orc_use_fast_decodersetting is now obsolete.The ORC input format had two decoder implementations, selected by
input_format_orc_use_fast_decoder:NativeORCBlockInputFormat— the native ClickHouse reader, built directly on the ORC C++ library. This has been the default (= 1) for a long time.ORCBlockInputFormat— a legacy reader built on the Apache Arrow ORC adapter, opt-in via= 0.The native reader is a strict superset of the Arrow-based one:
LowCardinality.The Arrow-based reader added nothing useful over the native one, but it did add a crash surface. For example, a malformed ORC union tag triggers a heap-buffer-overflow in Arrow's
adapters/orc(util.cc, indexingtype_codes[tag]without bounds-checking) and in the ORC C++UnionColumnReader:The native reader rejects the same file cleanly (
UNKNOWN_TYPE: Unsupported ORC type).This PR removes
ORCBlockInputFormat/ORCSchemaReader, always uses the native reader, moves the format registration intoNativeORCBlockInputFormat.cpp, and obsoletes the setting (kept asMAKE_OBSOLETEfor backward compatibility, mirroringinput_format_parquet_use_native_reader_v3).Tests referencing the setting were updated: the parity duplicates (
04064,04493) and the= 1no-ops (03241,04340,03595) were cleaned up; the04336ORC leg (which asserted an Arrow-specific error code) was dropped, and04335's ORC memory-limit assertion now runs on the native reader (verified it still yieldsMEMORY_LIMIT_EXCEEDED).Note: the Apache Arrow ORC adapter is still used directly by the Hive storage engine (
StorageHive), so it is not yet removed from the build. Porting Hive to the native ORC reader (and then droppingcontrib/arrow/.../adapters/orc) is a separate follow-up.Verification: the changed translation units compile cleanly (
-fsyntax-onlyagainst the current build's flags); full build + test matrix is delegated to CI (local disk could not fit a second build). Native-decoder behavior for the touched test scenarios was reproduced against a current master binary.Version info
26.8.1.147(included in26.8and later)