Skip to content

Invalid SQL syntax generated for clickhouse database on join keys when using tesseract #10316

@BlueMagma2

Description

@BlueMagma2

Describe the bug
Invalid SQL syntax generated for clickhouse database when grouping by joined cubes
Cubejs generate join key of the form: (table1.col1 = table2.col2 OR ((table1.col1 IS NULL) AND (table2.col2 IS NULL))), trying to match keys having null values,

Clickhouse doesn't support using "is null" in join keys

It also try to cast fields to STRING instead of String which also cause a syntax error on clickhouse (EDITED 02/04/26)

Clickhouse doesn't support using "is null" in join keys

To Reproduce
make a query involving a group by over a joined cube with clickhouse as the database backend

Expected behavior
Generate another equivalent syntax compatible with clickhouse, for exemple COALESCE(table1.col1, -1) = COALESCE(table2.col2, -1) works

Version:
cubejs:1.3, cubejs:1.6.7

*EDIT 02/04/26:
Relevant Configuration
CUBEJS_TESSERACT_SQL_PLANNER: "true" <= This gets fixed when tesseract is deactivated

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions