Skip to content

Commit 317d037

Browse files
kyleconroyclaude
andcommitted
Handle parenthesized literals in nested arrays for EXPLAIN output
When arrays contain parenthesized literals like [[((NULL))]], they should be rendered as nested Function array calls, not as Literal Array format. Update containsNonLiteralExpressions to detect parenthesized literals so nested arrays containing them use the correct Function array format. Fixes tests: - 01621_summap_check_types/stmt4 - 01635_sum_map_fuzz/stmt4 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 67ba7b0 commit 317d037

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

internal/explain/expressions.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,14 @@ func containsOnlyArraysOrTuples(exprs []ast.Expression) bool {
305305

306306
// containsNonLiteralExpressions checks if a slice of expressions contains
307307
// any non-literal expressions (identifiers, function calls, etc.)
308+
// or parenthesized literals (which need Function array format)
308309
func containsNonLiteralExpressions(exprs []ast.Expression) bool {
309310
for _, e := range exprs {
310-
if _, ok := e.(*ast.Literal); ok {
311+
if lit, ok := e.(*ast.Literal); ok {
312+
// Parenthesized literals need Function array format
313+
if lit.Parenthesized {
314+
return true
315+
}
311316
continue
312317
}
313318
// Unary minus of a literal (negative number) is also acceptable
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
{
2-
"explain_todo": {
3-
"stmt4": true
4-
}
5-
}
1+
{}
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
{
2-
"explain_todo": {
3-
"stmt4": true
4-
}
5-
}
1+
{}

0 commit comments

Comments
 (0)