Skip to content

Comments

Clickhouse SQL parsing fixes#7122

Open
jwhitaker-gridcog wants to merge 6 commits intotobymao:mainfrom
jwhitaker-gridcog:jw/clickhouse
Open

Clickhouse SQL parsing fixes#7122
jwhitaker-gridcog wants to merge 6 commits intotobymao:mainfrom
jwhitaker-gridcog:jw/clickhouse

Conversation

@jwhitaker-gridcog
Copy link
Contributor

@jwhitaker-gridcog jwhitaker-gridcog commented Feb 22, 2026

This PR contains three Clickhouse SQL parsing fixes

  1. support for the .^ JSON parsing operator, e.g. select json_col.^key
  2. support for args for the JSON() type, e.g. select val::JSON(col1 String, SKIP col2)
    • for this one, Claude put the special parsing code in the Clickhouse dialect instead of adding it to base expressions, and honestly I agree with it because this is very clickhouse-specific. However I do note that none of the other _parse_type dialect implementations have any custom parsing logic in them - should this have gone in base expressions anyway?
  3. support for sql security on views and mat views.

For each of these I wrote a test by hand and got Claude Code to implement it, then did any post-AI fixes in a separate commit. Claude is honestly probably more reliable than me at this; I've contributed a couple of small things to sqlglot before but I'm nowhere near fluent in your parser design.

Thanks for maintaining this!

akdor1154 and others added 6 commits February 23, 2026 06:54
Add support for ClickHouse's `.^` operator for accessing nested JSON
subcolumns. Introduces a new `DOTCARET` token type, `NestedSelect`
expression, and corresponding parser/generator support in the ClickHouse
dialect.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…arams)

Parse and generate ClickHouse JSON type arguments including column type
hints (col String), SKIP paths (SKIP col), and config parameters
(max_dynamic_paths=2).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add parsing and generation for ClickHouse SQL SECURITY syntax on
CREATE VIEW, CREATE MATERIALIZED VIEW, and ALTER TABLE MODIFY:

- SQL SECURITY DEFINER | INVOKER | NONE
- DEFINER = 'user' | CURRENT_USER
- ALTER TABLE v MODIFY SQL SECURITY ... DEFINER = ...

New AlterModifySqlSecurity expression class handles the ALTER TABLE
MODIFY action. DefinerProperty and SqlSecurityProperty are placed at
POST_SCHEMA location (after view name) in ClickHouse, overriding the
default POST_CREATE location.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants