Repository navigation
Fix BAD_GET on whole-array comparison with a token-family skip index - #110057
Conversation
An Array(String) column carrying a text/tokenbf_v1/ngrambf_v1 skip index supports has/hasAny/hasAll, so the condition builders accept array constants. But scalar-string functions (equals, notEquals, like, ...) then called Field::safeGet<String>() on the array constant of e.g. a = ['x'], throwing BAD_GET while building the index condition and making a valid query unexecutable. Treat an array constant for a function that cannot consume it as UNKNOWN (scan all granules) instead of throwing. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-5:20260710-210200 |
|
Workflow [PR], commit [1fed255] Summary: ✅
AI ReviewSummaryThis PR hardens the Final Verdict
|
CI finish ledger — e326246 (corrected)CI fully finished (Finish Workflow complete). Every failure below has an owner. None is caused by this PR (a text-index Array(LC(Nullable)) null-skip fix in MergeTreeIndexText.cpp; cannot affect AST-fuzzer optimizer stacks, ReplicatedDatabase alter, or a coverage-build server death).
Session id: cron:our-pr-ci-monitor:20260711-030000 |
Move the array-constant guard from a single blanket check into each scalar-string case (equals, notEquals, like, hasToken, hasPhrase, startsWith, endsWith, match, ...) that calls safeGet<String>() on the whole constant, in both MergeTreeIndexBloomFilterText and MergeTreeIndexConditionText. The array-consuming functions (has(array)/hasAny/hasAll/multiSearchAny/hasAnyTokens/...) keep their existing array handling. Rewrite the regression test per review: single table `tab`, text index first, drop the experimental setting and GRANULARITY 1, remove the header block, and add the != and hasAny use_skip_indexes = 0 assertion pairs. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This comment was marked as resolved.
This comment was marked as resolved.
There was a problem hiding this comment.
@groeneai Change -- text index to SELECT 'Text index'. Do the same for the corresponding comments for tokenbf_v1 and ngrambf_v1
Co-Authored-By: Claude Opus 4.8 <[email protected]>
This comment was marked as resolved.
This comment was marked as resolved.
…rray-token-index # Conflicts: # src/Storages/MergeTree/MergeTreeIndexConditionText.cpp
Cover startsWith(a, [...]) / endsWith(a, [...]) with use_skip_indexes = 1 and = 0 for the text, tokenbf_v1 and ngrambf_v1 indexes. Those functions accept Array operands via FunctionStartsEndsWith and had the same safeGet<String>() BAD_GET failure mode as a = ['x'], which the previous =/!= only cases did not exercise. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
@rschu1ze all review points addressed on 8c91b3e:
Also addressed the bot finding: added Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-5:20260713-083300 |
|
@groeneai Stop pushing new commits, I will clean this PR up, then we can merge. |
|
Understood, no more commits from me. It is yours to clean up and merge. Thanks. |
…et-array-token-index
…et-array-token-index
|
@groeneai Fix the unrelated failure in 02346_text_index_parallel_replicas in a new PR. |
|
Acknowledged. Investigating the 02346_text_index_parallel_replicas flakiness now; I will open a separate PR and post the link back here (or report findings if it turns out not to be actionable). |
|
@rschu1ze Fix opened: #111138. Root cause: the probe asserts |
…et-array-token-index
…et-array-token-index
…et-array-token-index
CI finish ledger - 84719c8Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task
Session id: cron:our-pr-ci-monitor:20260726-163000 |
…et-array-token-index
CI finish ledger — 586a46bEvery failure below has an owner: a fixing PR (ours or external), or a full-effort fix task This head is a plain master merge on top of the previously ledgered
Note on the merged Session id: cron:our-pr-ci-monitor:20260727-043000 |
|
@rschu1ze New PR for the 02346_text_index_parallel_replicas flakiness: #112197. It supersedes #111138, which I closed. #111138 was wrong and that concession stands. This one does not touch the tokens cache. It comes from the CI settings data: |
…et-array-token-index
|
Update on the 02346_text_index_parallel_replicas flakiness I linked above: #112197 was closed, correctly, because pinning |
CI finish ledger - c19c401Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Not PR-caused: this pull request is a skip-index/text-index change and does not touch the Head Session id: cron:our-pr-ci-monitor:20260728-163000 |
…et-array-token-index
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 39/39 (100.00%) · Uncovered code |
CI finish ledger — 1fed255Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task All 174 checks completed with no failures.
Session id: cron:our-pr-ci-monitor:20260729-053000 |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed
BAD_GETerror when comparing anArray(String)column with an array literal (arr = ['x']) when the column has atext,tokenbf_v1orngrambf_v1skip index. Such a comparison is now treated as a full scan by the index instead of failing the whole query.Description
Closes: #110038
Token-family skip indexes (
text,tokenbf_v1,ngrambf_v1) are supported onArray(String)columns forhas/hasAny/hasAll, so their condition builders accept array-typed constants. Scalar-string functions (equals,notEquals,like,startsWith, ...) then calledField::safeGet<String>()on the array constant of e.g.a = ['x'], throwingCode: 170 ... Bad get: has Array, requested String. (BAD_GET)while BUILDING the index condition. The mere existence of the index made a valid query unexecutable;use_skip_indexes = 0was the only workaround.The fix guards both condition builders (
MergeTreeConditionBloomFilterText::traverseTreeEqualsandMergeTreeIndexConditionText::traverseFunctionNode): when the constant operand is an array but the function is not one of the array-consuming functions, the atom is treated as UNKNOWN (scan all granules) instead of throwing. Results are unchanged (verified againstuse_skip_indexes = 0), and the array functions the index does support continue to use it.CI report for the fuzzer finding: #110038 (repro fiddle linked there).