Fix 25 parser errors: multiple syntax improvements#16
Merged
kyleconroy merged 6 commits intomainfrom Dec 15, 2025
Merged
Conversation
Parser changes: - SELECT ALL syntax (SELECT ALL 'a') - FILTER clause on aggregate functions (argMax() FILTER(WHERE ...)) - DROP SETTINGS PROFILE (DROP SETTINGS PROFILE IF EXISTS ...) - CREATE NAMED COLLECTION (CREATE NAMED COLLECTION ... AS ...) - WITH column AS alias syntax (WITH number AS k SELECT k) - SHOW TABLES NOT LIKE (SHOW TABLES NOT LIKE '%') - SHOW CREATE QUOTA (SHOW CREATE QUOTA default) - LIMIT BY with second LIMIT (LIMIT 1 BY * LIMIT 1) - WITH TOTALS HAVING clause (SELECT count() WITH TOTALS HAVING x != 0) - COLLATE in column definitions (varchar(255) COLLATE binary NOT NULL) - SETTINGS with keyword assignments (SETTINGS limit=5) - TTL GROUP BY SET clause (TTL d + interval 1 second GROUP BY x SET y = max(y)) - DROP ROW POLICY ON wildcard (DROP ROW POLICY ... ON default.*) - INSERT FROM INFILE COMPRESSION (FROM INFILE '...' COMPRESSION 'gz') - FROM before SELECT syntax (FROM numbers(1) SELECT number) - Parenthesized SELECT at statement level ((SELECT 1)) - EXISTS table syntax (EXISTS db.table) - DROP TABLE FORMAT (DROP TABLE IF EXISTS t FORMAT Null) AST changes: - Added ExistsQuery type for EXISTS table_name statements Reduced parser errors from 53 to 28 (47% reduction)
- Added parse_error field to testMetadata struct
- When parse_error is true, tests skip gracefully if parsing fails
(these are tests for SQL that ClickHouse itself expects to fail)
- Marked 59 tests with clientError SYNTAX_ERROR as parse_error: true
- Reduces reported parser errors from 28 to 20
The parse_error flag is used for queries that have -- { clientError SYNTAX_ERROR }
comments, indicating they are intentionally invalid SQL per ClickHouse's own test suite.
Lexer improvements: - Add dollar-quoted string support ($$...$$) - Add hex P notation float support (0x123p4) - Fix backtick escaping (ta``ble -> ta`ble) - Skip BOM (byte order mark) characters - Allow $ in identifier names ($alias$name$) Parser improvements: - SYSTEM DROP FORMAT SCHEMA CACHE support - EXPLAIN AST options (optimize=0, etc.) - WITH scalar expression without alias (WITH 1 SELECT 1) - DROP USER with @ hostname (user@localhost) - KEY keyword as implicit alias in expressions - Complex UNION with parentheses in FROM clause Test results: 6066 passing, 758 skipped, 0 failing Down from 20 parser errors to 7 remaining.
…ovements - Add CARET (^) handling in qualified identifiers for JSON path notation - Support parenthesized ALTER mutations: (DELETE WHERE ...), (UPDATE ...) - Add DELETE WHERE and UPDATE mutations to ALTER TABLE parsing - Support MODIFY SETTING (singular) in addition to SETTINGS - Fix CONSTRAINT CHECK parsing in CREATE TABLE - Allow keywords as CTE aliases (VALUES, KEY, etc.) - Fix SETTINGS value parsing to stop before AS (for CTAS) - Add TTL WHERE clause support for conditional deletion - Fix TTL GROUP BY with multiple expressions and SET clause Parser errors reduced from 19 to 4.
Add support for ClickHouse's PARALLEL WITH syntax for dropping multiple tables in parallel: DROP TABLE IF EXISTS t1 PARALLEL WITH DROP TABLE IF EXISTS t2 Parser errors now reduced from 19 to 3 (84% reduction).
- Skip inline data after FORMAT clause (e.g., FORMAT JSONEachRow {...})
- Support parentheses-optional * EXCEPT syntax (e.g., * EXCEPT col)
- Support named window reference in parentheses: OVER (w0)
All 19 parser errors are now fixed (100% reduction).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Parser changes:
AST changes:
Reduced parser errors from 53 to 28 (47% reduction)