Fix filter pushdown through legacy JoinStep with join_use_nulls#98337
Merged
alexey-milovidov merged 4 commits intomasterfrom Mar 1, 2026
Merged
Fix filter pushdown through legacy JoinStep with join_use_nulls#98337alexey-milovidov merged 4 commits intomasterfrom
alexey-milovidov merged 4 commits intomasterfrom
Conversation
When `join_use_nulls` is enabled, the join output header has Nullable column types for the outer side. The filter expression (e.g. `k < 10`) is built with these Nullable types. When filter pushdown moves this filter to the join input side (where columns are non-nullable), it causes a type mismatch exception: "Unexpected return type from `less`. Expected `Nullable(UInt8)`. Got `UInt8`." Commit 5557b5e removed the type equality check in `get_available_columns_for_filter` to support `join_use_nulls` with `JoinStepLogical`, which has `fix_predicate_for_join_logical_step` to adjust types. But the legacy `JoinStep` has no such adjustment, so removing the check broke it. Restore the type check specifically for the legacy `JoinStep` path. Closes #98167 https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=ededb4c6063844d24eee5d3023dfe17912307ffa&name_0=MasterCI&name_1=Stress%20test%20%28azure%2C%20amd_msan%29 Co-Authored-By: Claude Opus 4.6 <[email protected]>
Contributor
Member
Author
alexey-milovidov
left a comment
There was a problem hiding this comment.
A straightforward fix - just inhibit the optimization in certain cases for the obsolete legacy JOIN step.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
tests/queries/0_stateless/03835_filter_pushdown_join_use_nulls_legacy.sql
Show resolved
Hide resolved
…r path The bug only triggers with the old `InterpreterSelectQuery` which always uses the legacy `JoinStep`. With the new analyzer, even `query_plan_use_new_logical_join_step = 0` doesn't reproduce it because the query analysis differs. Co-Authored-By: Claude Opus 4.6 <[email protected]>
alexey-milovidov
added a commit
that referenced
this pull request
Mar 1, 2026
…e-nulls-legacy Fix filter pushdown through legacy JoinStep with join_use_nulls
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
less. ExpectedNullable(UInt8). GotUInt8" that occurs when filter pushdown moves a filter expression through a legacyJoinStepwithjoin_use_nullsenabledget_available_columns_for_filterspecifically for the legacyJoinSteppath, which was inadvertently removed in Support convert OUTER to INNER join optimization with join_use_nulls #95968JoinStepLogicalpath is unaffected — it has its own type adjustment mechanism viafix_predicate_for_join_logical_stepCloses #98167
CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=ededb4c6063844d24eee5d3023dfe17912307ffa&name_0=MasterCI&name_1=Stress%20test%20%28azure%2C%20amd_msan%29
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Documentation entry for user-facing changes