Skip to content

Add test: IEJoin bail-out for a prepared Join-storage right side is untested - #113753

Merged
PedroTadim merged 1 commit into
ClickHouse:masterfrom
clickgapai:qa-bot/coverage-pr109920
Aug 7, 2026
Merged

PedroTadim merged 1 commit into
ClickHouse:masterfrom
clickgapai:qa-bot/coverage-pr109920

Conversation

@clickgapai

@clickgapai clickgapai commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Found via ClickGap automated review. Please close or comment if this is incorrect or needs adjustment.

This is a test-only PR — no source code changes. Please review: test quality, whether the claimed coverage gaps are real, and whether test output makes sense.

Adds test coverage for 1 untested code path(s), found during automated review of PR #109920.
That PR Adds the sort-based IEJoin algorithm (ie_join value of join_algorithm) for joins whose ON section has two inequality comparisons. New: JoinAlgorithm::IE_JOIN enum + setting value, IEJoinStep query plan step, IEJoinTransform/IEJoinAlgorithm merging transform, `QueryPipelineBuilder::join

1. IEJoin bail-out for a prepared Join-storage right side is untested
src/Processors/QueryPlan/JoinStepLogical.cpp:918
Risk: buildPhysicalJoinImpl calls tryExtractIEJoinDescription as soon as isIEJoinPreferred holds (ie_join first + supported kind/strictness + two inequality conjuncts). The only thing that stops IEJoin from claiming a join against a prepared Join storage is JoinStepLogical.cpp:918-919 if (planning_context.is_storage_join) return {};, which the LLVM report marks uncovered. Risk: if this bail-out is broken or removed, a join against a Join-engine table (or any prepared join storage) … **What's unique vs PR tests:** The PR's routing negatives (04544_ie_join_detection_negatives.sql, 04556_ie_join_detection_strictness_negatives.sql, 04548_ie_join_algorithm_priority.sql) all reject IEJoin on the shape of the ONexpression or on the strictness. None of them exercises the planning-context bail-out: no test in the repository combinesie_joinwith anENGINE = Joinright side. If this PR is already merged, the cases can equivalently be appended to04544_ie_join_detection_negatives.sqlinstead of … **Tags:**-- Tags: no-old-analyzer—no-old-analyzer: IEJoin is planned only by the analyzer-based planner (JoinStepLogical`); the same tag is used by every IEJoin test the PR adds.
Try it on ClickHouse Fiddle

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

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

Not applicable — test-only change.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Version info

  • Merged into: 26.8.1.953 (included in 26.8 and later)

@clickgapai

Copy link
Copy Markdown
Contributor Author

Pre-PR Validation Gate (per ClickGap pipeline):

a) Deterministic repro? ✅
Test exercises the previously-uncovered branch and passes (correct behaviour).

b) Root cause explained? ✅
src/Processors/QueryPlan/JoinStepLogical.cpp:918 -- if (planning_context.is_storage_join) return {}; inside tryExtractIEJoinDescription; no test in either test tree combines ie_join with an ENGINE = Join table.

c) Fix matches root cause? ✅
N/A for coverage gap — this PR adds a regression test, not a fix. Asserts current correct behaviour at the cited line.

d) Test intent preserved? / New tests added? ✅
New regression test added: 04561_ie_join_storage_join.sql.

e) Both directions demonstrated? ✅
Test passes (MATCH) on master proving current correctness; would fail if the cited branch regressed. Single-direction is the correct shape for a coverage gap test.

f) Fix is general, not a narrow patch? ✅
Test asserts the invariant at the cited line — covers the branch, not a specific input shape.

@PedroTadim PedroTadim self-assigned this Aug 7, 2026
@PedroTadim PedroTadim added the can be tested Allows running workflows for external contributors label Aug 7, 2026
@clickhouse-gh

clickhouse-gh Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [920fa61]

Summary: ✅


AI Review

Summary

This test-only PR adds 04561_ie_join_storage_join to cover the planning_context.is_storage_join bail-out in tryExtractIEJoinDescription when ie_join is listed first but the right side is a prepared Join-engine table. The new EXPLAIN assertion and result checks line up with the current planner and storage-join behavior, and I did not find any correctness or test-quality issues in the current diff.

Final Verdict

✅ Approve. No new inline findings.

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 pr-not-for-changelog This PR should not be mentioned in the changelog pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants