Skip to content

Text index: fix accidentally removed columns when the direct read is enabled - #114460

Merged
ahmadov merged 2 commits into
masterfrom
ahmadov/text-index-column-not-found-opt
Aug 12, 2026
Merged

ahmadov merged 2 commits into
masterfrom
ahmadov/text-index-column-not-found-opt

Conversation

@ahmadov

@ahmadov ahmadov commented Aug 12, 2026 •

Copy link
Copy Markdown
Member

When the same column is used in both PREWHERE and WHERE conditions, it must not be removed, since PREWHERE is executed before WHERE. Even if a WHERE filter column is rewritten into a text index virtual column, it still has to be read to apply the PREWHERE condition.

To fix it, now every column still required by the PREWHERE is kept in the read set instead of removing it.

Fixes #113320.

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Do not remove columns when it's referenced in both PREWHERE and WHERE filter conditions even if it's rewritten into a text index virtual column.

Version info

  • Backported to: 26.7.31.14

…enabled

When the same column is used in both `PREWHERE` and `WHERE` conditions,
it must not be removed, since `PREWHERE` is executed before `WHERE`.
Even if a `WHERE` filter column is rewritten into a text index virtual
column, it still has to be read to apply the `PREWHERE` condition.

To fix it, now every column still required by the `PREWHERE` is kept in
the read set instead of removing it.

Fixes #113320.
@ahmadov
ahmadov requested review from Ergus and rschu1ze August 12, 2026 09:55
@clickhouse-gh

clickhouse-gh Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [d9ca795]

Summary: ✅


AI Review

Summary

This PR keeps source columns in the read set when a WHERE text-index rewrite would otherwise drop a column that is still needed by PREWHERE or row-level filtering. After checking the current diff, the surrounding planner and read-step code paths, the prior review thread, and the green CI results for PR #114460, I do not see a remaining correctness issue on the current head.

Final Verdict

✅ No new findings.

LLVM Coverage Report

Metric Baseline Current Δ
Lines 86.70% 86.70% +0.00%
Functions 92.00% 92.00% +0.00%
Branches 79.00% 79.10% +0.10%

Changed lines: Changed C/C++ lines covered: 10/12 (83.33%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Aug 12, 2026
@rschu1ze rschu1ze self-assigned this Aug 12, 2026
@ahmadov
ahmadov added this pull request to the merge queue Aug 12, 2026
Merged via the queue into master with commit da8fa3a Aug 12, 2026
180 checks passed
@ahmadov
ahmadov deleted the ahmadov/text-index-column-not-found-opt branch August 12, 2026 21:54
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 12, 2026
@robot-clickhouse robot-clickhouse added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Oct 14, 2026
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Oct 14, 2026
rschu1ze added a commit that referenced this pull request Oct 15, 2026
Backport #114460 to 26.7: Text index: fix accidentally removed columns when the direct read is enabled
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-bugfix Pull request with bugfix, not backported by default pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR pr-synced-to-cloud The PR is synced to the cloud repo v26.6-must-backport

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Text index direct read drops the source column another PREWHERE step needs: NOT_FOUND_COLUMN_IN_BLOCK on a valid query

6 participants