Repository navigation
Fix SIGSEGV in view filter propagation due to type mismatch - #102085
Conversation
When an outer WHERE filter is propagated through StorageView into collectFiltersForAnalysis, the filter DAG's pre-compiled function objects expect the view's metadata column types. However, the inner query plan may produce different actual types (e.g. Nullable wrappers from LEFT JOIN with join_use_nulls, or integer type promotion). The existing check at Planner.cpp only verifies column names are present in the inner plan header — it does not verify type compatibility. When types diverge, ActionsDAG::updateHeader maps the wrong-typed columns to the filter's function nodes by name, and IExecutableFunction::executeImpl performs assert_cast (which is a bare static_cast in release builds) on the mismatched column data, producing a wild-pointer dereference (SIGSEGV). Add a type equality check: skip filter injection when any input column's type in the inner plan header differs from what the filter DAG expects. The query still returns correct results — it just forgoes the predicate-pushdown optimisation for that view. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
c6bc0ad to
75c0974
Compare
|
Workflow [PR], commit [a705031] Summary: ❌
AI ReviewSummaryThis PR fixes a Missing context
ClickHouse Rules
Final Verdict
|
75c0974 to
bb78616
Compare
… check Create the view with join_use_nulls=1 (metadata has Nullable) and query with join_use_nulls=0 (inner plan produces non-Nullable). This bypasses the one-way nullability check at StorageView.cpp:209 while still exercising the type mismatch in collectFiltersForAnalysis. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
bb78616 to
a705031
Compare
LLVM Coverage Report
Changed lines: 70.00% (7/10) · Uncovered code |
KochetovNicolai
left a comment
There was a problem hiding this comment.
Overall fine, but maybe can make it better - prepend CAST to inputs if the type is different.
Good to merge anyway.
Backport #102085 to 26.2: Fix SIGSEGV in view filter propagation due to type mismatch
Backport #102085 to 26.1: Fix SIGSEGV in view filter propagation due to type mismatch
Backport #102085 to 26.3: Fix SIGSEGV in view filter propagation due to type mismatch
|
Backport labels have been automatically added based on https://github.com/clickhouse/clickhouse-core-incidents/issues/1590 Labels added:
These labels ensure backport PRs are properly created for each affected release version. The release automation will create backport PRs as needed based on these labels. |
Linked issues
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix crash (SIGSEGV) when querying a view with a WHERE clause and the inner query produces columns with different types than the view metadata (e.g. Nullable from LEFT JOIN with
join_use_nulls).Documentation entry for user-facing changes
Version info
26.4.1.71126.3.6.9,26.2.10.5,26.1.8.29