v.21.12New Features

Support JOIN ON 1 = 1 with CROSS JOIN semantics

Support JOIN ON 1 = 1 that have CROSS JOIN semantic. This closes #25578. #25894 (Vladimir C).
ClickHouse now supports JOIN ON 1 = 1 syntax which provides the same behavior as a CROSS JOIN.

Why it matters

This feature allows users to explicitly write a JOIN clause with ON 1 = 1 condition, enabling the semantic of a CROSS JOIN in query statements. It improves query expressiveness and compatibility with SQL standards, making it easier to perform cross joins without requiring special syntax.

How to use it

To use this feature, write a JOIN followed by ON 1 = 1 in your SQL query. For example:

SELECT * FROM table1 JOIN table2 ON 1 = 1

This will behave as a CROSS JOIN, producing the Cartesian product of the two tables.