Repository navigation
Fix LOGICAL_ERROR reading SHARED paths of dynamic types of a JSON column with the columns cache - #127867
Conversation
…cache The first reader of a JSON column in a read call decodes every requested SHARED path and puts the decoded columns into the substreams cache; the other readers of the same column take their paths from there through SerializationObjectTypedSharedData::insertPathFromCache, which was a plain insertRangeFrom. For an empty Dynamic destination (or a JSON one, whose dynamic paths are Dynamic) that keeps SharedVariant at local discriminator 0 and appends the decoded variants after it, i.e. a Variant column whose variants are not in global order. Without the columns cache the readers of a call are the same in every call, so that column is only ever appended to. With the columns cache the readers of one call can differ granule by granule: when the other reader is served from the cache, this reader becomes the first reader and decodes the next granule straight into that column, and SerializationVariant throws "Trying to deserialize data into Variant column with not global variants order" (LOGICAL_ERROR, abort in debug builds). Seen in 05296_json_shared_typed_paths_nested_types with use_columns_cache = 1. The remainder path of the same file already keeps the invariant that a destination is either empty or has the part's exact dynamic structure: insertRangeFromDecoded takes the exact structure into an empty column first. Use it in insertPathFromCache too. It covers all three callers: the whole JSON column, a SHARED path read as a subcolumn, and a sub-object. The test extends 05402_json_shared_typed_paths_columns_cache, which covers the same reader-order mechanism with non-dynamic path types only. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 1 finding) plus my own review of the diff.
Severity: ❌ blocker / Also noticed, not this PR: a Compact part without substream marks reaches the same message through a different copy in Session id: cron:clickhouse-review-slot-10:20261026-173100 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-5:20261026-164900 |
|
Workflow [PR], commit [f23fd57] Summary: ✅
AI ReviewSummaryPreserves the decoded dynamic structure when copying Final VerdictStatus: ✅ Approve. |
|
cc @Avogar @Algunenano, could you review this and add the |
CI finish ledger - da91460Every 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:20261027-170011 |
…d-paths-cache-copy-structure
|
Done: merged master, which now includes #127881, in f5a1947. The diff of this PR is unchanged. On the merged debug build, |
CI finish ledger - f5a1947Every 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:20261028-143006 |
|
@groeneai update with master |
…d-paths-cache-copy-structure
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units7 translation units recompiled, 8 s compile time in total, 7 of them have a recent master baseline. |
CI finish ledger - 15d73b2Every 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:20261029-160007 |
Backport #127867 to 26.10: Fix `LOGICAL_ERROR` reading `SHARED` paths of dynamic types of a `JSON` column with the columns cache
… of dynamic types of a `JSON` column with the columns cache
Related: #127000
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Stateless tests (amd_debug, parallel)aborted withLogical error: 'Trying to deserialize data into Variant column with not global variants order'in05296_json_shared_typed_paths_nested_typeswith randomizeduse_columns_cache = 1(report). The code is new in #127000 and is master-only; its backport to 26.10 is #127829, still open.The first reader of a
JSONcolumn in a read call decodes every requestedSHAREDpath and puts it into the substreams cache; the other readers take the path from there ininsertPathFromCache, a plaininsertRangeFrom. For an emptyDynamic(orJSON) destination that gives a variant column whose variants are not in global order. With the columns cache the readers of one call can differ granule by granule: when the other reader is served from the cache, this reader becomes the first one, decodes the next granule straight into that column, andSerializationVariantthrows.insertPathFromCachenow uses the file'sinsertRangeFromDecoded, which gives an empty destination the exact structure of the decoded column first, as the remainder path already does. It covers the three callers: the whole column, a path read as a subcolumn, and a sub-object.05402_json_shared_typed_paths_columns_cachegets one block per caller plus one on a Compact part with substream marks. Each aborts the unfixed debug build and passes with the fix; 50/50 randomized runs pass, and so do the otherjson_shared_typed_pathsand columns cache JSON tests.Workflow [PR]
Sync PR [sync-upstream/pr/127867]
Version info
26.11.1.1104-master(included in26.11and later)