Repository navigation
ClickHouse: support the strictness before the join type (ASOF LEFT JOIN, ANY LEFT JOIN, ...) - #987
Closed
MunMunMiao wants to merge 1 commit into
Closed
MunMunMiao wants to merge 1 commit into
MunMunMiao wants to merge 1 commit into
Conversation
The ClickHouse dialect only recognised the strictness after the join type (`LEFT ASOF JOIN`). ClickHouse also accepts it before the type, and its documentation uses that form (`ASOF LEFT JOIN`, `ANY LEFT JOIN`, `ALL INNER JOIN`). Without it, `ASOF` and `ANY` stayed at the end of the previous line and the join was split in two.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The phrase expansion correctly covers the intended syntax and is supported by focused formatting tests.
0 open findings
What changed in this PR
Adds ClickHouse formatting support for join strictness keywords placed before the join type.
Changes:
- Recognizes
ANY,ALL, andASOFbefore join types, optionally withGLOBALandOUTER. - Adds formatting tests for representative strictness-first joins.
| File | Description |
|---|---|
src/languages/clickhouse/clickhouse.formatter.ts |
Adds strictness-first join phrases. |
test/clickhouse.test.ts |
Tests supported strictness-first forms. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Author
|
Closing for now: I'm going to handle the formatting on my side instead. Thanks for the library. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The ClickHouse dialect only knows the join strictness after the join type (
LEFT ASOF JOIN,LEFT ANY JOIN). ClickHouse also accepts it before the join type, and its documentation uses that form:ASOF LEFT JOINin the syntax of the ASOF JOIN sectionANY LEFT JOINin an example query on the same pageALL INNER JOINin the text about the block nested loop joinSuch a join is not recognised as one unit, so the strictness keyword is left at the end of the previous line:
Before (15.9.0,
language: 'clickhouse'):After:
Change
Adds
[GLOBAL] {ANY|ALL|ASOF} [INNER|LEFT|RIGHT|FULL] [OUTER] JOINnext to the existing join phrase. The existing forms are unchanged. I only included the strictness words that the documentation shows before the join type (ANY,ALL,ASOF).Tests
Added the new forms to the
supportsJoinlist intest/clickhouse.test.ts(ANY LEFT JOIN,ALL INNER JOIN,ASOF LEFT JOIN,ASOF LEFT OUTER JOIN,GLOBAL ANY LEFT JOIN, ...).pnpm exec jestpasses for all dialects (5901 passed, 1 skipped), andtsc --noEmit,prettier --checkandeslintare clean.Fixes #989.
This change was prepared with Claude Code (an AI coding assistant) and checked by running the full test suite locally.