Repository navigation
Report the real error when an in-place IN-set build destroys its source - #114983
Conversation
…urce
`FutureSetFromSubquery::buildOrderedSetInplace` speculatively builds the set
of an `IN` subquery during index analysis. A subquery whose source plan
cannot be cloned - a read from a remote cluster, for example - takes the
destructive path, which consumes `source`. When the build then throws, the
set can never be built again: `build` returns a null plan, every caller
takes that for "nothing left to build", and the query keeps running with an
unready set until `FunctionIn` reports the logical error `Not-ready Set is
passed as the second argument for function 'in'`.
That is exactly what happens whenever a caller deliberately ignores an
in-place build failure. Statistics-based part pruning is such a caller: it
logs the failure and keeps reading the part whose condition it could not
evaluate. So
SELECT count() FROM t
WHERE a IN (SELECT a FROM clusterAllReplicas('cluster_with_an_unavailable_replica', currentDatabase(), t))
reported `Not-ready Set` instead of the connection error, aborting the
server in a build with `abort_on_logical_error`.
Remember why the destructive in-place build failed and rethrow it from
`build` instead of returning a null plan. The query now fails with the real
reason - the same error it fails with when no in-place build is attempted at
all.
This is the cause of the master `Stress test (arm_release)` failure
`Logical error: Not-ready Set is passed as the second argument for
function 'A (STID: 0250-3e49)`:
https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=2926be24e6102daae60b8f44c88969495a76ec3c&name_0=MasterCI&name_1=Stress%20test%20%28arm_release%29
|
Workflow [PR], commit [38e13b3] Summary: ✅
AI ReviewSummaryThis PR preserves the original subquery exception when a destructive speculative Final Verdict✅ No blocking issues found. LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 45/48 (93.75%) · Uncovered code |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction. Compile time of recompiled translation units182 translation units recompiled, 1534 s compile time in total, 182 of them have a recent master baseline. |
alexey-milovidov
left a comment
There was a problem hiding this comment.
Looks like a good change.
FutureSetFromSubquery::buildOrderedSetInplacespeculatively builds the set of anINsubquery during index analysis. A subquery whose source plan cannot be cloned - a read from a remote cluster, for example - takes the destructive path there, which consumes the source plan. When that build then throws, the set can never be built again:buildreturns a null plan, every caller takes that for "nothing left to build", and the query keeps running with an unready set untilFunctionInreports the logical errorNot-ready Set is passed as the second argument for function 'in'.That is exactly what happens whenever a caller deliberately ignores an in-place build failure. Statistics-based part pruning is such a caller: it logs the failure and keeps reading the part whose condition it could not evaluate. So
reported
Not-ready Setinstead of the connection error, which aborts the server in a build withabort_on_logical_error.The failure of a destructive in-place build is remembered now and rethrown from
buildinstead of returning a null plan, so the query fails with the real reason - the same error it fails with when no in-place build is attempted at all.This is the cause of the recurring master
Stress testfailureLogical error: Not-ready Set is passed as the second argument for function 'A (STID: 0250-3e49), seen onarm_releaseandarm_msana few times a day since 2026-07-23:CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=2926be24e6102daae60b8f44c88969495a76ec3c&name_0=MasterCI&name_1=Stress%20test%20%28arm_release%29
Related: #107924
Related: #107619
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix the logical error
Not-ready Set is passed as the second argument for function 'in'for a query with anINsubquery reading from a remote cluster: the query now fails with the actual error from the subquery, such as a connection failure.