Skip to content

Conversation

@kyleconroy
Copy link
Collaborator

  • Add alias handling for CastExpr, CaseExpr, ExtractExpr in parseAlias
  • Add alias handling for same types in parseImplicitAlias
  • Fix JSON path notation formatting with backticks (x.^field)
  • Add QUALIFY clause output in select explain
  • Add WINDOW clause output in select explain
  • Add defaultValueOfTypeName for EPHEMERAL columns without defaults
  • Add IntervalExpr and TernaryExpr alias handling in explainAliasedExpr

Reduced skipped tests from 435 to 413 (22 fixes)

- Add alias handling for CastExpr, CaseExpr, ExtractExpr in parseAlias
- Add alias handling for same types in parseImplicitAlias
- Fix JSON path notation formatting with backticks (x.^`field`)
- Add QUALIFY clause output in select explain
- Add WINDOW clause output in select explain
- Add defaultValueOfTypeName for EPHEMERAL columns without defaults
- Add IntervalExpr and TernaryExpr alias handling in explainAliasedExpr

Reduced skipped tests from 435 to 413 (22 fixes)
When EXPLAIN is used as a table source (e.g., SELECT * FROM (EXPLAIN ...)),
it should be converted to a viewExplain function call in the AST output.
This matches ClickHouse's internal representation.

Note: EXPLAIN options (like header=1) are not yet fully captured by the parser.
Triple-escape single quotes inside string elements of array literals
when used with :: cast syntax. This matches ClickHouse's expected
output format of \\\' (three backslashes + quote).
CreateFunctionQuery should have 2 children: Identifier + Lambda body.
Previously only output the lambda body.

This fixes 12 test cases.
Arrays containing negative number literals (e.g., [-10000, 5750]) should
be formatted as Array_[Int64_-10000, UInt64_5750] instead of being
converted to Function array.

Added isSimpleLiteralOrNegation helper to detect unary negation of
numeric literals as "simple" for array formatting purposes.

This fixes 10 test cases.
- Remove CastExpr from parseAlias (explicit AS aliases)
- Only set alias on CastExpr in parseImplicitAlias when using :: operator syntax
- Function-style CAST() aliases go through AliasedExpr instead

ClickHouse's EXPLAIN AST doesn't show aliases on function-style CAST()
but does show them on :: operator syntax casts.
@kyleconroy kyleconroy merged commit 43cd5f7 into main Dec 16, 2025
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