Skip to content

Fix text_index optimization on multiple passes. - #101939

Merged
CurtizJ merged 3 commits into
ClickHouse:masterfrom
Ergus:Fix_101913
Apr 8, 2026
Merged

CurtizJ merged 3 commits into
ClickHouse:masterfrom
Ergus:Fix_101913

Conversation

@Ergus

@Ergus Ergus commented Apr 7, 2026 •

Copy link
Copy Markdown
Member

Pre-populate the cache with any text-index virtual column inputs that are already present in this DAG from a previous optimization pass.

Fix: #101913

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):

Fixes an exception when querying Merge or Distributed tables with a full-text index and combined filter conditions that mix has*Tokens with LIKE, while query_plan_direct_read_from_text_index is enabled.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Version info

  • Merged into: 26.4.1.652

Pre-populate the cache with any text-index virtual column inputs that are already present in this DAG from a previous optimization pass.

Fix: ClickHouse#101913
@Ergus
Ergus requested a review from rschu1ze April 7, 2026 13:38
@clickhouse-gh

clickhouse-gh Bot commented Apr 7, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [2ec6a81]

Summary: ❌

job_name test_name status info comment
Integration tests (arm_binary, distributed plan, 3/4) error IGNORED

AI Review

Summary

This PR fixes repeated-optimization handling in optimizeDirectReadFromTextIndex by pre-populating the virtual-column cache from existing DAG inputs, and adds a regression test covering both WHERE and PREWHERE paths. I did not find correctness, safety, concurrency, or performance issues in the code changes. The only actionable issue is PR metadata quality: the required Changelog entry is still the placeholder ....

Findings
  • 💡 Nits
    • [PR description] Changelog category is reasonable (Bug Fix), but the required Changelog entry is missing (still ...).
    • Suggested replacement text: Fixed a LOGICAL_ERRORin text-index direct-read optimization when the same filter DAG is processed multiple times (for example with combined token andLIKEpredicates inMerge table queries).
ClickHouse Rules
Item Status Notes
Deletion logging ➖
Serialization versioning ➖
Core-area scrutiny ✅
No test removal ✅
Experimental gate ➖
No magic constants ✅
Backward compatibility ✅
SettingsChangesHistory.cpp ➖
PR metadata quality ⚠️ Required Changelog entry is still placeholder ...
Safe rollout ✅
Compilation time ✅
Final Verdict
  • Status: ⚠️ Request changes
  • Minimum required actions:
    • Replace placeholder Changelog entry (...) with a specific user-facing bug-fix description.

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Apr 7, 2026
@Ergus
Ergus requested review from CurtizJ and PedroTadim April 7, 2026 13:38
@CurtizJ CurtizJ self-assigned this Apr 7, 2026
@clickhouse-gh

clickhouse-gh Bot commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.00% 84.00% +0.00%
Functions 90.90% 90.90% +0.00%
Branches 76.50% 76.50% +0.00%

Changed lines: 100.00% (7/7) · Uncovered code

Full report · Diff report

@CurtizJ
CurtizJ added this pull request to the merge queue Apr 8, 2026
Merged via the queue into ClickHouse:master with commit e313380 Apr 8, 2026
159 of 161 checks passed
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Apr 8, 2026
@Ergus

Ergus commented Apr 8, 2026 •

Copy link
Copy Markdown
Member Author

@hanfei1991

This PR added that test, if it is flaky, then the full fix could be wrong. I see that -use_skip_indexes_on_data_read is 0 probably related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-bugfix Pull request with bugfix, not backported by default pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

full-text index direct-read throws error when multiple filters used on a merged, distributed table

5 participants