Skip to content

[BUG] JSQLParser 5.4-SNAPSHOT : ClickHouse : ARRAY JOIN / LEFT ARRAY JOIN not supported in SELECT #2468

Description

@tomershay

Failing SQL Feature

ClickHouse supports ARRAY JOIN and LEFT ARRAY JOIN, which unnest an array-typed column of a table in the FROM clause into one row per element (comparable to LATERAL UNNEST). Unlike a regular join it has no right-hand table and no ON/USING condition, its operand is an array expression with an optional alias. LEFT ARRAY JOIN additionally keeps rows whose array is empty, emitting the element type's default value. JSQLParser fails to parse both forms.

See the ClickHouse docs:
https://clickhouse.com/docs/en/sql-reference/statements/select/array-join

SQL Example

CREATE TABLE t (s String, arr Array(UInt32)) ENGINE = MergeTree ORDER BY s;

INSERT INTO t VALUES ('a', [1, 2]), ('b', []), ('c', [3]);

SELECT s, x FROM t LEFT ARRAY JOIN arr AS x;

Parsing error

ParseException: Encountered: <K_ARRAY_LITERAL> / "ARRAY", at line 1, column 25, in lexical state DEFAULT.

Tested with Clickhouse 25.8.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions