Skip to content

Cannot parse SQL with JSON access #2703

@marcio-absmartly

Description

@marcio-absmartly

Description

The driver cannot parse the JSON data type access patterns in an sql query:
For example:
SELECT j.`m`.`a`[].`d`[0]
SELECT j.`m`.`a`.:`Array(JSON)`.`d`[0]

Steps to reproduce

CREATE TABLE x (`i` Int64, `j` JSON) ORDER BY i;
INSERT INTO x VALUES (1, '{"m":{"a":[{"d": 9000}]}}');

Error Log or Exception StackTrace

Parse error at line 1, column <...>.  Encountered: :. If you believe the SQL is valid, please feel free to open an issue on Github with this warning and the following SQL attached.
Parse error at line 1, column <...>.  Encountered: `d`. If you believe the SQL is valid, please feel free to open an issue on Github with this warning and the following SQL attached.

Expected Behaviour

Should just work.

Configuration

Client Configuration

We are using the JDBC v1 because we need support for sessions and multi-statements.

Environment

  • Cloud
  • Client version: 0.9.5
  • Language version: Java 21
  • OS: Linux

ClickHouse Server

  • ClickHouse Server version:
  • ClickHouse Server non-default settings, if any:
  • CREATE TABLE statements for tables involved:
  • Sample data for all these tables, use clickhouse-obfuscator if necessary

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions