Clickhouse: Support CREATE MATERIALIZED VIEW
mohaidoss opened this issue · comments
mohaidoss commented
Search before asking
- I searched the issues and found no similar issues.
What Happened
Parsing with the ClickHouse dialect seems broken. It fails immediately, no further linting/parsing happens.
The parsing errors at the beginning of the file, with !! Expected: "<Delimited: [<Ref: 'StatementSegment'>]>"
Expected Behaviour
The file is valid, as it can run on ClickHouse with no issue. It shouldn't raise any parsing errors.
Observed Behaviour
As shown in the screenshot above, I receive the following parsing error:
[L: 1, P: 1] |file:
[L: 1, P: 1] | unparsable: !! Expected: "<Delimited: [<Ref: 'StatementSegment'>]>"
[L: 1, P: 1] | word: 'CREATE'
[L: 1, P: 7] | whitespace: ' '
[L: 1, P: 8] | word: 'MATERIALIZED'
[L: 1, P: 20] | whitespace: ' '
[L: 1, P: 21] | word: 'VIEW'
[L: 1, P: 25] | whitespace: ' '
[L: 1, P: 26] | word: 'db'
[L: 1, P: 28] | dot: '.'
[L: 1, P: 29] | word: 'mv_table'
[L: 1, P: 37] | newline: '\n'
[L: 2, P: 1] | word: 'ENGINE'
[L: 2, P: 7] | whitespace: ' '
[L: 2, P: 8] | word: 'MergeTree'
[L: 2, P: 17] | newline: '\n'
[L: 3, P: 1] | word: 'ORDER'
[L: 3, P: 6] | whitespace: ' '
[L: 3, P: 7] | word: 'BY'
[L: 3, P: 9] | whitespace: ' '
[L: 3, P: 10] | word: 'tuple'
[L: 3, P: 15] | start_bracket: '('
[L: 3, P: 16] | end_bracket: ')'
[L: 3, P: 17] | newline: '\n'
[L: 4, P: 1] | word: 'AS'
[L: 4, P: 3] | whitespace: ' '
[L: 4, P: 4] | word: 'SELECT'
[L: 4, P: 10] | whitespace: ' '
[L: 4, P: 11] | star: '*'
[L: 4, P: 12] | whitespace: ' '
[L: 4, P: 13] | word: 'FROM'
[L: 4, P: 17] | whitespace: ' '
[L: 4, P: 18] | word: 'db'
[L: 4, P: 20] | dot: '.'
[L: 4, P: 21] | word: 'table'
[L: 4, P: 26] | semicolon: ';'
[L: 4, P: 27] | newline: '\n'
[L: 5, P: 1] | [META] end_of_file:
==== parsing violations ====
L: 1 | P: 1 | PRS | Line 1, Position 1: Found unparsable section: 'CREATE MATERIALIZED
| VIEW db.mv_table\nENG...'
WARNING: Parsing errors found and dialect is set to 'clickhouse'. Have you configured your dialect correctly?
How to reproduce
With a test.sql containing:
CREATE MATERIALIZED VIEW db.mv_table
ENGINE MergeTree
ORDER BY tuple()
AS SELECT * FROM db.table;
Run
sqlfluff parse test.sql --dialect clickhouse
Dialect
clickhouse
Version
3.0.3
Configuration
.sqlfluff
[sqlfluff]
large_file_skip_byte_limit = 0
Are you willing to work on and submit a PR to address the issue?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct