Repository navigation
Conversation
Internal second-model review: adjudication log (click to expand)Two rounds of pre-publication review by an independent model (engine: codex), plus my own cold review of
Severity: ❌ blocker / One scope decision worth stating plainly: I did not add a Session id: cron:clickhouse-review-slot-9:20260925-083004 |
|
Workflow [PR], commit [376eba1] Summary: ❌
AI ReviewSummaryThe PR fixes Map-key skip-index analysis by verifying resolved substream identity and passing metadata directly to index conditions. The added regression passes on head Findings❌ Blockers
Tests
Final Verdict❌ Block. Fix these incorrect-pruning paths with regression coverage, or link explicit tracking issues for the inherited defects before approval. |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes20 object files changed (+7.94 KiB total), 0 added.
711 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Slowest function optimization changes (ThinLTO)Median per-function time ratio to the master baseline:
Compile time of recompiled translation units2319 translation units recompiled, 14324 s compile time in total, 2319 of them have a recent master baseline. Median compile-time ratio to the baselines is ×0.93 (machine-speed difference or a change affecting every TU); per-TU deltas below are relative to that ratio. |
|
📊 Cloud Performance Report ✅ AI verdict: no significant changes detected. K_source=6 K_base=30 flagged=0/65 clickbench🟢 No significant changes tpch_adapted_1_official🟢 No significant changes Debug info
|
CI finish ledger - 6c77e3dEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task whose
All 176 check runs completed (157 pass, 14 not selected, 5 red), No master merge is pushed for this, and that is measured rather than a preference: the one Session id: cron:our-pr-ci-monitor:20260925-150335 |
ClickHouse#119457 made each bloom_filter, ngrambf_v1, tokenbf_v1, sparse_grams and text index condition build and keep a set of every column and static subcolumn named like a Map key subcolumn, which costs O(indexes x columns) on every filtered SELECT. Look up the one parsed name in the table's columns instead. Co-Authored-By: Claude Opus 5.5 <[email protected]>
6c77e3d to
30d258d
Compare
|
Done in 30d258d, now a single commit: the check is one |
…dex analysis A subcolumn of an EPHEMERAL column is not readable, so `a.b.key_x` next to an EPHEMERAL `a Tuple(b Tuple(key_x String))` still reads the map `a.b`, and the removed column census did not refuse it. Keep that behaviour. Co-Authored-By: Claude Opus 5.5 <[email protected]>
CI finish ledger - e2db640Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
All 146 check runs completed (109 passed, 35 not selected, 2 red), Session id: cron:our-pr-ci-monitor:20260928-200457 |
…columns performance test `least_greatest_const_columns #2` returns the 256-byte constant `repeat('d', 256)` for every row, so the result `ColumnString` grows its `chars` by power-of-two `realloc` up to 16 MiB per block. Whether jemalloc grows that buffer in place or moves and copies it (`large_ralloc` -> `memcpy`) differs between server processes, and in CI CPU profiles that copy is the only part of the query whose sample count differs between the two servers. In 14 days the two servers differed by more than 15% in 94 of 775 amd and 23 of 1692 arm runs of this query, and in none for `#3`, which takes the same arguments with `least` and returns the ~7-byte `toString(number)`. Add a constant `'e'` that wins every row, so the result is one byte per row. The query still compares `toString(number)` against the four 256-byte constants that are not materialized since ClickHouse#119108, and still returns a constant argument. Failing job: https://github.com/ClickHouse/ClickHouse/actions/runs/36432228454/job/109047348805 PR: ClickHouse#122184 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Fixing PR for the amd_release 5/6 perf red (join_squashing_blocks #0): |
…on-per-skip-index-condition # Conflicts: # src/Storages/MergeTree/MergeTreeIndexBloomFilter.cpp # src/Storages/MergeTree/MergeTreeIndexBloomFilter.h # src/Storages/MergeTree/MergeTreeIndexBloomFilterText.cpp # src/Storages/MergeTree/MergeTreeIndexBloomFilterText.h # src/Storages/MergeTree/MergeTreeIndexConditionText.cpp # src/Storages/MergeTree/MergeTreeIndexConditionText.h # src/Storages/MergeTree/MergeTreeIndexText.cpp
CI finish ledger - a4a94eaEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
CIDB has no other Session id: cron:our-pr-ci-monitor:20261013-200005 |
|
|
|
Result for the amd_release 5/6 red ( |
…ight-table column The hash join probe loops called the out-of-line AddedColumns::appendFromBlock for every matched row. When the join outputs no column of the right table, record_row_refs is false and the callee returned immediately, but the call stayed in the loop, and its cost depended on where the linker placed the loop and the callee: join_squashing_blocks #0/ClickHouse#1 ran 17-20% slower in about one build in 64 (the amd_release reds on ClickHouse#122184 and ClickHouse#120758), and 1.4x slower in some process starts. Make appendFromBlock ALWAYS_INLINE so the record_row_refs test happens in the loop, and keep the recording part, LazyOutput::addRef, out of line with NO_INLINE: inlining its body into every probe loop made hashjoin_low_cardinality_key #0 5-10% slower and pushed processMatch out of line, even in loops where addRef never runs. Joins that record row refs keep one call per match, to the same body as before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Dear @CurtizJ, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
…tion-per-skip-index-condition Master already replaced the per-condition census of names shadowing Map key subcolumns with a lazy `IsShadowingColumn` callback (ClickHouse#122144), which is what this branch did with a `StorageMetadataPtr`. Take master's version of the conflicting files and keep this branch's behaviour for `EPHEMERAL` columns in `IMergeTreeIndex::getMapSubcolumnShadowingCheck`: a subcolumn of an `EPHEMERAL` column is not readable, so it does not refuse the Map key subcolumn. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…owing callback Replace the `IsShadowingColumn` callback that came from master (ClickHouse#122144) with this branch's original approach: each `bloom_filter`, `ngrambf_v1`/`tokenbf_v1`/`sparse_grams` and `text` index condition keeps the `StorageMetadataPtr`, and `tryParseMapSubcolumnName` takes the `ColumnsDescription` and looks the name up directly. Remove `IMergeTreeIndex::getMapSubcolumnShadowingCheck`. A subcolumn of an `EPHEMERAL` column is not readable, so it again does not refuse the Map key subcolumn, as tested in `05188_map_subcolumn_shadowed_by_physical_column`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Name resolution tries the shortest prefix first, so beside a Map `a.b` a JSON column `a` claims `a.b.key_zzz` as one of its paths, and a predicate on that name reads the JSON. `tryParseMapSubcolumnName` refused only columns and static subcolumns with that name, so `bloom_filter`, `tokenbf_v1`, `ngrambf_v1`, `sparse_grams` and `text` indexes over the map read it as key `zzz` of `a.b` and pruned granules whose rows match. Resolve the name as the reader does and accept it only if it is read from the Map's storage column. Also count subcolumns of `EPHEMERAL` columns as claimants again, as master does: the analyzer binds the name to them, with their type. Drop the `EPHEMERAL` case from `05188`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… key subcolumn Two paths of one storage column can claim the same flat name: in ``c Tuple(`j.m` Map(String, String), j JSON(m Map(String, String)))`` the element answers `c.j.m`, while the path `m` of the JSON element answers `c.j.m.key_k`. Both resolve to the storage column `c`, so `tryParseMapSubcolumnName` accepted the JSON value as a key of the element map, and skip indexes over it pruned matching rows. Accept the name only if its substreams path is the Map's path followed by `MapKeyValue`, as `subcolumnDescendsFromColumn` does for rewrites. Move `isSameSubstream` to `ISerialization`: `FunctionToSubcolumnsPass` and `DeltaLakeMetadataDeltaKernel` had identical private copies. PR: ClickHouse#122184 Review: ClickHouse#122184 (comment) Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
The two red I have not pushed it because you are working on the branch; I can push it if you want. |
The test adds skip indexes with `ALTER TABLE ... ADD INDEX`, which Iceberg tables reject with `Alter of type 'ADD_INDEX' is not supported by Iceberg storage`. https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=122184&sha=2752501de6e1c5810e61d5d5c426ff3611572eb6&name_0=PR ClickHouse#122184 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tion-per-skip-index-condition Resolve conflicts with ClickHouse#130814: keep its expression matching (`index_nodes`) and the `IsShadowingJSONSubcolumn` check, and keep passing the `StorageMetadataPtr` instead of the removed `IsShadowingColumn` callback for Map key subcolumns. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… callback Replace the `IsShadowingJSONSubcolumn` callback and `IMergeTreeIndex::getJSONSubcolumnShadowingCheck` by a `ColumnsDescription` passed to `tryMatchJSONSubcolumnToIndex` and `tryMatchNodeToJSONIndex`, as for Map key subcolumns: the `bloom_filter` condition already holds the metadata snapshot. Co-Authored-By: Claude Opus 5.5 <[email protected]>
| if (auto column = columns.tryGetColumn(options, String(name))) | ||
| { | ||
| auto json = columns.tryGetColumn(options, String(json_column)); | ||
| if (!json || column->getNameInStorage() != json->getNameInStorage()) |
There was a problem hiding this comment.
[Blocker] Verify the resolved substream of the indexed JSON
The relocated claimant check still accepts different subcolumns of the same storage column. With c Tuple(j JSON, `j.x` String), both c.j and c.j.x have storage name c, so this check accepts the sibling string as path x of the indexed JSON.
Reproduced with the current head's Fast test binary:
CREATE TABLE t
(
c Tuple(j JSON, `j.x` String),
INDEX idx JSONAllPaths(c.j) TYPE bloom_filter GRANULARITY 1
)
ENGINE = MergeTree ORDER BY tuple();
INSERT INTO t SELECT tuple(CAST('{}', 'JSON'), 'hit');
SELECT count() FROM t WHERE c.j.x = 'hit' SETTINGS use_skip_indexes = 0;
SELECT count() FROM t WHERE c.j.x = 'hit' SETTINGS use_skip_indexes = 1;The counts are 1 and 0, and EXPLAIN shows idx pruning the only granule. IN ('hit') also loses the row. Resolve the full name and verify that its substream path actually descends from the indexed JSON's path, as the Map helper now does, and add a stateless regression. This defect is retained from the moved implementation.
| const String & json_function_name, | ||
| const JSONIndexArgumentTypes & json_argument_types, | ||
| const IsShadowingJSONSubcolumn & is_shadowing_subcolumn = {}); | ||
| const ColumnsDescription * columns = nullptr); |
There was a problem hiding this comment.
[Blocker] Require metadata for every JSON-index matcher caller
The optional metadata parameter lets callers bypass claimant validation entirely. All JSON matcher calls in MergeTreeConditionBloomFilterText and MergeTreeIndexConditionText still omit it, including MergeTreeIndexBloomFilterText.cpp:430,595 and MergeTreeIndexConditionText.cpp:1321,2439,2491. Both condition classes now retain the metadata needed for the check.
For example, on the current head:
CREATE TABLE t
(
j JSON,
`j.x` String,
INDEX idx JSONAllPaths(j) TYPE text(tokenizer = 'array') GRANULARITY 1
)
ENGINE = MergeTree ORDER BY tuple();
INSERT INTO t VALUES ('{}', 'hit');
SELECT count() FROM t WHERE j.x = 'hit' SETTINGS use_skip_indexes = 0;
SELECT count() FROM t WHERE j.x = 'hit' SETTINGS use_skip_indexes = 1;The counts are 1 and 0: the predicate reads the physical string, while the index probes the absent JSON path. The same failure reproduces with tokenbf_v1(512, 3, 0) over JSONAllPaths(j), and with a text index over JSONAllValues(j) for equality and IN.
Make metadata mandatory and pass it through every JSON matcher call in both classes, with stateless coverage. This is an existing unsafe path retained by the API refactor; fixing the claimant check alone cannot cover these callers.
| { | ||
| return std::make_shared<MergeTreeConditionBloomFilterText>( | ||
| predicate, context, index.sample_block, params, tokenizer.get(), getMapSubcolumnShadowingCheck(), collectJSONIndexArgumentTypes(*index.expression)); | ||
| predicate, context, index.sample_block, params, tokenizer.get(), metadata_snapshot, collectJSONIndexArgumentTypes(*index.expression)); |
There was a problem hiding this comment.
[Blocker] Validate the indexed expression in both text-index conditions
The strengthened Map-subcolumn check validates the predicate's source, but the text-index conditions still identify the indexed expression solely by its header name. A literal column named mapKeys(m) therefore passes the subsequent lookup even though its index contains unrelated data:
CREATE TABLE t
(
m Map(String, String),
`mapKeys(m)` Array(String),
INDEX idx `mapKeys(m)` TYPE tokenbf_v1(512, 3, 0) GRANULARITY 1
)
ENGINE = MergeTree ORDER BY tuple();
INSERT INTO t VALUES (map('k', 'hit'), ['other']);
SELECT count() FROM t WHERE m.key_k = 'hit' SETTINGS use_skip_indexes = 0;
SELECT count() FROM t WHERE m.key_k = 'hit' SETTINGS use_skip_indexes = 1;On the current head the counts are 1 and 0. Replacing the index type with text(tokenizer = 'array') also fails. Both implementations likewise lose rows when a literal JSONAllPaths(m) column is mistaken for the function's result.
Carry and validate the index expression DAG in both text-condition classes, following findMapIndexPosition and collectJSONIndexColumns in the bloom_filter implementation, and cover the Map and JSON variants together. This pre-existing failure remains reachable through the changed matchers even after supplying metadata and checking substream ancestry.
|
The three findings of the latest automated review reproduce identically on master before #130814, on the head of #130814, and on this head ( |
Closes: #122150
Related: #122144
Related: #119457
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed wrong results of queries filtering by a path of a
JSONcolumnanamed like a key subcolumn of aMapcolumna.b, such asWHERE a.b.key_k = 'x': abloom_filter,ngrambf_v1,tokenbf_v1,sparse_gramsortextindex over the map skipped granules with matching rows.Description
Name resolution tries the shortest prefix first, so beside a
Mapa.baJSONcolumnaclaimsa.b.key_kas one of its paths, and the predicate reads the JSON.tryParseMapSubcolumnNamerefused only columns and static subcolumns with that name, so skip indexes over the map read it as keykofa.band pruned the granule when the map had no such key. Now the name is resolved as the reader resolves it and accepted only if it is read from the map's storage column. Test05621.Also replace the
IsShadowingColumncallback from #122144 with the table's columns: the skip index conditions keep theStorageMetadataPtr, andtryParseMapSubcolumnNametakes theColumnsDescriptionand looks the name up directly.tests/performance/skip_indexes_wide_table.xml(64bloom_filterindexes, 1000 columns) guards against enumerating the table's columns per skip index condition again, which #122144 removed.Workflow [PR]
Sync PR [sync-upstream/pr/122184]