Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/languages/clickhouse/clickhouse.formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@ const reservedSetOperations = expandPhrases([
const reservedJoins = expandPhrases([
// https://clickhouse.com/docs/sql-reference/statements/select/join
'[GLOBAL] [INNER|LEFT|RIGHT|FULL|CROSS] [OUTER|SEMI|ANTI|ANY|ALL|ASOF] JOIN',
// The strictness can also come before the join type, e.g. `ANY LEFT JOIN`, `ALL INNER JOIN`
// and `ASOF LEFT JOIN`, which the documentation uses as well:
// https://clickhouse.com/docs/sql-reference/statements/select/join#asof-join-usage
'[GLOBAL] {ANY|ALL|ASOF} [INNER|LEFT|RIGHT|FULL] [OUTER] JOIN',
// https://clickhouse.com/docs/sql-reference/statements/select/array-join
'[LEFT] ARRAY JOIN',
]);
Expand Down
18 changes: 18 additions & 0 deletions test/clickhouse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,24 @@ describe('ClickhouseFormatter', () => {
'GLOBAL ALL JOIN',
'GLOBAL ASOF JOIN',

// Strictness before the join type
'ANY INNER JOIN',
'ANY LEFT JOIN',
'ANY RIGHT JOIN',
'ANY FULL JOIN',
'ALL INNER JOIN',
'ALL LEFT JOIN',
'ALL RIGHT JOIN',
'ALL FULL JOIN',
'ASOF INNER JOIN',
'ASOF LEFT JOIN',
'ASOF RIGHT JOIN',
'ASOF FULL JOIN',
'ANY LEFT OUTER JOIN',
'ASOF LEFT OUTER JOIN',
'GLOBAL ANY LEFT JOIN',
'GLOBAL ASOF LEFT JOIN',

'GLOBAL JOIN',

'OUTER JOIN',
Expand Down