Repository navigation
Keep a lambda on its side of ARRAY JOIN - #119186
Conversation
|
Workflow [PR], commit [b3a2cfd] Summary: ✅
AI ReviewSummaryThis PR fixes the Findings❌ Blockers
Tests
Final Verdict
LLVM Coverage ReportMeasured on commit b3a2cfd.
Changed lines: Changed C/C++ lines covered: 4/4 (100.00%) · Uncovered code |
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, 16 s compile time in total, 7 of them have a recent master baseline. |
ExpressionActions::linearizeActions gives a node one argument per child plus one extra argument only when the node is an INPUT, and its final loop then assumes every entry of ActionsDAG::inputs has that extra argument. Constant folding in removeUnusedActions retyped a childless Function-typed node to COLUMN in place without removing it from inputs, so such an entry had no arguments at all and arguments.front() ran on an empty vector: hardened libcxx turns that into __libcpp_verbose_abort, i.e. the server dies with SIGABRT. The folded value reaches that state through a header: a lambda that captures only an IN subquery set folds to a ColumnConst holding a ColumnFunction, that constant lands in the shard header, and ReadFromRemote::addConvertingActions builds the converting DAG from the header, where addInput keeps the ColumnConst on the input node. The disjunct that let a childless node be folded was added by ClickHouse#119186 to fold a capture-free lambda; before it, !children.empty() excluded every childless node, so an input could never be retyped. Restricting the disjunct to FUNCTION nodes keeps that fold (addFunctionImpl sets type = FUNCTION and tryFoldFunctionToConstant only sets node.column, so a folded lambda is still a FUNCTION node here) while restoring the invariant, which ActionsDAG::deserialize already states and enforces with INCORRECT_DATA. Guarding the crash site was rejected: it would leave a COLUMN node in inputs, so required_columns and input_positions would silently disagree with the pipeline header. Dropping the node from inputs was rejected too, because the pipeline still delivers that column and arity would break in executeOnColumns. Reachable from plain SQL with default settings, on a stable release: SELECT arrayExists(x -> (x IN (SELECT 2)), [2]) FROM remote('127.0.0.{2,3}', system.one) LIMIT UNTIL 1; The residual NOT_IMPLEMENTED that this query then returns (a Function(...) column cannot be serialized to a shard) is pre-existing: a binary with the pre-ClickHouse#119186 guard returns exactly the same error, with the server alive. Co-Authored-By: Claude Opus 5 <[email protected]>
Repro: https://fiddle.clickhouse.com/971f4ccb-4ebf-48b9-b68b-31ab879d5120
Related: #112241
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixes a case where lambda is pushed up through the ARRAY JOIN step (lambda that captures nothing was moved below the ARRAY JOIN step, away from the higher-order function that applies it)
Workflow [PR]
Sync PR [sync-upstream/pr/119186]
Version info
26.9.1.1457(included in26.9and later)