Skip to content

Conversation

@kyleconroy
Copy link
Collaborator

Group UNION DISTINCT selects when followed by UNION ALL to match ClickHouse's EXPLAIN AST output format. Only applies when DISTINCT transitions to ALL, not the reverse.

Fixes stmt9 and stmt15 in 02008_test_union_distinct_in_subquery.

claude added 11 commits January 4, 2026 21:15
Group UNION DISTINCT selects when followed by UNION ALL to match
ClickHouse's EXPLAIN AST output format. Only applies when DISTINCT
transitions to ALL, not the reverse.

Fixes stmt9 and stmt15 in 02008_test_union_distinct_in_subquery.
Add RESTORE to system command keywords so it's not parsed as a table
name. Also add RESTORE REPLICA to the list of commands that output
the table name twice in EXPLAIN AST.

Fixes stmt11 and stmt12 in 03168_attach_as_replicated_materialized_view.
Parse and explain ALTER TABLE ... APPLY DELETED MASK command,
including optional IN PARTITION clause.

Fixes stmt13 and stmt21 in 02932_apply_deleted_mask and additional
tests in 02932_lwd_and_mutations and 03404_json_tables.
Parse the FROM clause in ALTER TABLE ATTACH PARTITION statements
and show it as REPLACE_PARTITION in EXPLAIN AST output to match
ClickHouse's behavior.

Fixes multiple tests across several test files.
Add isSimpleLiteralOrNestedLiteral helper to properly detect when
a tuple in a WITH clause contains complex expressions (like subqueries)
vs just nested literals.

Tuples with subqueries render as Function tuple, while tuples of
nested literals stay as Literal Tuple.

Fixes tests in 01461_query_start_time_microseconds and
01651_bugs_from_15889.
Parse and explain WITH clause in ProjectionSelectQuery for CREATE TABLE
statements with projections.
Don't include "(children 0)" suffix for empty ExpressionList in tuple
literals within IN expressions. ClickHouse outputs just "ExpressionList"
without children count for empty tuples.
Handle FIELDS as an alias for COLUMNS in SHOW statements, and support
FULL modifier before COLUMNS/FIELDS. Both parse to ShowColumns type.
Parse the IF EXISTS modifier in RENAME TABLE statements. Added IfExists
field to RenameQuery struct and parsing logic.
Parse ASC/DESC modifiers after non-parenthesized ORDER BY expressions in
CREATE TABLE statements. When modifiers are present, output the column
wrapped in StorageOrderByElement in EXPLAIN AST output.
Add handling for UnaryExpr (unary negation) in explainWithElement to
properly output negative numeric literals with their aliases. Adds
formatNegativeLiteral helper function to format negative numbers in
the standard Int64_-N format.
@kyleconroy kyleconroy merged commit f47f283 into main Jan 5, 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.

3 participants