Skip to content

Commit 5c8df3c

Browse files
committed
Fix tuple rendering when containing array literals
When a tuple contains array literals, render as Function tuple format instead of Literal Tuple_ format. This matches ClickHouse's EXPLAIN AST output which shows tuples with arrays as: Function tuple (alias a) (children 1) ExpressionList (children 2) Literal UInt64_456 Literal Array_[...] Fixes 3 statements in 00300_csv.
1 parent b6a94a9 commit 5c8df3c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

internal/explain/expressions.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,8 +478,13 @@ func explainAliasedExpr(sb *strings.Builder, n *ast.AliasedExpr, depth int) {
478478
needsFunctionFormat = true
479479
break
480480
}
481-
// Also check if nested arrays/tuples contain non-literal elements
481+
// Check if tuple contains array literals - these need Function tuple format
482482
if lit, ok := expr.(*ast.Literal); ok {
483+
if lit.Type == ast.LiteralArray {
484+
needsFunctionFormat = true
485+
break
486+
}
487+
// Also check if nested arrays/tuples contain non-literal elements
483488
if containsNonLiteralInNested(lit) {
484489
needsFunctionFormat = true
485490
break
Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,2 @@
11
{
2-
"explain_todo": {
3-
"stmt1": true,
4-
"stmt2": true,
5-
"stmt3": true
6-
}
72
}

0 commit comments

Comments
 (0)