Repository navigation
Parse new ClickHouse 26.x syntax (batch 1) - #127
Merged
kyleconroy merged 12 commits intoDec 1, 2026
Merged
kyleconroy merged 12 commits into
kyleconroy merged 12 commits into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LuRZ4KB7DMX365Nmn5ksnY
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LuRZ4KB7DMX365Nmn5ksnY
ClickHouse 26 no longer repeats the select list and table of the rewritten subquery. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LuRZ4KB7DMX365Nmn5ksnY
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LuRZ4KB7DMX365Nmn5ksnY
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LuRZ4KB7DMX365Nmn5ksnY
Accept every interval kind alias and the PostgreSQL-compatible units
(EPOCH, DOW, DOY, ISODOW, ISOYEAR, CENTURY, DECADE, MILLENNIUM,
TIMEZONE_HOUR, TIMEZONE_MINUTE) in EXTRACT(unit FROM expr), and explain
date_part('unit', expr) the same way. EXTRACT(WEEK ...) is toISOWeek.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LuRZ4KB7DMX365Nmn5ksnY
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LuRZ4KB7DMX365Nmn5ksnY
Supports WITH t (a, b) AS (SELECT ...) and FROM (...) t(a, b). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LuRZ4KB7DMX365Nmn5ksnY
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LuRZ4KB7DMX365Nmn5ksnY
- LIKE/ILIKE take an optional ESCAPE 'c' third argument. - COMMENT is printed before the SELECT for views and CREATE ... AS SELECT, matching ClickHouse 26.8, and may follow the SELECT of a view. - comment can be used as an implicit column alias. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LuRZ4KB7DMX365Nmn5ksnY
CODEC, STATISTICS, TTL, COLLATE, PRIMARY KEY, COMMENT and SETTINGS may appear in any order after a column's default. EXPLAIN prints them as type, default, comment, codec, settings, statistics, TTL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LuRZ4KB7DMX365Nmn5ksnY
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.
Requested by Kyle · project thread
Summary
First batch of parser and explain fixes for syntax that ClickHouse added between 25.8 and 26.8. It takes
explain_todofrom 3,649 to 2,900 statements. One commit per feature:WITH name AS MATERIALIZED (...)CTEsCREATE TABLE ... EMPTY AS SELECTSOME (subquery), and the 26.8 explain output forANY/ALLsubqueriesjson.@pathALTER TABLE ... REWRITE PARTS,APPLY PATCHES/APPLY DELETED MASK IN PARTITIONEXTRACTunits anddate_part('unit', expr)IN PARTITION IDfor every ALTER command (shared helper in parser and explain)WITH t (a, b) AS (...)andFROM (...) t(a, b)SYSTEM RELOAD DICTIONARY 'quoted name'LIKE ... ESCAPE 'c', viewCOMMENTafter the SELECT, and COMMENT printed before the SELECT as 26.8 doesCODEC,STATISTICS,TTL,COMMENT,SETTINGS, ...) in any order, printed in ClickHouse's child orderNo golden
explain*.txtfile was edited.Test Plan
EXPLAIN ASTfrom a local ClickHouse 26.8.51.4 server.go test ./parser/... -check-explainremoved the newly passing statements fromexplain_todo.go test ./...passes.Generated by Claude Code