Skip to content

Text index: fix forwarding tokenizer to supported functions - #103826

Merged
ahmadov merged 4 commits into
masterfrom
ahmadov/text-index-issue-103812
May 18, 2026
Merged

ahmadov merged 4 commits into
masterfrom
ahmadov/text-index-issue-103812

Conversation

@ahmadov

@ahmadov ahmadov commented May 1, 2026 •

Copy link
Copy Markdown
Member

Fixes #103812.

The tokenizer from the text index to the supported functions was not forwarded properly due to the selected NONE mode in the direct read optimization. For forwarding tokenizer properly, we still need the text index condition.

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 forwarding the tokenizer from the text index to supported functions.

Version info

  • Merged into: 26.5.1.753

@ahmadov
ahmadov marked this pull request as ready for review May 1, 2026 05:20
@clickhouse-gh

clickhouse-gh Bot commented May 1, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [9ca4d5b]

Summary: ✅


AI Review

Summary

This PR fixes text-index tokenizer/preprocessor forwarding for supported text-search functions when direct read falls back to TextIndexDirectReadMode::None (notably hasPhrase with query_plan_text_index_add_hint = 0) and adds a focused stateless regression test, including a case with preprocessor = lower(text). I re-checked prior discussion and current code/diff; there are no remaining correctness or test-coverage gaps in scope.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label May 1, 2026
@PedroTadim

Copy link
Copy Markdown
Member

Hi! Can we merge this soon?

@ahmadov
ahmadov requested review from CurtizJ and Ergus May 13, 2026 01:36
@Ergus Ergus self-assigned this May 13, 2026

@Ergus Ergus left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Very minor:

  1. I would add a false-positive negative test just in case (also for coverage)
  2. Add a test with preprocessor + ngrams to cover that combination.

@Ergus

Ergus commented May 13, 2026

Copy link
Copy Markdown
Member

| Fixes forwarding the tokenizer from the text index to supported functions.

I think that this changelog could be a bit more specific.

@alexey-milovidov

Copy link
Copy Markdown
Member

This was fixed by #105146. Let's update the branch.

@clickhouse-gh

clickhouse-gh Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.20% 84.10% -0.10%
Functions 91.40% 91.40% +0.00%
Branches 76.60% 76.60% +0.00%

Changed lines: 95.83% (23/24) · Uncovered code

Full report · Diff report

@ahmadov
ahmadov added this pull request to the merge queue May 18, 2026
Merged via the queue into master with commit e546770 May 18, 2026
166 checks passed
@ahmadov
ahmadov deleted the ahmadov/text-index-issue-103812 branch May 18, 2026 14:47
@clickgapai

Copy link
Copy Markdown
Contributor

Hi — could this be a backport candidate for 26.4, 26.3 (LTS), 26.2? No backport label was found, and the affected code appears to exist in those branches based on a file/function presence check.

Affected code: selectConditions and preprocessTextIndexFunction in optimizeDirectReadFromTextIndex.cpp — introduced in 25.10 (October 2025).

Why this might apply: The TextIndexDirectReadMode::None handling was introduced in commit 2833e38 on 2025-10-14, after 25.8 LTS (released 2025-08-29). The bug affects the direct read optimization for text indexes with hasPhrase when query_plan_text_index_add_hint=0, causing wrong results. This is user-visible data correctness issue.

Other supported branches (25.8) predate 25.10 (October 2025) and do not contain this code.

Caveat: I verified that the modified code exists in those branches, but not whether the bug is actually reachable there — a new caller in master may be what makes this newly observable. If older branches can't reach the affected path, please ignore this; otherwise consider pr-must-backport or a version label like v26.4-must-backport.

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.

Wrong result with query_plan_direct_read_from_text_index enabled and query_plan_text_index_add_hint disabled

6 participants