Skip to content

Final 26.8 syntax batch: explain_todo reaches zero - #138

Merged
kyleconroy merged 18 commits into
claude/project-thread-8e2oya-syntax-10from
claude/project-thread-8e2oya-syntax-11
Dec 1, 2026
Merged

kyleconroy merged 18 commits into
claude/project-thread-8e2oya-syntax-10from
claude/project-thread-8e2oya-syntax-11

Conversation

@kyleconroy

Copy link
Copy Markdown
Collaborator

Requested by Kyle · project thread

Summary

The last batch of ClickHouse 26.8 syntax and output fixes. It takes explain_todo from 94 to 0: every enabled explain test statement now matches the golden output.

Parser:

  • FROM-first queries (FROM t SELECT ... OFFSET n) now reuse the regular SELECT parser.
  • Pipe operators: added |> INTERSECT and |> EXCEPT. select is accepted as a join alias.
  • Added EXPLAIN WHATIF.
  • cluster and alias work as implicit aliases. ORDER BY x ASCENDING/DESCENDING parses.
  • WITH CUBE/ROLLUP parses without GROUP BY. LIMIT n OFFSET m WITH TIES parses.
  • * APPLY ((x) -> ...) parses.
  • view((SELECT ...) INTERSECT ...) parses.
  • A backquoted skip is a typed path in JSON(...).
  • INTERSECT chains nest left-associatively, as ClickHouse does.
  • SETTINGS after a parenthesized CREATE ... AS (SELECT) become query-level settings.
  • CASE ... END AS T inside CAST no longer takes T as an alias.

Explain output:

  • DISTINCT ON prints in the LIMIT BY position.
  • :: operands that aren't plain text (nan, NULL inside nested arrays) print as expressions.
  • One-element tuples nested in tuple literals print as functions.
  • Constraints print before projections.
  • FORMAT is found inside INTERSECT/EXCEPT. Nested unions inherit their own WITH.
  • Scalar (EXPLAIN ...) subqueries print as viewExplain.
  • SHOW CREATE VIEW FORMAT. DESCRIBE on a table function prints at the right depth.
  • PARALLEL WITH ids come from the first statement's id.
  • SYSTEM RESTORE REPLICA and LOAD/UNLOAD PRIMARY KEY repeat qualified names.
  • Invalid UTF-8 bytes in identifiers print raw, and NUL is escaped once.
  • Encryption secrets inside scalar subqueries are masked.
  • INTERPOLATE prints after LIMIT/SETTINGS.
  • Fixed hex/bin literal padding, Geometry/Interval type names and out-of-range enums.

Engine settings:

  • S3, GCS, OSS, COSN, Azure, HDFS and queue engines now drop query-level settings from their SETTINGS clause.
  • Format settings are kept, and S3Queue/AzureQueue keep use_hive_partitioning. The format-setting list (internal/explain/format_setting_names.go) was generated by probing a 26.8 server.

Removed the hack that appended a trailing SELECT literal's value to INSERT output. ClickHouse 26.8 no longer prints it.

Test harness: a statement with a -- { error CODE } hint and no explain file is now skipped, the same way clientError statements are.

Test Plan

  • go test ./... -timeout 120s passes.
  • go test ./parser/... -check-explain leaves zero explain_todo entries, and go run ./cmd/next-test reports none.
  • Each fix was compared against a local ClickHouse 26.8 server's EXPLAIN AST output.

Generated by Claude Code

claude added 18 commits December 1, 2026 07:34
…literal-word type names

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LuRZ4KB7DMX365Nmn5ksnY
…ut-of-range enums, quoted column names

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LuRZ4KB7DMX365Nmn5ksnY
…column named from, aliased literals share explainLiteral

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LuRZ4KB7DMX365Nmn5ksnY
…uple literals print as functions

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LuRZ4KB7DMX365Nmn5ksnY
…int as expressions

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LuRZ4KB7DMX365Nmn5ksnY
…CT/EXCEPT, nested unions inherit their own WITH

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LuRZ4KB7DMX365Nmn5ksnY
…lect as a join alias

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LuRZ4KB7DMX365Nmn5ksnY
…N types, WITH CUBE without GROUP BY, ASCENDING/DESCENDING

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LuRZ4KB7DMX365Nmn5ksnY
… parenthesized set query

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LuRZ4KB7DMX365Nmn5ksnY
…CREATE VIEW FORMAT, DESCRIBE table function depth, PARALLEL WITH ids

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LuRZ4KB7DMX365Nmn5ksnY
…ing-SELECT result hack

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LuRZ4KB7DMX365Nmn5ksnY
…mat settings

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
@kyleconroy kyleconroy self-assigned this Dec 1, 2026
@kyleconroy
kyleconroy added this pull request to stack #128 December 1, 2026 08:10
@kyleconroy
kyleconroy merged commit 3533060 into main Dec 1, 2026
1 check passed
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