Repository navigation
Fix exception in checkCorrelatedColumn for INTERPOLATE expression arguments - #98346
Merged
Merged
Conversation
… arguments `INTERPOLATE (a AS b)` creates a fake `ColumnNode` with an `InterpolateNode` as its source. When resolving alias chains from a parent scope, `CorrelatedColumnsCollector` would visit this fake column and `checkCorrelatedColumn` would fail because `InterpolateNode` is never registered in any scope's `registered_table_expression_nodes`. The fix adds `INTERPOLATE` to the early-return check alongside `LAMBDA`, since both represent expression arguments rather than table expressions. Also improved `CorrelatedColumnsCollector` to handle `UNION` nodes (not just `QUERY`) and to skip subqueries missing from the scope map rather than falling through with the wrong scope context. https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=98299&sha=09fdc20b9f0ecf42b37644a57de91f5ccbf68e42&name_0=PR&name_1=BuzzHouse%20%28arm_asan%29 Co-Authored-By: Claude Opus 4.6 <[email protected]>
Contributor
| -- that are not in the scope map (e.g. inside INTERPOLATE expressions). | ||
| -- Previously this caused "Cannot find the original scope of the column" exception. | ||
|
|
||
| SELECT 1 AS a, a AS b ORDER BY 1 WITH FILL STALENESS 1 INTERPOLATE (a AS b); |
Member
Author
There was a problem hiding this comment.
The test reproduces the issue.
The old analyzer has a pre-existing bug that crashes with
`INTERPOLATE` + `WITH FILL` queries ("Invalid number of rows in Chunk").
Since the fix targets the new analyzer's `CorrelatedColumnsCollector`,
force `allow_experimental_analyzer = 1` in the test.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
alexey-milovidov
commented
Mar 1, 2026
alexey-milovidov
left a comment
Member
Author
There was a problem hiding this comment.
Similar to the previous one for lambdas.
alexey-milovidov
added a commit
that referenced
this pull request
Mar 1, 2026
…column-scope Fix exception in checkCorrelatedColumn for INTERPOLATE expression arguments
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
LOGICAL_ERRORexception "Cannot find the original scope of the column" when usingINTERPOLATEwith alias chains (e.g.,SELECT 1 AS a, a AS b ORDER BY 1 WITH FILL STALENESS 1 INTERPOLATE (a AS b))INTERPOLATEcreates fakeColumnNodes withInterpolateNodeas source;checkCorrelatedColumndidn't handle this node type, causing it to walk up the entire scope chain and throwCorrelatedColumnsCollectorto handleUNIONnodes and skip subqueries missing from the scope mapFound by BuzzHouse fuzzer: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=98299&sha=09fdc20b9f0ecf42b37644a57de91f5ccbf68e42&name_0=PR&name_1=BuzzHouse%20%28arm_asan%29
#98299
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix
LOGICAL_ERRORexception "Cannot find the original scope of the column" when usingINTERPOLATEwith alias chains inORDER BY ... WITH FILL.Documentation entry for user-facing changes
🤖 Generated with Claude Code
Version info
26.3.1.216