Skip to content

Cherry pick #99504 to 25.12: Fix NOT_FOUND_COLUMN_IN_BLOCK when text index predicate is referenced in SELECT - #99617

Merged
robot-clickhouse-ci-1 merged 7 commits into
backport/25.12/99504from
cherrypick/25.12/99504
Mar 16, 2026
Merged

robot-clickhouse-ci-1 merged 7 commits into
backport/25.12/99504from
cherrypick/25.12/99504

Conversation

@robot-clickhouse-ci-2

Copy link
Copy Markdown
Contributor

Original pull-request #99504

Do not merge this PR manually

This pull-request is a first step of an automated backporting.
It contains changes similar to calling git cherry-pick locally.
If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.

The check results does not matter at this step - you can safely ignore them.

Troubleshooting

If the conflicts were resolved in a wrong way

If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:

  • delete the pr-cherrypick label from the PR
  • delete this branch from the repository

You also need to check the Original pull-request for pr-backports-created label, and delete if it's presented there

The PR source

The PR is created in the CI job

CurtizJ and others added 6 commits March 13, 2026 23:24
… 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]>
Fix `NOT_FOUND_COLUMN_IN_BLOCK` when text index predicate is referenced in SELECT
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! do not test disable testing on pull request pr-bugfix Pull request with bugfix, not backported by default labels Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not test disable testing on pull request pr-bugfix Pull request with bugfix, not backported by default pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants