Repository navigation
Fix NOT_FOUND_COLUMN_IN_BLOCK when text index predicate is referenced in SELECT - #99504
Merged
alexey-milovidov merged 5 commits intoMar 16, 2026
Merged
alexey-milovidov merged 5 commits into
alexey-milovidov merged 5 commits into
Conversation
… in SELECT When a text-search function (e.g. `hasAllTokens`) appeared both in SELECT (via alias) and in WHERE, the direct read optimization in `replaceFunctionsToVirtualColumns` replaced the predicate with a virtual column input node, changing its name to `__text_index_...`. But the downstream ExpressionStep still expected the original column name, causing a NOT_FOUND_COLUMN_IN_BLOCK exception. The fix adds an alias after the replacement to preserve the original function name, mirroring what `preprocessTextIndexFunction` already does. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
After the alias fix, the Filter/Prewhere column names now show original function names instead of `__text_index_...` virtual column names. Update EXPLAIN query filters from `LIKE '%Filter column%'` to `LIKE '%\_\_text_index%'` to match the INPUT/ALIAS lines in the Actions section, which is a more precise check for the optimization. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…umns Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Contributor
|
Workflow [PR], commit [0509f96] Summary: ✅ AI ReviewSummaryThis PR fixes Missing context
ClickHouse Rules
Final Verdict
|
Contributor
LLVM Coverage Report
PR changed lines: PR changed-lines coverage: 100.00% (5/5, 0 noise lines excluded) |
alexey-milovidov
approved these changes
Mar 16, 2026
This was referenced Mar 16, 2026
robot-clickhouse
added a commit
that referenced
this pull request
Mar 16, 2026
…dex predicate is referenced in SELECT
robot-clickhouse
added a commit
that referenced
this pull request
Mar 16, 2026
…ndex predicate is referenced in SELECT
clickhouse-gh Bot
added a commit
that referenced
this pull request
Mar 17, 2026
Backport #99504 to 26.2: Fix `NOT_FOUND_COLUMN_IN_BLOCK` when text index predicate is referenced in SELECT
alexey-milovidov
added a commit
that referenced
this pull request
Mar 17, 2026
…n text index predicate is referenced in SELECT" This reverts commit 57801bd.
zlareb1
added a commit
to zlareb1/ClickHouse
that referenced
this pull request
Mar 17, 2026
Tests that `query_plan_direct_read_from_text_index` works correctly when the text-index predicate is referenced via an alias in `SELECT` and used in `PREWHERE`. PR ClickHouse#99504 fixed `NOT_FOUND_COLUMN_IN_BLOCK` for this pattern. Covers: `hasToken`, `hasAllTokens`, `hasAnyTokens` with `PREWHERE` alias, `PREWHERE + WHERE` combined, explicit `PREWHERE` predicate with alias in `SELECT`, and `NOT` predicate with `PREWHERE` alias. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
1 task
CurtizJ
added a commit
that referenced
this pull request
Mar 18, 2026
The backport of PR #99504 added an alias in replaceNodes() to preserve original column names for downstream steps, fixing NOT_FOUND_COLUMN_IN_BLOCK. This alias causes EXPLAIN to show original expression names instead of __text_index_* virtual column names in Filter/Prewhere column output. Update all affected tests to check for __text_index virtual column presence in EXPLAIN actions output instead of checking Filter column names, matching the approach used in the original master PR. Also add missing SET allow_experimental_full_text_index = 1 to the new 04039_text_index_direct_read_select_alias test. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
clickhouse-gh Bot
added a commit
that referenced
this pull request
Mar 19, 2026
Backport #99504 to 25.12: Fix `NOT_FOUND_COLUMN_IN_BLOCK` when text index predicate is referenced in SELECT
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.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed
NOT_FOUND_COLUMN_IN_BLOCKexception when a text index predicate (e.g.hasAllTokens) is referenced in bothSELECTandWHEREclauses via an alias.Fixes #99468.
Version info
26.3.1.71426.2.5.29,25.12.9.51