Skip to content

Commit eda6f46

Browse files
committed
Fix EXPLAIN PLAN type output in explain format
EXPLAIN PLAN is the default type and shouldn't be shown in the explain output. Now only non-default types (AST, SYNTAX, etc.) are shown. This fixes 20+ statements across multiple tests including: - 03652_explain_input_header - 03591_optimize_prewhere_row_policy - 03405_merge_filter_into_join - 03721_aggregate_projection_actions_dag
1 parent d348bf0 commit eda6f46

8 files changed

Lines changed: 9 additions & 46 deletions

File tree

internal/explain/statements.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -648,9 +648,9 @@ func explainSystemQuery(sb *strings.Builder, n *ast.SystemQuery, indent string)
648648
}
649649

650650
func explainExplainQuery(sb *strings.Builder, n *ast.ExplainQuery, indent string, depth int) {
651-
// Determine the type string - only show if explicitly specified
651+
// Determine the type string - only show if explicitly specified AND not PLAN (default)
652652
typeStr := ""
653-
if n.ExplicitType {
653+
if n.ExplicitType && n.ExplainType != ast.ExplainPlan {
654654
typeStr = " " + string(n.ExplainType)
655655
}
656656

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"explain_todo":{"stmt6":true,"stmt7":true}}
1+
{}
Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
1-
{
2-
"explain_todo": {
3-
"stmt18": true,
4-
"stmt19": true,
5-
"stmt20": true
6-
}
7-
}
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+
{}
Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1 @@
1-
{
2-
"explain_todo": {
3-
"stmt11": true,
4-
"stmt13": true,
5-
"stmt14": true,
6-
"stmt15": true,
7-
"stmt9": true
8-
}
9-
}
1+
{}
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1 @@
1-
{
2-
"explain_todo": {
3-
"stmt12": true,
4-
"stmt13": true,
5-
"stmt15": true,
6-
"stmt16": true
7-
}
8-
}
1+
{}
Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
{
22
"explain_todo": {
3-
"stmt10": true,
4-
"stmt11": true,
5-
"stmt12": true,
63
"stmt13": true,
7-
"stmt14": true,
8-
"stmt15": true,
9-
"stmt16": true,
10-
"stmt17": true,
11-
"stmt18": true,
12-
"stmt9": true
4+
"stmt18": true
135
}
146
}
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
{
2-
"explain_todo": {
3-
"stmt5": true
4-
}
5-
}
1+
{}

0 commit comments

Comments
 (0)