Skip to content

Name the join algorithms that were tried in the "can't execute" error - #115226

Merged
Manerone merged 4 commits into
ClickHouse:masterfrom
elkinal:improve-join-algorithm-error
Aug 20, 2026
Merged

Manerone merged 4 commits into
ClickHouse:masterfrom
elkinal:improve-join-algorithm-error

Conversation

@elkinal

@elkinal elkinal commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

When no enabled join algorithm can run a JOIN, the planner threw:

Can't execute any of specified algorithms for specified strictness/kind and right storage type

It named neither the algorithms that were tried nor the JOIN that failed, even though both are available at the throw site. Setting join_algorithm to something narrower for memory reasons and then writing an ASOF JOIN left you with nothing to act on.

It now reads:

None of the algorithms enabled by the 'join_algorithm' setting [grace_hash] can execute
this ASOF INNER JOIN with the given right table storage type

Algorithm names are printed through SettingFieldJoinAlgorithmTraits::toString rather than toString(JoinAlgorithm). The latter returns the uppercase enum spelling, GRACE_HASH, which the setting parser rejects, so the names in the message can now be pasted straight back into join_algorithm.

The message deliberately does not list the algorithms that would work. tryCreateJoin has no capability table, the rules live implicitly across its per algorithm branches, so naming them here would add a copy of knowledge that is already in the documentation and would rot quietly the next time an algorithm gains or loses support.

Also updates a comment in 02242_join_rocksdb.sql that quoted the old wording.

Changelog category (leave one):

  • Improvement

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

When no join algorithm enabled by the join_algorithm setting can execute a JOIN, the error message now names the algorithms that were tried and the strictness and kind of the JOIN that failed, instead of reporting only that none of them worked.


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

Version info

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

- The error said only "Can't execute any of specified algorithms for
  specified strictness/kind and right storage type". It named neither the
  algorithms that were tried nor the JOIN that failed, although both are
  available at the throw site. Setting `join_algorithm` and then writing an
  `ASOF JOIN` gave a dead end with nothing to act on.

- It now reads: "Can't execute ASOF INNER JOIN with any of the algorithms
  enabled by the 'join_algorithm' setting [grace_hash, partial_merge] for the
  given right table storage type".

- Algorithm names come from `SettingFieldJoinAlgorithmTraits::toString` rather
  than `toString(JoinAlgorithm)`. The latter returns the uppercase enum
  spelling, `GRACE_HASH`, which the setting parser rejects, so the names in the
  message can now be pasted straight back into `join_algorithm`.

- Adds a stateless test for both the rejected and the supported algorithms.

- Updates a comment in 02242_join_rocksdb.sql that quoted the old wording.
- The previous wording, "Can't execute X JOIN with any of the algorithms
  enabled by the 'join_algorithm' setting [...] for the given right table
  storage type", reads as though the storage type is what blocked the JOIN.
  That is true when a `direct` join is asked for over a non key-value table,
  but not for `ASOF` with `grace_hash`, where the strictness is what fails and
  the storage type is beside the point.

- It now states only what is actually known: "None of the algorithms enabled by
  the 'join_algorithm' setting [grace_hash] can execute this ASOF INNER JOIN
  with the given right table storage type".

- Deliberately not naming the algorithms that would work. `tryCreateJoin` has
  no capability table, the support rules live implicitly across its per
  algorithm branches, so listing them here would hardcode a fourth copy of
  knowledge that is already in the docs and would rot silently.
@CLAassistant

CLAassistant commented Aug 17, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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

clickhouse-gh Bot commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [65b76ae]

Summary: ✅


AI Review

Summary

This PR improves the NOT_IMPLEMENTED diagnostic when no enabled join_algorithm can execute a JOIN, and it now does so on both the planner path and the legacy ExpressionAnalyzer path. The current diff and the updated stateless coverage line up with that contract, and I did not find any remaining correctness, coverage, or PR-metadata issues worth blocking.

Final Verdict

✅ Approved

LLVM Coverage Report

Metric Baseline Current Δ
Lines 86.90% 86.90% +0.00%
Functions 91.90% 91.90% +0.00%
Branches 79.20% 79.20% +0.00%

Changed lines: Changed C/C++ lines covered: 22/22 (100.00%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label Aug 19, 2026
Comment thread src/Planner/PlannerJoins.cpp Resolved
@clickhouse-gh

clickhouse-gh Bot commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 65b76ae65 with master 90e6c433c (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
Binary Master PR Δ
programs/clickhouse-stripped 703.88 MiB 700.84 MiB -3.04 MiB (-0.43%)

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 units

8 translation units recompiled, 27 s compile time in total, 8 of them have a recent master baseline.

Job report

…text

Addresses review feedback on the pull request.

- `enable_analyzer = 0` takes `ExpressionAnalyzer::chooseJoinAlgorithm`, a second
  copy of the same loop that was left throwing the old wording. Both paths now
  produce the same message, so the improvement does not depend on which analyzer
  is in use.

- The existing test only asserted `NOT_IMPLEMENTED`, so it passed just as well
  with the old text and could not have caught the untouched legacy path. Adds a
  shell test that reads the message itself under both `enable_analyzer` values
  and checks that it names the setting, the algorithm that was tried and the
  JOIN strictness, and that it does not print the uppercase enum spelling, which
  the setting parser rejects.
Addresses review feedback. The test checked that the message names the JOIN
strictness but not the kind, so `INNER` could have disappeared from the message
and the test would still have passed, which is weaker than what the change
promises. It now asserts the kind on its own and the two together, so the test
also fails if they stop being reported as a single JOIN.
@Manerone
Manerone added this pull request to the merge queue Aug 20, 2026
Merged via the queue into ClickHouse:master with commit dabcc4c Aug 20, 2026
176 checks passed
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 20, 2026
nickitat added a commit to groeneai/ClickHouse that referenced this pull request Aug 24, 2026
`04926_direct_join_prepared_source` pinned the refusal to `Can't execute any of
specified algorithms`, but `chooseJoinAlgorithm` has said `None of the
algorithms enabled by the 'join_algorithm' setting [direct] can execute this ALL
LEFT JOIN with the given right table storage type` since
ClickHouse#115226 landed. All three
`expect_refusal` cases therefore printed `unexpected` and the test failed on
every run, reproducibly and independently of randomized settings, even though
the behaviour under test - declining instead of failing to clone - was correct.

The refusal is now recognised by the `NOT_IMPLEMENTED` code together with the
`storage type` tail that both wordings share, so a further reword of the
sentence does not break the test. The `Cannot clone` check this test exists for
stays first and stays exact. A query that succeeds, or that fails for an
unrelated reason, is still reported as `unexpected` rather than being mistaken
for the refusal.

CI report: https://d1k2gkhrlfqv31.cloudfront.net/clickhouse-test-reports-private/json.html?PR=70002&sha=6c220df461525fa4f73bb2dbaf765a1e47b3dc59&name_0=PR&name_1=Stateless%20tests%20(amd_asan_ubsan%2C%20distributed%20cache%2C%20meta%20in%20keeper%2C%20s3%20storage%2C%20parallel%2C%201%2F2)
Related: ClickHouse/clickhouse-private#70002

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@elkinal
elkinal deleted the improve-join-algorithm-error branch August 24, 2026 17:08
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-improvement Pull request with some product improvements 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.

4 participants