Repository navigation
materializeBlock: instantiate type-only header columns before materializing - #122128
Conversation
…lizing A RIGHT/FULL JOIN under plan-based parallel replicas can receive a left header whose columns are declared by type only (column == nullptr), e.g. the residual column from a constant NULL conjunct in the ON clause. HashJoin::materializeColumnsFromLeftBlock calls materializeBlockInplace on that header, which dereferenced the missing column -> SIGSEGV in JoiningTransform::transformHeader -> JoinStep::updateOutputHeader. Instantiate an empty column of the declared type for type-only entries, matching the existing convention in JoinStepLogical::updateOutputHeader. Fixes ClickHouse#121906
|
Please make a PR comment in accordance with the template |
|
Workflow [PR], commit [cf34c8d] Summary: ✅
AI ReviewSummaryThis PR fixes the Final Verdict✅ No actionable findings in the current revision. LLVM Coverage ReportMeasured on commit cf34c8d.
Changed lines: Changed C/C++ lines covered: 9/9 (100.00%) · Uncovered code |
|
Done — the |
Build profile diff (arm_release)Commit See the job log for details. |
|
📊 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
|
…test Without this, the harness-randomized automatic mode can pick a single-replica plan for the small test tables, so the test never exercises the plan-based parallel-replicas header-building path and passes vacuously even if the original segfault regresses. Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
Fixed — pinned |
|
Ilias Aberkane seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Backport #122128 to 26.9: materializeBlock: instantiate type-only header columns before materializing
Backport #122128 to 26.8: materializeBlock: instantiate type-only header columns before materializing
…e-only header columns before materializing
Backport #122128 to 26.10: materializeBlock: instantiate type-only header columns before materializing
Closes: #121906
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix a server crash when a
RIGHT JOIN/FULL JOINis planned for parallel replicas (parallel_replicas_plan_based=1) and the join output header declares a column by type only — e.g. the residual column of a constantNULLconjunct in theONclause. Type-only header columns are now materialized as an empty column of the declared type instead of being dereferenced as null.Documentation entry for user-facing changes
Motivation / issue
Fixes #121906 — a
RIGHT JOINwhoseONclause carries a constantNULLconjunct (AND CAST(NULL AS Nullable(UInt8))) segfaults underparallel_replicas_plan_based=1while the join step builds its output header. Reproduced 3/3 by the reporter on 26.10.1.552;INNER/LEFT/FULLand untyped-NULL/toNullable(1)variants are unaffected.JoinStep::updateOutputHeader->JoiningTransform::transformHeader->ConcurrentHashJoin::initialize->HashJoin::materializeColumnsFromLeftBlockcallsmaterializeBlockInplaceon the left header (required forRIGHT/FULLjoins so non-joined rows get correct defaults). Under plan-based parallel replicas that header can declare a column by type only (column == nullptr) — e.g. the residual column for the constantNULLconjunct — andmaterializeBlockInplace(src/Core/Block.cpp) dereferenced it unconditionally, giving theSIGSEGVatBlock.cppelement.column->convertToFullColumnIfConst().Fix
materializeBlockandmaterializeBlockInplacenow instantiate an empty column of the declared type (element.type->createColumn()) for type-only entries before materializing — the same conventionJoinStepLogical::updateOutputHeaderalready uses for null header columns fromActionsDAG::getResultColumns(). This covers every caller that can receive a type-only header column (join initialization, post-join header materialization intransformHeader, and the parallel-replicas header reconciliation inPlannerJoinTree).Regression test
tests/queries/0_stateless/04768_parallel_replicas_right_join_null_conjunct.sqlruns the issue'sRIGHT JOIN ... AND CAST(NULL AS Nullable(UInt8))under the plan-based parallel-replicas settings (test_cluster_one_shard_three_replicas_localhost,max_parallel_replicas=3,parallel_replicas_for_non_replicated_merge_tree=1), checks the same path forFULL JOIN, and a matchingRIGHT JOINcontrol.Verification
Not built locally — the change instantiates a declared-type column for type-only header entries plus the stateless test; the diff was reviewed against
masterand relies on CI for compilation and test execution.Workflow [PR]
Sync PR [sync-upstream/pr/122128]
Version info
26.10.1.2505-master(included in26.10and later)26.10.8.22,26.9.20.21,26.8.29.8