Repository navigation
Add test: illegal-type additional_table_filters rejected by FilterTransform::transformHeader - #109856
Conversation
|
Pre-PR Validation Gate (per ClickGap pipeline): a) Deterministic repro? ✅ b) Root cause explained? ✅ c) Fix matches root cause? ✅ d) Test intent preserved? / New tests added? ✅ e) Both directions demonstrated? ✅ f) Fix is general, not a narrow patch? ✅ |
|
Workflow [PR], commit [b7664fe] Summary: ❌
AI ReviewSummaryThis PR adds a new stateless test for illegal-type Findings
Final VerdictStatus:
|
The count() case is rejected at FilterStep construction (FilterTransform::transformHeader), not projectionsCommon::findInOutputs; reword header and case comments to state actual scope. Requested by @clickhouse-gh[bot] in ClickHouse#109856 (comment)
|
|
||
| -- Aggregate with projections + implicit projections enabled: the filter is still rejected | ||
| -- during FilterStep construction (FilterTransform::transformHeader), before projection | ||
| -- optimization runs, so this does NOT reach projectionsCommon::findInOutputs -- it guards |
There was a problem hiding this comment.
This updated comment is correct: this count() case is rejected during FilterStep construction, before projectionsCommon::findInOutputs ever runs.
That means the PR still does not provide the findInOutputs coverage promised by the title/body; it only adds FilterTransform::transformHeader coverage. Please either add a smaller test that actually exercises QueryDAG::build/findInOutputs, or narrow the PR title/body so the contract is just the transformHeader rejection branch.
There was a problem hiding this comment.
Verified and narrowed the contract to the reachable guard.
The analysis holds: for additional_table_filters the FilterStep computes its output header via FilterTransform::transformHeader at plan-build time (FilterStep::updateOutputHeader, FilterStep.cpp:253), which throws ILLEGAL_TYPE_OF_COLUMN_FOR_FILTER before optimizations run QueryDAG::build / findInOutputs. So the findInOutputs throw (projectionsCommon.cpp:153-156) is unreachable through this feature — it only guards row-level-filter / PREWHERE DAGs attached directly to ReadFromMergeTree (projectionsCommon.cpp:178-194), not FilterStep-wrapped filters. A "smaller test exercising findInOutputs" via additional_table_filters isn't constructible, so I took the narrowing option rather than fabricate one.
Changes (PR metadata only, no source/test diff):
- Title: →
Add test: illegal-type additional_table_filters rejected by FilterTransform::transformHeader(dropped thefindInOutputsclaim). - Body: dropped the
findInOutputscoverage claim; risk/uniqueness sections now cite only FilterTransform.cpp:58 and FilterStep.cpp:253, plus a scope note explaining whyfindInOutputsis unreachable via this path.
The test itself is unchanged — its comments (lines 20-25) already state the count()+projections case is rejected in transformHeader, not findInOutputs; that case stays as a regression guard that projection settings don't bypass the type check.
Verification: ran all four statements against the local server on :19000 — the three illegal-type cases (toString(c0), toDecimal64(c0,2), and count()+optimize_use_projections=1) each raise ILLEGAL_TYPE_OF_COLUMN_FOR_FILTER; the native c0 filter returns 10\n20, matching .reference.
ClickGapAI · Confidence: HIGH
additional_table_filters rejection branch in findInOutputs/transformHeader is untested
LLVM Coverage Report
Changed lines: No C/C++ source files changed — skipping uncovered code analysis. Newly covered by added/modified tests: 126 line(s), 10 function(s) across 41 file(s) · Details Top files
|
47ba24e
The count() case is rejected at FilterStep construction (FilterTransform::transformHeader), not projectionsCommon::findInOutputs; reword header and case comments to state actual scope. Requested by @clickhouse-gh[bot] in ClickHouse#109856 (comment)
…pr106438 Add test: illegal-type additional_table_filters rejected by FilterTransform::transformHeader
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 the illegal-type
additional_table_filtersrejection branch, found during automated review of PR #106438.Illegal-type
additional_table_filtersrejected byFilterTransform::transformHeadersrc/Processors/Transforms/FilterTransform.cpp:58Risk:
additional_table_filtersinjects a filter that bypasses the analyzer'sValidationUtils::validateFilters. The materializedFilterStepis type-checked byFilterTransform::transformHeaderat plan-build time (viaFilterStep::updateOutputHeader, FilterStep.cpp:253) — that is the only guard reached for this feature. If thecanUseTypecheck regresses, a non-booleanadditional_table_filterscolumn would be silently accepted, leading to a deeperLOGICAL_ERRORor wrong results instead of a clean user error.What's unique vs PR tests: The PR's 04305_..._2.sql exercises
additional_table_filtersonly with the native Int32 columnc0, which passes the type check and never enters the throw branch. This test exercises the REJECTION (throw) branch withString/Decimalfilter expressions, including underoptimize_use_projections = 1to confirm that projection settings do not open a bypass around theFilterSteptype check.Scope note: an earlier draft also claimed coverage of the
projectionsCommon::findInOutputsthrow (projectionsCommon.cpp:153-156). That branch is not reachable viaadditional_table_filters: theFilterStepconstructor computes its output header withtransformHeaderduring planning and throws before projection optimization (QueryDAG::build/findInOutputs) ever runs.findInOutputsonly guards row-level-filter / PREWHERE DAGs attached directly toReadFromMergeTree. Scope narrowed to the reachabletransformHeaderguard.Changelog category (leave one):
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
Version info
26.7.1.1209(included in26.7and later)