Skip to content

Parse new ClickHouse 26.x syntax (batch 3): pipe operators - #130

Merged
kyleconroy merged 2 commits into
claude/project-thread-8e2oya-syntax-2from
claude/project-thread-8e2oya-syntax-3
Dec 1, 2026
Merged

kyleconroy merged 2 commits into
claude/project-thread-8e2oya-syntax-2from
claude/project-thread-8e2oya-syntax-3

Conversation

@kyleconroy

Copy link
Copy Markdown
Collaborator

Requested by Kyle · project thread

Summary

Third batch of ClickHouse 26.x syntax, stacked on #129. It takes explain_todo from 2,743 to 2,628 statements.

  • Compound interval literals: INTERVAL '1-2' YEAR TO MONTH, INTERVAL '5 12:30:45' DAY TO SECOND. They become a tuple of toInterval*() calls, with negate() for a leading -.
  • Pipe operators: FROM t |> WHERE x |> AGGREGATE count() GROUP BY y |> ORDER BY y. Each operator wraps the query so far into SELECT ... FROM (query), the same way ClickHouse's ParserPipeOperators does. Supported operators: WHERE, SELECT, EXTEND, SET, DROP, AS, AGGREGATE, DISTINCT, ORDER BY, LIMIT, OFFSET, UNION and joins. |> INTERSECT/|> EXCEPT are not supported yet.
  • FROM-first queries no longer need a SELECT clause (FROM t WHERE x). They are accepted wherever a query can start: subqueries, view(), CTEs, INSERT INTO t FROM ... and CREATE ... AS. (from IN (1)) still parses as a column named from.
  • ORDER BY ALL prints as Identifier all, matching ClickHouse.

No golden explain*.txt file was edited.

Test Plan

  • Each change was compared against EXPLAIN AST from a local ClickHouse 26.8.51.4 server. 63 of the 67 pipe statements in the suite now match.
  • go test ./parser/... -check-explain removed the newly passing statements from explain_todo.
  • go test ./... passes.

Generated by Claude Code

Each operator wraps the query so far into SELECT ... FROM (query), as
ClickHouse does: WHERE, SELECT, EXTEND, SET, DROP, AS, AGGREGATE,
DISTINCT, ORDER BY, LIMIT, OFFSET, UNION and JOINs. FROM-first queries no
longer need a SELECT clause and are accepted wherever a query can start
(subqueries, view(), CTEs, INSERT, CREATE ... AS). ORDER BY ALL is printed
as the identifier all.

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 05:18
@kyleconroy
kyleconroy merged commit 9a07517 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