Skip to content

Commit 0d6bbbe

Browse files
authored
Remove WindowDefinition from EXPLAIN AST output (#83)
1 parent 72342c7 commit 0d6bbbe

File tree

44 files changed

+48
-302
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+48
-302
lines changed

internal/explain/functions.go

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -77,21 +77,10 @@ func explainFunctionCallWithAlias(sb *strings.Builder, n *ast.FunctionCall, alia
7777
}
7878
}
7979

80-
// windowSpecHasContent returns true if the window spec has any content
81-
// (PartitionBy, OrderBy, or Frame with offset). Empty OVER () returns false.
80+
// windowSpecHasContent returns true if the window spec has any content.
81+
// ClickHouse EXPLAIN AST never includes WindowDefinition nodes for window
82+
// functions, even when OVER clause has PARTITION BY, ORDER BY, or frame specs.
8283
func windowSpecHasContent(w *ast.WindowSpec) bool {
83-
if w == nil {
84-
return false
85-
}
86-
if len(w.PartitionBy) > 0 {
87-
return true
88-
}
89-
if len(w.OrderBy) > 0 {
90-
return true
91-
}
92-
if w.Frame != nil && w.Frame.StartBound != nil && w.Frame.StartBound.Offset != nil {
93-
return true
94-
}
9584
return false
9685
}
9786

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
1-
{
2-
"explain_todo": {
3-
"stmt1": true,
4-
"stmt14": true,
5-
"stmt2": true
6-
}
7-
}
1+
{}
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
{
22
"explain_todo": {
3-
"stmt10": true,
43
"stmt12": true,
5-
"stmt3": true,
6-
"stmt7": true,
7-
"stmt9": true
4+
"stmt3": true
85
}
96
}
Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
{
22
"explain_todo": {
3-
"stmt10": true,
4-
"stmt100": true,
5-
"stmt101": true,
63
"stmt102": true,
74
"stmt103": true,
85
"stmt104": true,
@@ -11,35 +8,20 @@
118
"stmt107": true,
129
"stmt108": true,
1310
"stmt109": true,
14-
"stmt11": true,
1511
"stmt110": true,
1612
"stmt111": true,
1713
"stmt112": true,
18-
"stmt12": true,
19-
"stmt14": true,
20-
"stmt16": true,
21-
"stmt17": true,
22-
"stmt21": true,
23-
"stmt22": true,
24-
"stmt23": true,
2514
"stmt28": true,
26-
"stmt29": true,
2715
"stmt31": true,
28-
"stmt32": true,
2916
"stmt34": true,
3017
"stmt35": true,
3118
"stmt36": true,
3219
"stmt37": true,
3320
"stmt38": true,
3421
"stmt39": true,
35-
"stmt40": true,
3622
"stmt41": true,
37-
"stmt42": true,
38-
"stmt43": true,
39-
"stmt44": true,
4023
"stmt45": true,
4124
"stmt46": true,
42-
"stmt48": true,
4325
"stmt50": true,
4426
"stmt51": true,
4527
"stmt52": true,
@@ -48,16 +30,7 @@
4830
"stmt55": true,
4931
"stmt56": true,
5032
"stmt57": true,
51-
"stmt58": true,
52-
"stmt59": true,
53-
"stmt6": true,
54-
"stmt60": true,
55-
"stmt61": true,
56-
"stmt64": true,
57-
"stmt65": true,
58-
"stmt68": true,
5933
"stmt69": true,
60-
"stmt7": true,
6134
"stmt70": true,
6235
"stmt71": true,
6336
"stmt72": true,
@@ -78,7 +51,6 @@
7851
"stmt87": true,
7952
"stmt88": true,
8053
"stmt89": true,
81-
"stmt9": true,
8254
"stmt90": true,
8355
"stmt91": true,
8456
"stmt92": true,
@@ -87,7 +59,6 @@
8759
"stmt95": true,
8860
"stmt96": true,
8961
"stmt97": true,
90-
"stmt98": true,
91-
"stmt99": true
62+
"stmt98": true
9263
}
9364
}
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
{
2-
"explain_todo": {
3-
"stmt10": true
4-
}
5-
}
1+
{}
Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1 @@
1-
{
2-
"explain_todo": {
3-
"stmt10": true,
4-
"stmt12": true,
5-
"stmt14": true,
6-
"stmt16": true,
7-
"stmt18": true,
8-
"stmt20": true,
9-
"stmt8": true
10-
}
11-
}
1+
{}
Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1 @@
1-
{
2-
"explain_todo": {
3-
"stmt12": true,
4-
"stmt16": true,
5-
"stmt20": true,
6-
"stmt21": true,
7-
"stmt22": true,
8-
"stmt24": true,
9-
"stmt26": true,
10-
"stmt28": true,
11-
"stmt3": true,
12-
"stmt5": true,
13-
"stmt7": true
14-
}
15-
}
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 & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
{
2-
"explain_todo": {
3-
"stmt1": true
4-
}
5-
}
1+
{}
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
{
22
"explain_todo": {
3-
"stmt2": true,
43
"stmt3": true,
5-
"stmt4": true,
6-
"stmt5": true
4+
"stmt4": true
75
}
86
}

0 commit comments

Comments
 (0)