Repository navigation
Fix cubic complexity of enumerating subcolumns of deeply nested types - #126554
Conversation
`supportsPooling` of `SerializationArray`, `SerializationNullable`, `SerializationTuple`
and `SerializationWrapper` (thus `SerializationNamed`) recursed into the nested
serialization, so it cost O(depth). It is called by every `create` of these
serializations before pooling. `IDataType::forEachSubcolumn` calls
`ISerialization::createFromPath` for every subcolumn, which applies one
`SerializationArray::create` per enclosing level, so for `Array` nested `D` levels
deep enumerating subcolumns took O(D^3) time: about 8 seconds of CPU for a depth
of 2000 and minutes with multiple GB of memory for a depth of 10000 (reachable via
schema inference with raised `max_parser_depth`).
Cache the result of `supportsPooling` of the nested serializations in the
constructors, which makes it O(1) and `forEachSubcolumn` O(D^2) for such types.
The remaining quadratic factor is inherent: there are D subcolumns `size0` ...
`size{D-1}` whose types have nesting depth up to D.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Workflow [PR], commit [4892784] Summary: ✅
AI ReviewSummaryThe PR caches nested Findings
Tests
Final VerdictStatus: |
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ack limit in TSan builds Co-Authored-By: Claude Opus 5.5 <[email protected]>
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units668 translation units recompiled, 5603 s compile time in total, 668 of them have a recent master baseline. Median compile-time ratio to the baselines is ×1.18 (machine-speed difference or a change affecting every TU); per-TU deltas below are relative to that ratio. |
|
📊 Cloud Performance Report ✅ AI verdict: Baseline selected using StressHouse version hint 26.11.1.42530; measured build ancestry could not be verified. Measured differences are not attributed to this PR. ⚙️ 1 flagged delta falls inside the range master itself produced for the same query over the last 7 days — environment variance, not attributable to this PR. no significant changes detected. K_source=6 K_base=28 flagged=0/65 clickbenchFlagged queries (1 of 43)
Change = percent below ×2; the ratio of medians (×N faster/slower) beyond, where percent understates the scale. q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on. tpch_adapted_1_official🟢 No significant changes Debug info
|
alexey-milovidov
left a comment
There was a problem hiding this comment.
Trivial. LGTM.
Backport #126554 to 26.10: Fix cubic complexity of enumerating subcolumns of deeply nested types
Resolve the conflict in `SerializationNullable.h`: 26.8 has no `isNullMapSubcolumn`, so keep only the cached `nested_supports_pooling` from the original PR. The resulting diff against the backport branch is identical to the original PR #126554. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Cherry pick #126554 to 26.8: Fix cubic complexity of enumerating subcolumns of deeply nested types
…mns of deeply nested types
Backport #126554 to 26.8: Fix cubic complexity of enumerating subcolumns of deeply nested types
Backport #126554 to 26.9: Fix cubic complexity of enumerating subcolumns of deeply nested types
supportsPoolingofSerializationArray,SerializationNullable,SerializationTupleandSerializationWrapper(thusSerializationNamed) recursed into the nested serialization, so it cost O(depth), and it is called on everycreateof these serializations.IDataType::forEachSubcolumncallsISerialization::createFromPathfor every subcolumn, which applies oneSerializationArray::createper enclosing level, so for anArraynested D levels deep, enumerating subcolumns took O(D^3) time: seconds of CPU for a depth of 2000 and minutes with multiple GB of memory for a depth of 10000 (reachable via schema inference with a raisedmax_parser_depth).Now the result of
supportsPoolingof the nested serializations is cached in the constructors, which makes it O(1) andforEachSubcolumnO(D^2) for such types. The remaining quadratic factor is inherent: there are D subcolumnssize0...size{D-1}whose types have nesting depth up to D.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix cubic complexity of enumerating subcolumns of deeply nested
Arraytypes.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/126554]
Version info
26.11.1.330-master(included in26.11and later)26.10.6.5,26.9.34.10,26.8.42.8