Skip to content

Support dot notation for JSON-casted columns #53908

@danthegoodman1

Description

@danthegoodman1

Use case

Improved UX for querying JSON-casted data (e.g. stored as a string). Schema inference would determine the type at query-time.

Describe the solution you'd like

Querying like:

SELECT o.a, o.b.c, o.b.d[3] FROM json

Rather than:

SELECT JSONExtractString(JSONExtractString(message, 'request'), 'method') as method,
       JSONExtractInt(message, 'status')                                  as status,
       count() 
...

Describe alternatives you've considered

Using a JSON data type is the only decent UX in clickhouse for JSON data. The other approaches advised such as pair-wise arrays or maps feel hacky and/or don't support keys with different data types (e.g. a is int, b is string).

The JSON data type is also not ideal for high-cardinality of possible JSON paths: #39492

Here is a fiddle of what I would like to do (and it fails): https://fiddle.clickhouse.com/db25eb58-311c-4c41-b0d5-36630cf8f78d

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