Skip to content

Add test: input_format_orc_dictionary_as_low_cardinality as a schema-inference cache-key component is untested for same-file poisoning - #111942

Merged
alexey-milovidov merged 3 commits into
ClickHouse:masterfrom
clickgapai:qa-bot/coverage-pr110074
Aug 1, 2026
Merged

alexey-milovidov merged 3 commits into
ClickHouse:masterfrom
clickgapai:qa-bot/coverage-pr110074

Conversation

@clickgapai

@clickgapai clickgapai commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

Found via ClickGap automated review. Please close or comment if this is incorrect or needs adjustment.

This is a test-only PR — no source code changes. Please review: test quality, whether the claimed coverage gaps are real, and whether test output makes sense.

Adds test coverage for 1 untested code path(s), found during automated review of PR #110074.
That PR This PR removes the legacy Apache Arrow-based ORC reader (ORCBlockInputFormat / ORCSchemaReader), so the ORC input format now always uses the native NativeORCBlockInputFormat. Format registration (registerInputFormatORC, registerORCSchemaReader) moved into NativeORCBlockInputFormat.cpp,

1. input_format_orc_dictionary_as_low_cardinality as a schema-inference cache-key component is untested for same-file poisoning
src/Processors/Formats/Impl/NativeORCBlockInputFormat.cpp:2330, src/Processors/Formats/Impl/NativeORCBlockInputFormat.cpp:1222
Risk: registerORCSchemaReader builds the schema-cache additional-info string at NativeORCBlockInputFormat.cpp:2325-2332, and getSchema at :1221-1225 wraps dictionary-encoded String columns in LowCardinality only when dictionary_as_low_cardinality is set (parseORCType :255). The PR rewrote this cache-key line and added same-file poisoning tests for the two sibling keys it newly introduced (skip_columns, max_parser_depth) but not for this one. RISK: if the dictionary_as_low_cardinality={} …
What's unique vs PR tests: The PR's 04514/04631 test same-file schema-cache poisoning for the two cache-key components it newly added (skip_columns_with_unsupported_types, max_parser_depth). 03241 exercises input_format_orc_dictionary_as_low_cardinality only across DIFFERENT files, so it never triggers a same-file cache collision. This test is the missing same-file cache-key poisoning test for the third schema-affecting component of the rewritten ORC cache key.

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

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

Not applicable — test-only change.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Version info

  • Merged into: 26.8.1.607 (included in 26.8 and later)

@clickgapai

Copy link
Copy Markdown
Contributor Author

Pre-PR Validation Gate (per ClickGap pipeline):

a) Deterministic repro? ✅
Test exercises the previously-uncovered branch and passes (correct behaviour).

b) Root cause explained? ✅
NativeORCBlockInputFormat.cpp:2330 settings.orc.dictionary_as_low_cardinality in the schema-cache additional-info getter - present but never exercised as a same-file cache differentiator (03241 uses different file names per setting value, so no cache collision).

c) Fix matches root cause? ✅
N/A for coverage gap — this PR adds a regression test, not a fix. Asserts current correct behaviour at the cited line.

d) Test intent preserved? / New tests added? ✅
New regression test added: 04632_orc_schema_cache_dictionary_low_cardinality.sh.

e) Both directions demonstrated? ✅
Test passes (MATCH) on master proving current correctness; would fail if the cited branch regressed. Single-direction is the correct shape for a coverage gap test.

f) Fix is general, not a narrow patch? ✅
Test asserts the invariant at the cited line — covers the branch, not a specific input shape.

@PedroTadim PedroTadim added the can be tested Allows running workflows for external contributors label Jul 29, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [95fa7f2]

Summary: ✅


AI Review

Summary

This PR adds a stateless ORC regression test for same-file schema-inference cache poisoning across input_format_orc_dictionary_as_low_cardinality. I did not find remaining review issues: the added touch makes the cached schema survive long enough for the second DESC, so the test now deterministically exercises the cache-key distinction it is meant to cover.

Final Verdict

✅ No new findings.

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Jul 29, 2026
clickgapai and others added 2 commits July 29, 2026 10:19
Without this, a write and the first DESC in the same second invalidate the
entry (SchemaCache.cpp:125 st_mtime >= registration_time, both second-granularity
time_t), so the second DESC re-infers and passes even if the cache key omits
input_format_orc_dictionary_as_low_cardinality.

Requested by @clickhouse-gh[bot] in ClickHouse#111942 (comment)
@alexey-milovidov alexey-milovidov self-assigned this Aug 1, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Aug 1, 2026
Merged via the queue into ClickHouse:master with commit 1c3181d Aug 1, 2026
179 checks passed
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors pr-not-for-changelog This PR should not be mentioned in the changelog 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.

4 participants