Repository navigation
Add columns token_key and token_value to table function mergeTreeTextIndex - #120183
Conversation
Add `KeyValuePairsTokenizer::decodeToken`, the inverse of `encodeToken`: it reads the reversed varint trailer backwards and splits a token into its key, value and `is_rest` flag. Use it in three places that previously printed the raw token with its binary trailer: - `MergeTreeIndexConditionText::getDescription` shows `"key": "value"` pairs in `EXPLAIN indexes = 1`. - The step description of `ReadFromTextIndexCount` (trivial count from the index) shows `token = 'key': 'value'`. - The table function `mergeTreeTextIndex` gets two additional columns `token_key` and `token_value` for indexes with the `keyValuePairs` tokenizer. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Add the virtual `ITokenizer::formatTokenForLogs`. The default renders a token as `"token"`;
`KeyValuePairsTokenizer` overrides it to render the `Map` entry the token encodes: `{"key": "value"}`.
Use it in `MergeTreeIndexConditionText::getDescription` (`EXPLAIN indexes = 1`), in the step
description of `ReadFromTextIndexCount` and in the `Reading tokens` log line, so no call site
branches on the tokenizer type. The trivial count description now quotes plain tokens as
`"alpha"` instead of `'alpha'`, matching the condition description.
In the `mergeTreeTextIndex` table function, `token_key` and `token_value` are filled from a
single `decodeToken` pass per dictionary block instead of decoding every token once per column.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
Workflow [PR], commit [79b1e18] Summary: ❌
AI ReviewSummaryThis PR adds decoded Findings
Final VerdictStatus: Minimum required actions: make LLVM Coverage ReportMeasured on commit 79b1e18.
Changed lines: Changed C/C++ lines covered: 130/137 (94.89%) · Uncovered code |
keyValuePairs text index tokens in mergeTreeTextIndex, EXPLAIN and logstoken_key and token_value to table function mergeTreeTextIndex
The "distributed plan" job enables `serialize_query_plan`, with which `ReadFromTextIndexCount` is not injected into the plan, so the test lost the "Trivial count from text index" lines. Pin `serialize_query_plan = 0` like `02346_text_index_optimize_trivial_count` does. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=120183&sha=dbc857f72d2caeff1896a80abe3c6ab815e4b6fb&name_0=PR&name_1=Stateless%20tests%20%28amd_asan_ubsan%2C%20distributed%20plan%2C%20parallel%2C%20selected%20tests%29 PR: ClickHouse#120183 Co-Authored-By: Claude Fable 5.1 <[email protected]>
…n formatting - `resolveSourceIndex` requires `SHOW TABLES` on the source table, the grant that already reveals the index definition in `system.data_skipping_indices` and is implied by a grant on any column, so `DESCRIBE mergeTreeTextIndex(...)` no longer tells the table, the index type or the tokenizer apart without any privilege. - `executeImpl` derives the columns from the same resolved index object the storage reads with (`getTableStructure`), instead of resolving the metadata a second time. - `formatTokenForLogs` quotes with `doubleQuoteString`, so quotes, backslashes and control bytes in a token (or in a `keyValuePairs` key or value) do not break the `EXPLAIN` and trivial-count descriptions. - Test 05219 covers the structure-resolution grants; test 05218 covers the escaping. PR: ClickHouse#120183 Co-Authored-By: Claude Fable 5.1 <[email protected]>
`formatTokenForLogs` uses `quoteString`, so a plain token renders as
`'token'` and a `keyValuePairs` token as the `Map` literal
`{'key': 'value'}`; quotes, backslashes and control bytes stay escaped.
Twelve references with `Condition:`, trivial-count or `Reading tokens`
lines are updated accordingly. Test 05218 stores the special-character
pair, because the trivial-count step does not fire for a token that is
absent from every part.
PR: ClickHouse#120183
Co-Authored-By: Claude Fable 5.1 <[email protected]>
…uepairs-decode-token # Conflicts: # src/TableFunctions/TableFunctionMergeTreeTextIndex.cpp
…aster After the merge, resolving the index also runs `StorageMergeTreeTextIndex::checkAccess`, so `DESCRIBE` with only `SHOW TABLES` on the source table is denied like reading is. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Revert the token rendering introduced in ClickHouse#120183: `formatTokenForLogs` uses `doubleQuoteString` again, so a plain token renders as `"token"` and a `keyValuePairs` token as `{"key": "value"}` in `EXPLAIN`, in the description of `ReadFromTextIndexCount` and in the `Reading tokens` log line. Escaping of quotes, backslashes and control bytes is unchanged. Twelve references are updated back. Test 05218 keeps the row with the special-character pair, because the trivial-count step does not fire for a token that is absent from every part. Test 04099 keeps the escaped form `"[\"foo\",\"bar\"]"`: its old reference predates `formatTokenForLogs`, which renders inner quotes escaped. Co-Authored-By: Claude Opus 5 <[email protected]>
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes12 object files changed (+41.48 KiB total), 0 added.
716 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units23 translation units recompiled, 134 s compile time in total, 23 of them have a recent master baseline. Median compile-time ratio to the baselines is ×1.09 (machine-speed difference or a change affecting every TU); per-TU deltas below are relative to that ratio. |
edc986f
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
The table function
mergeTreeTextIndexnow returns columnstoken_keyandtoken_valuewith the decoded parts of each token for text indexes with thekeyValuePairstokenizer.Workflow [PR]
Sync PR [sync-upstream/pr/120183]
Version info
26.10.1.456-master(included in26.10and later)