Repository navigation
Do not use text index for has/mapContainsKey/mapContainsValue with an empty needle - #110246
Conversation
… empty needle The text index never indexes empty values, and a needle that tokenizes to an empty token list produces an All-mode text search over zero tokens, which is vacuously true. Because the text index condition can replace the real predicate evaluation (exact/direct read), every row matched: has(a, ''), mapContainsKey(m, '') and mapContainsValue(m, '') returned all rows instead of 0. Extend the empty-needle guard added in #108340 (equals branch) to the has handler and the mapKeys/mapValues (mapContainsKey/mapContainsValue and their *Like variants) branch: when the tokenized needle is empty, bail out so the predicate falls back to a full scan with real evaluation. Closes: #110092 Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Workflow [PR], commit [60bb05c] Summary: ✅
AI ReviewSummaryThis PR closes the exact direct-read text-index bug where an empty needle could turn into an empty token set and then an always-true virtual predicate for Final VerdictStatus: ✅ Approve |
|
Your PR was poisoned by the test |
Address review feedback: the empty-needle wrong-results path is only reached when `query_plan_direct_read_from_text_index` is enabled, which `clickhouse-test` otherwise randomizes. Force the setting on for the index-lookup block so the regression reliably exercises the fixed path. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Both remaining CI reds are unrelated to this PR:
@groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=110246&sha=72768ce112527547fd077031893e6c2c7404b30f&name_0=PR&name_1=Stress%20test%20%28arm_msan%29 and provide a fix in a separate PR (see the analysis in #111053). If the fix is already in progress, link it here. |
|
The arm_msan red is the #111053 That is a separate failure mode from our #110999, which pins the four tests to |
|
The fresh |
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 13/13 (100.00%) · Uncovered code |
Backport #110246 to 26.3: Do not use text index for has/mapContainsKey/mapContainsValue with an empty needle
Backport #110246 to 26.5: Do not use text index for has/mapContainsKey/mapContainsValue with an empty needle
Backport #110246 to 26.4: Do not use text index for has/mapContainsKey/mapContainsValue with an empty needle
Backport #110246 to 26.6: Do not use text index for has/mapContainsKey/mapContainsValue with an empty needle
Backport #110246 to 26.7: Do not use text index for has/mapContainsKey/mapContainsValue with an empty needle
…ContainsKey/mapContainsValue with an empty needle
…ContainsKey/mapContainsValue with an empty needle
…ContainsKey/mapContainsValue with an empty needle
…ContainsKey/mapContainsValue with an empty needle
Do not use text index for has/mapContainsKey/mapContainsValue with an empty needle
STOR: has / mapContains* with an empty needle and a text index -> wrong. Effect in the production build a394e92: wrong/failing (the upstream test fails on it and passes on official 26.8.8.8; evidence/fix_ci_20260925/upstream_repro/residual/110246.PROD263.txt). Upstream patch unchanged, with its test(s): 02346_text_index_bug110092. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closes: #110092
This is a continuation of #110094
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed wrong results for functions
has,mapContainsKeyandmapContainsValuewith an empty needle when a text index is present.Version info
26.7.2.1,26.6.2.104,26.5.6.65,26.4.5.153,26.3.17.70