Skip to content

Skip the other side of a join when an empty IN set makes its result empty - #123927

Closed
groeneai wants to merge 10 commits into
ClickHouse:masterfrom
groeneai:join-skip-build-when-left-in-set-is-empty
Closed

groeneai wants to merge 10 commits into
ClickHouse:masterfrom
groeneai:join-skip-build-when-left-in-set-is-empty

Conversation

@groeneai

@groeneai groeneai commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Changelog category (leave one):

  • Performance Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

A JOIN whose result has to be empty because the query's WHERE ... IN (subquery), or a row policy with such an IN, filters an input it needs rows from (the left side of INNER, LEFT and CROSS JOIN, the right side of INNER, RIGHT and CROSS JOIN, either side of a SEMI JOIN, also through a chain of such joins) no longer reads or builds its other input when the subquery returns no rows, for every join algorithm. This restores the 26.6 speed of queries that filter a window PARTITION BY key with such an IN above a join, which 26.8 pushes below the window to the join. Closes #123875.

Description

#123875: with WHERE c1 IN (subquery) on a window PARTITION BY key above a LEFT JOIN and an empty subquery, 26.6 returns at once; 26.8 first builds the right side.

FilterTransform stops once an in conjunct's set is built and empty, but only when its output is needed. On 26.6 the WHERE stayed above the window, closing the join's output first. #110114 lets it pass the window; join push-down moves it to the join's left input, which a hash join reads only after building its right side. A plain LEFT JOIN of this shape was already slow on 26.6.

Change:

  • A plan pass records on each JoinStep and IEJoinStep the immutable in/nullIn sets whose emptiness empties the join: those filtering its left (INNER/LEFT/CROSS/SEMI) or right input (INNER/RIGHT/CROSS/SEMI), through Expression, Sorting, Filter, DISTINCT, ARRAY JOIN (with its element filter), window, LIMIT BY, GROUP BY keys (also two-stage), WITH TOTALS, runtime filter builds, full_sorting_merge's set filter and nested such joins (direct/ENGINE = Join included) to a local table's PREWHERE, row policy or Merge table filter.
  • Both steps add a pass-through EmptySetShortCircuitTransform to their main outputs: if one set is built and empty when first pulled, it finishes unread. Totals are not gated; an ENGINE = Set set can grow during the query, so neither the gate nor FilterTransform's empty-set exit uses it (master's did, for in).
  • Not covered: an IN inside a FROM subquery or a Merge child table's row policy; keyless/grouping-sets aggregation, partial aggregate projections, LIMIT or UNION below the join; filtered-side totals reaching the join; block nested loop joins.

Validation: the issue queries build 0 instead of 2,000,000 right rows. The new test fails on master for 39 shapes, passes 50/50 randomized; 28 mutations fail it. A 1,488-test join/IN A/B changes nothing else. Perf test join_left_in_empty_set.xml.

🤖 Generated with Claude Code


Workflow [PR]
Sync PR [sync-upstream/pr/123927]

groeneai and others added 2 commits October 5, 2026 00:46
…mpty

A join whose result must be empty because an input it needs rows from is
filtered by an `in` conjunct whose set is built and empty no longer reads
or builds its other input. Those inputs are the left one of an INNER,
LEFT, CROSS or COMMA join and the right one of an INNER, RIGHT, CROSS or
COMMA join, in either physical orientation (`swap_streams`, flipped
kinds), through nested joins of such kinds.

A plan pass at the end of `optimizeTreeSecondPass` collects those sets
(walking Expression, Sorting, CreateSetAndFilterOnTheFly and Filter steps,
nested JoinStep or IEJoinStep nodes and INNER or LEFT FilledJoinStep
nodes down to the PREWHERE of a local source step: MergeTree, Memory,
File, URL, S3; including `nullIn` under `transform_null_in`) and stores
them on the `JoinStep` or `IEJoinStep`. A RIGHT or FULL filled join is
not walked: it also emits the stored rows nobody matched. A remote source
is not read: it evaluates its PREWHERE on other servers, each with its
own set.
Both steps add `EmptySetShortCircuitTransform` to the main streams of the
joined pipeline through `addEmptySetShortCircuit`: it finishes without
pulling when one set is built and empty, so the join never builds or
reads its other input. Totals are never gated.

The set collector shared with `FilterTransform` skips sets that can grow
while the query runs (`ENGINE = Set`, see `PreparedSets.h`), so neither
the gate nor the filter's own empty-set exit, which this change also
extends to `nullIn`, takes a one-time decision from them. The filter used
to stop on an empty `ENGINE = Set` set for plain `in`; it now reads and
filters every block, as `in` evaluation and index analysis already do for
such sets.

This restores the early stop that a `WHERE x IN (subquery)` above the
join had before the filter could be pushed below a window step to the
join's input (ClickHouse#110114, issue ClickHouse#123875).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Remove the hasBuiltEmptySet declaration comment, which repeated the function name.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-request PR origin: a maintainer pinged or directed groeneai labels Oct 5, 2026
@groeneai

groeneai commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex; 7 findings over 1 full pass and 3 delta rechecks) plus my own review. The final delta recheck of this head found nothing.

# Sev Finding Verdict Evidence / action
1 ⚠️ Join chains: the walk stopped at an inner join, so the outer join still built its right side AGREE, fixed in round 1 nested joins are walked
2 ⚠️ transform_null_in = 1 (nullIn/globalNullIn) was not collected AGREE, fixed in round 1 null in arm
3 ⚠️ ie_join (IEJoinStep) never got the gate AGREE, fixed in round 1 left ie_join arm
4 ⚠️ A flipped (physical RIGHT) or right-side-filtered INNER full_sorting_merge join read the other side AGREE, fixed in round 1 swapped and right-filter arms
5 ⚠️ full_sorting_merge with max_rows_in_set_to_optimize_join > 0: the on-the-fly set filter step stopped the walk AGREE, fixed in round 2 onfly arm
6 ⚠️ A direct / ENGINE = Join join inside a chain stopped the walk AGREE, fixed in round 2 INNER/LEFT only: a RIGHT/FULL filled join also emits unmatched stored rows
7 ⚠️ nullIn over an empty ENGINE = Set table (which can grow while the query runs) ended the filter for good AGREE, fixed in round 3 the shared collector refuses such sets, so FilterTransform no longer stops on them for in either
8 ⚠️ A WHERE moved into the PREWHERE of a Memory/File/URL/S3 table was not seen AGREE, fixed in round 3 local sources only: a remote source evaluates its PREWHERE with its own sets
9 💡 The perf test queries take a few ms after the fix noted, not blocking the perf framework has no short-query check

Severity: ❌ blocker / ⚠️ major / 💡 nit.

@groeneai

groeneai commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. The new test's 24 skip arms read a side that throws if any row is evaluated; on master each fails with Code: 395 ... right side was read. The issue queries build 2,000,000 right rows on master (4,000,000 with two joins), JoinBuildTableRowCount, deterministic.
b Root cause explained? FilterTransform finishes on a built empty in set only when its output is needed. #110114 lets the WHERE pass the window step and the join push-down moves it to the join's left input, which a hash join reads only after building its right side, so the early stop above the join is lost.
c Fix matches root cause? Yes. The stop is restored above the join, where it was lost: a pass-through gate on the join's output that finishes when a set filtering an input the join needs rows from is built and empty. No filter is moved back, no setting added.
d Test intent preserved / new tests added? New stateless test (24 skip arms, 10 result controls, 3 EXPLAIN PIPELINE rows) and a perf test with the two issue queries. 05045_empty_in_set_short_circuit gains two arms asserting that an empty ENGINE = Set set still reads the whole table (in, nullIn); its old lines are unchanged.
e Both directions demonstrated? Yes. Master: 24 arms fail, controls identical. Fix: all 38 rows pass; both tests 50/50 randomized. Sixteen mutations (kind rules per side, nested joins, nullIn, the IEJoinStep gate, the JoinStep gate, the main-stream condition, mutable sets, the Sorting step, the on-the-fly set filter step, filled joins, the filled-join kind check, the local-source PREWHERE, the mutable-set check in the shared collector, descending into or) each turn a row red.
f Fix is general across code paths? The gate sits after the whole joined pipeline of both JoinStep and IEJoinStep, so it covers every algorithm (hash, parallel_hash, grace_hash, partial_merge, full_sorting_merge, ie_join, auto, default), both physical orientations, join chains (also through direct and ENGINE = Join joins), full_sorting_merge's on-the-fly set filter, the Filter path and the PREWHERE of every local source (MergeTree, Memory, File, URL, S3; a remote source evaluates it with its own sets and is not read); tested per shape.
g Fix generalizes across inputs (params/datatypes/wrappers)? It depends only on set emptiness, not key types; in, globalIn, nullIn, globalNullIn. An empty right input of a LEFT join, an empty left input of a RIGHT or FULL join, NOT IN, ENGINE = Set sets and the totals stream do not gate, each with a control row.
h Backward compatible? (maintainer-approved exception only) Yes. No setting or format change; results unchanged; EXPLAIN PLAN unchanged, EXPLAIN PIPELINE shows one more processor for such joins. FilterTransform no longer stops early on an empty ENGINE = Set set for plain in (it reads and filters, with the same result), since such a set can grow while the query runs.
i Invariants and contracts preserved? The gate finishes only when the join result must be empty: every step walked emits only rows derived from its input, and a side is collected only for the join kinds that emit nothing when it is empty; a filled join is passed only when it is INNER or LEFT (a RIGHT one emits its unmatched stored rows). Otherwise it passes chunks through unchanged. A 1,488-test A/B, a 136-test ENGINE = Join/direct A/B and a 500-test ENGINE = Set/Memory/File/URL/S3 A/B change no reference.

Session id: cron:clickhouse-impl-slot-6:20261004-234300

@clickhouse-gh

clickhouse-gh Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [a917148]

Summary: ❌

job_name test_name status info comment
AST fuzzer (amd_debug, targeted) FAIL
Logical error: Cannot call function A because is has B arguments but C columns were captured. (STID: 2458-4cb4) FAIL cidb

AI Review

Summary

This PR adds a join-output short-circuit so an immutable empty IN / nullIn set can stop the query before the join builds or reads its other side. The main approach is sound, but the collector still misses two live filter carriers, so the optimization remains incomplete in supported execution modes and the current test suite does not catch one of them.

Findings
  • ⚠️ Majors
    • [src/Processors/QueryPlan/Optimizations/setJoinEmptyResultSets.cpp:99] collectSets stops at SourceStepWithFilter after checking row-level filters, PREWHERE, and ReadFromMerge::getPushedDownFilters, but it never inspects source->getFilterActionsDAG() from [src/Processors/QueryPlan/SourceStepWithFilter.h:81]. optimizeLazyFinal populates exactly that hidden DAG via addFilter + applyFilters at [src/Processors/QueryPlan/Optimizations/optimizeLazyFinal.cpp:243], so a filtered ... FINAL ... WHERE key IN (SELECT ... FROM t_empty) input can still deterministically empty the join result while the other side is built or read anyway. Suggested fix: collect immutable empty-set conjuncts from getFilterActionsDAG() here and add a focused FINAL stateless arm.
    • [src/Processors/QueryPlan/Optimizations/setJoinEmptyResultSets.cpp:125] The pass still only follows node.children, but filterPushDown can sink the deciding predicate into a ReadFromLocalParallelReplicaStep at [src/Processors/QueryPlan/Optimizations/filterPushDown.cpp:1448], where addFilter stores it inside the nested local plan instead of as a normal child at [src/Processors/QueryPlan/ReadFromLocalReplica.cpp:34]. Because setJoinEmptyResultSets runs after considerEnablingParallelReplicas at [src/Processors/QueryPlan/Optimizations/optimizeTree.cpp:967], joins fed by local parallel replicas still miss the gate and build or read the other side even when an immutable empty IN already forces that input empty. The new regression test explicitly opts out of this mode with no-parallel-replicas at [tests/queries/0_stateless/05321_join_skips_build_when_left_in_set_is_empty.sql:1], so CI never exercises the broken path. Suggested fix: descend into read_from_local->getQueryPlan()->getRootNode() here and add coverage without the no-parallel-replicas escape hatch.
Final Verdict
  • Status: ⚠️ Request changes
  • Minimum required actions: surface hidden source filters from filter_actions_dag to the collector, and make the pass handle ReadFromLocalParallelReplicaStep (or explicitly narrow the supported surface for that mode instead of silently skipping it).

@clickhouse-gh clickhouse-gh Bot added the comp-query-optimizer Query plan optimization: physical plan steps, plan-level rewrites and optimizations (QueryPlan pa... label Oct 5, 2026
@clickhouse-gh

clickhouse-gh Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

📊 Cloud Performance Report

✅ AI verdict: no_change — no significant changes across 31 queries analysed

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
  • StressHouse run: ea4d9d36-1b0f-40d1-95d0-64f7f7f618d3
  • MIRAI run: 612bd206-044d-4f02-a10e-b336f603d20d
  • PR check IDs:
    • clickbench_844028_1791704587
    • clickbench_844040_1791704587
    • clickbench_844047_1791704587
    • tpch_adapted_1_official_844053_1791704587
    • tpch_adapted_1_official_844087_1791704587
    • tpch_adapted_1_official_844102_1791704587

…ilds

A SEMI join keeps only the rows with a match on the other side, so an empty
input on either side makes its result empty, not only the input its kind
names. `HashJoin::alwaysReturnsEmptySet` already handles a built empty right
side of a LEFT SEMI join, but a RIGHT SEMI join with a left-only
`IN (empty set)` condition, a swapped LEFT SEMI join, `ie_join` SEMI joins and
a chain over a RIGHT SEMI `Join` table still read the other side.

The walk also passes `BuildRuntimeFilterStep`, which join runtime filters
(on by default) insert above a hash join's build input and which preserves
its input rows. Without it, an empty set filtering the build side of an inner
join nested in another join did not reach the outer join, which then built
its own right side.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
groeneai and others added 2 commits October 5, 2026 08:25
…BY and GROUP BY

Filter push-down moves a WHERE condition below these steps when it uses
only their pass-through or key columns, so a join input such as
`(SELECT DISTINCT ...)`, `(... ARRAY JOIN ...)`, a window subquery (the
ClickHouse#110114 push-down), `LIMIT n BY k` or `GROUP BY k` hid the empty `IN` set
from the walk and the other side was still read. Each of these steps
outputs no rows for an empty input, so the walk now passes them. The
filter `query_plan_fuse_filter_into_array_join` moves into a (non-LEFT)
ARRAY JOIN is read like a FilterStep.

Aggregation is passed only with keys and without grouping sets: keyless
aggregation and a `()` grouping set output one row for an empty input
(measured: `GROUP BY GROUPING SETS ((k), ())` over an empty table returns
1 row). No query reaches those exclusions today (push-down never moves a
filter below them, and an `IN` subquery written inside such a subquery adds
a CreatingSets step that stops the walk), so they are kept for the
invariant, not covered by a test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…H TOTALS

`filterPushDown` moves the `IN` filter below `MergingAggregatedStep` and
`TotalsHavingStep` too, so the walk now passes them: a keyed, non-grouping-sets
merge of partial aggregates outputs nothing for an empty input (the same rule
as `AggregatingStep`), and `TotalsHaving` emits rows on its main output only
for input rows; its totals row goes to the totals port, which the gate leaves
open.

Covered: a two-stage `GROUP BY` subquery over remote shards
(`MergingAggregated` -> `Filter` -> `ReadFromRemote`), and a `WITH TOTALS`
subquery whose totals an outer aggregation drops. Still building the other
side, unchanged: a `WITH TOTALS` subquery whose totals reach the join (the
join's totals row is joined against the other side), and a distributed read
mixing local and remote shards (`Union` stops the walk; its output is empty
only when every branch is).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing a91714868 with master 46dfb8152 (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Object file sizes

17 object files changed (+113.11 KiB total), 2 added.

Object file Master PR Δ
src/CMakeFiles/dbms.dir/Processors/Transforms/EmptySetShortCircuitTransform.cpp.o new 62.64 KiB +62.64 KiB
src/CMakeFiles/dbms.dir/Processors/QueryPlan/Optimizations/setJoinEmptyResultSets.cpp.o new 40.71 KiB +40.71 KiB

719 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only clickhouse-bundle) and not compared.

Compile time of recompiled translation units

111 translation units recompiled, 905 s compile time in total, 109 of them have a recent master baseline.

Translation units without a recent master baseline:

  • src/Processors/QueryPlan/Optimizations/setJoinEmptyResultSets.cpp: 7.3 s

Job report

A row policy such as `k IN (SELECT k FROM t_empty)` on a local
MergeTree or Memory table is pushed into the read as its row-level
filter, next to PREWHERE, so the walk stopped at the source and the
join still read its other input. Read the row-level filter the same
way as PREWHERE. A policy kept as a separate filter step (serialized
query plan) was already covered, and FINAL (with the policy deferred
or not) behaves the same.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
if (array_join->hasElementFilter() && !array_join->isLeft())
append(getSetsRequiredByFilter(*array_join->getElementFilter(), array_join->getElementFilterColumnName()));
}
else if (const auto * source = dynamic_cast<const SourceStepWithFilter *>(step))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SourceStepWithFilter can also hide the deciding predicate in filter_actions_dag, not only in row_level_filter / PREWHERE. filterPushDown removes the visible FilterStep entirely for ReadFromMerge (src/Processors/QueryPlan/Optimizations/filterPushDown.cpp:1438) by calling ReadFromMerge::addFilter, and that pushed predicate then lives on the step (src/Storages/StorageMerge.cpp:821, src/Storages/StorageMerge.cpp:2533).

In that shape an immutable empty IN / nullIn on the preserved join side still makes the Merge read empty, but collectSets returns here without ever looking at the pushed-down filter, so the outer join still builds/reads its other input. Please also inspect source->getFilterActionsDAG() here (or otherwise descend into ReadFromMerge's hidden filters / child plans) and add a focused stateless ENGINE = Merge case.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in c71b311: the walk now reads the filters pushed into ReadFromMerge, with an ENGINE = Merge arm in 05321.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the ReadFromMerge-specific path, but the generic hidden-source-filter case from the original finding is still present. In src/Processors/QueryPlan/Optimizations/setJoinEmptyResultSets.cpp:105 the source branch still only inspects row-level filters, PREWHERE, and ReadFromMerge::getPushedDownFilters(): it never looks at source->getFilterActionsDAG() (src/Processors/QueryPlan/SourceStepWithFilter.h:81).

That matters because optimizeLazyFinal can absorb the deciding predicate into exactly that field by calling non_final_reading->addFilter(...) and applyFilters() (src/Processors/QueryPlan/Optimizations/optimizeLazyFinal.cpp:243 and src/Processors/QueryPlan/SourceStepWithFilter.cpp:90) before setJoinEmptyResultSets runs (src/Processors/QueryPlan/Optimizations/optimizeTree.cpp:840 / src/Processors/QueryPlan/Optimizations/optimizeTree.cpp:933). So a join input like SELECT ... FROM t FINAL ... WHERE k IN (SELECT ... FROM t_empty) can still miss the short-circuit and build/read the other join side.

Please also collect sets from source->getFilterActionsDAG() here and add a focused stateless FINAL arm.

`filterPushDown` moves a WHERE above `ReadFromMerge` into the step
(`ReadFromMerge::addFilter`), which applies it in every child read, so
no filter step was left for the walk to see and the join still read
its other input. Read those pushed-down filters like PREWHERE. A Merge
table over a remote table stays excluded by the existing remote check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@fm4v
fm4v requested a review from nihalzp October 5, 2026 19:52
if (prewhere && prewhere->need_filter)
append(getSetsRequiredByFilter(prewhere->prewhere_actions, prewhere->prewhere_column_name));
/// `ReadFromMerge` applies the filters pushed into it to every table it reads.
if (const auto * merge = typeid_cast<const ReadFromMerge *>(source))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReadFromMerge row-policy filters with IN subqueries are still invisible here. This branch only inspects getPushedDownFilters(), but ReadFromMerge::RowPolicyData::addFilterTransform installs the effective policy as a FilterStep plus DelayedCreatingSetsStep in each child plan (src/Storages/StorageMerge.cpp:2106 and src/Storages/StorageMerge.cpp:2352) specifically so the set builders also exist for FINAL and engines that cannot apply the predicate as a source filter.

So an ENGINE = Merge join input whose row policy is USING k IN (SELECT ... FROM t_empty) can still be deterministically empty while the join continues to build/read the other side. Please surface that filter here too, or explicitly narrow the advertised row policy / Merge support and tests.

The `assert_full_read` arms assert `read_rows = 100000`. When
`merge_tree_read_split_ranges_into_intersecting_and_non_intersecting_injection_probability`
fires on a multi-stream read (it is skipped when `use_query_condition_cache`
is on), the part is split into primary key layers and the granule on each
layer border is read by both neighbouring layers, so `read_rows` exceeds the
row count while the result stays exact. A 100000-row table only gets several
streams on object storage, hence the failure in the s3 storage job only
(101870 = 2 extra granules of 935 rows).

Clamp the injection probability to 0 for this test, as
05255_statistics_part_pruning_row_policy does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
if (!leftInputEmptiesJoin(table_join.kind(), table_join.strictness()))
return;
}
else if (!emptyInputEmptiesOutput(step))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

collectSets still misses the ReadFromLocalParallelReplicaStep wrapper, so the new join gate disappears as soon as the filtered input is executed through local parallel replicas. filterPushDown can sink the deciding predicate into that wrapper (src/Processors/QueryPlan/Optimizations/filterPushDown.cpp:1440), and ReadFromLocalParallelReplicaStep::addFilter stores it inside the nested local QueryPlan instead of as a normal child (src/Processors/QueryPlan/ReadFromLocalReplica.h:22, src/Processors/QueryPlan/ReadFromLocalReplica.cpp:34). Since setJoinEmptyResultSets runs after considerEnablingParallelReplicas (src/Processors/QueryPlan/Optimizations/optimizeTree.cpp:967) but this walk only follows node.children, a join on a parallel-replica read still builds or reads its other side even when an immutable empty IN already forces this side empty.

Please descend into read_from_local->getQueryPlan()->getRootNode() here, and add a focused coverage case without the no-parallel-replicas escape hatch.

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 447af39

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Stateless tests (arm_binary, s3 storage, DBReplicated, parallel, 1/2) / 05339_parquet_prewhere_subcolumn_read_through_column not from this PR: the test passes a session temporary table to IcebergLocal, which the replicated DDL worker cannot see (UNKNOWN_TABLE on iceberg_path). 61 PRs and 40 master runs show it since 2026-10-10 21:55Z #125121 (external, merged 00:36Z), the revert of my #124685 that added this test. The tested merge commit predates it, so I will merge master here to pick it up
Upgrade check (amd_release) / Part all_1_2_2 intersects previous part all_1_1_2 (STID 2002-2037) not from this PR: the parts were written by the 26.9.15.5 stress server, and the upgraded server refuses to load test_1.t at startup. Same STID on 10 other PRs in 30 days, the rolled-back TRUNCATE empty-part leak #122375 (external, merged), fixed on master; it stays red until a 26.9 release carries it
Performance Comparison (amd_release, master_head, 3/6) / dynamic_compact_read #0 not from this PR: the query has no join and no IN subquery, the previous head with the same source change passed it, and 3 unrelated PRs got the same slower verdict in the same hour, with 0 on master a fix task is created (investigating at full effort, fixing-PR link to follow here)
Mergeable Check, PR praktika rollups of the rows above #125121 and #122375 (external, merged); for the performance row, a fix task is created

Session id: cron:our-pr-ci-monitor:20261011-053007

…n-left-in-set-is-empty

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author

Fixing PR for Performance Comparison (amd_release, master_head, 3/6) dynamic_compact_read #0: #124676.

This is code placement, not this PR: ColumnDynamic::get, Field::assign and the other hot functions have identical machine code in slow and fast PR builds and only sit at different addresses, and both servers read the same 1,197,184 rows. On master bases from 098c332a2f60 on, PR builds were >10% slower in 5 of 11 runs (0 of 861 on older bases), while the official reference never was (0 of 22 master runs on those bases). #124676 makes the reference a master build with the PR flags; it does not cover a PR whose own diff moves these functions.

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - a917148

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
AST fuzzer (amd_debug, targeted) / Logical error: Cannot call function A because is has B arguments but C columns were captured. (STID: 2458-4cb4) not from this PR (it skips the join build side when the left IN set is empty): a fuzzed query over merge('information_schema', '.+') hit Cannot call function and because is has 194 arguments but 188 columns were captured while the Merge table filters its tables by virtual columns. 11 other PRs and 2 master runs show this STID since 2026-10-10 #125126 (mine, open)
PR praktika rollup of the row above #125126 (mine, open)

CIDB has no other FAIL or ERROR row on this head.

Session id: cron:our-pr-ci-monitor:20261011-110002

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-query-optimizer Query plan optimization: physical plan steps, plan-level rewrites and optimizations (QueryPlan pa... groeneai-origin-request PR origin: a maintainer pinged or directed groeneai pr-performance Pull request with some performance improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty IN (subquery) filter on a window PARTITION BY key no longer stops early, LEFT JOIN right side is built, about 5x slower (26.6 -> 26.8)

3 participants