apache / apache/datafusion-sqlparser-rs

ClickHouse parameterized view

Open
#1,167 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
3.5k
Forks
772
Avg merge
4d 9h
Merged PRs (30d)
17

Description

I'd like to parse ClickHouse SQL which contains parameters for their [parameterized views](https://clickhouse.com/docs/en/sql-reference/statements/create/view#parameterized-view). The SQL looks like

`CREATE VIEW view AS SELECT * FROM TABLE WHERE Column1={column1:datatype1}`

Note the parameter is in the { } brackets. I don't think this could be implemented in the `Dialect` as curly braces are tokenized without deferring to the dialect. It would probably have to be handled by the tokenizer as a special case like numbers are for MySQL & Hive.

Contributor guide

No contributing guide indexed for this repository

Research direction

Begin at the tokenizer's handling of the MySQL and Hive numeric special cases, then inspect how curly-brace tokens are emitted before Dialect processing. Done means the parser accepts the shown ClickHouse parameterized-view form while preserving existing curly-brace behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
clickhouse, rust, sql
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.