Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions internal/explain/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,10 @@ func explainFunctionCallWithAlias(sb *strings.Builder, n *ast.FunctionCall, alia
}
}

// windowSpecHasContent returns true if the window spec has any content
// (PartitionBy, OrderBy, or Frame with offset). Empty OVER () returns false.
// windowSpecHasContent returns true if the window spec has any content.
// ClickHouse EXPLAIN AST never includes WindowDefinition nodes for window
// functions, even when OVER clause has PARTITION BY, ORDER BY, or frame specs.
func windowSpecHasContent(w *ast.WindowSpec) bool {
if w == nil {
return false
}
if len(w.PartitionBy) > 0 {
return true
}
if len(w.OrderBy) > 0 {
return true
}
if w.Frame != nil && w.Frame.StartBound != nil && w.Frame.StartBound.Offset != nil {
return true
}
return false
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
{
"explain_todo": {
"stmt1": true,
"stmt14": true,
"stmt2": true
}
}
{}
5 changes: 1 addition & 4 deletions parser/testdata/01571_window_functions/metadata.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{
"explain_todo": {
"stmt10": true,
"stmt12": true,
"stmt3": true,
"stmt7": true,
"stmt9": true
"stmt3": true
}
}
31 changes: 1 addition & 30 deletions parser/testdata/01591_window_functions/metadata.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"explain_todo": {
"stmt10": true,
"stmt100": true,
"stmt101": true,
"stmt102": true,
"stmt103": true,
"stmt104": true,
Expand All @@ -11,35 +8,20 @@
"stmt107": true,
"stmt108": true,
"stmt109": true,
"stmt11": true,
"stmt110": true,
"stmt111": true,
"stmt112": true,
"stmt12": true,
"stmt14": true,
"stmt16": true,
"stmt17": true,
"stmt21": true,
"stmt22": true,
"stmt23": true,
"stmt28": true,
"stmt29": true,
"stmt31": true,
"stmt32": true,
"stmt34": true,
"stmt35": true,
"stmt36": true,
"stmt37": true,
"stmt38": true,
"stmt39": true,
"stmt40": true,
"stmt41": true,
"stmt42": true,
"stmt43": true,
"stmt44": true,
"stmt45": true,
"stmt46": true,
"stmt48": true,
"stmt50": true,
"stmt51": true,
"stmt52": true,
Expand All @@ -48,16 +30,7 @@
"stmt55": true,
"stmt56": true,
"stmt57": true,
"stmt58": true,
"stmt59": true,
"stmt6": true,
"stmt60": true,
"stmt61": true,
"stmt64": true,
"stmt65": true,
"stmt68": true,
"stmt69": true,
"stmt7": true,
"stmt70": true,
"stmt71": true,
"stmt72": true,
Expand All @@ -78,7 +51,6 @@
"stmt87": true,
"stmt88": true,
"stmt89": true,
"stmt9": true,
"stmt90": true,
"stmt91": true,
"stmt92": true,
Expand All @@ -87,7 +59,6 @@
"stmt95": true,
"stmt96": true,
"stmt97": true,
"stmt98": true,
"stmt99": true
"stmt98": true
}
}
6 changes: 1 addition & 5 deletions parser/testdata/01592_long_window_functions1/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
{
"explain_todo": {
"stmt10": true
}
}
{}
12 changes: 1 addition & 11 deletions parser/testdata/01592_window_functions/metadata.json
Original file line number Diff line number Diff line change
@@ -1,11 +1 @@
{
"explain_todo": {
"stmt10": true,
"stmt12": true,
"stmt14": true,
"stmt16": true,
"stmt18": true,
"stmt20": true,
"stmt8": true
}
}
{}
16 changes: 1 addition & 15 deletions parser/testdata/01655_window_functions_cume_dist/metadata.json
Original file line number Diff line number Diff line change
@@ -1,15 +1 @@
{
"explain_todo": {
"stmt12": true,
"stmt16": true,
"stmt20": true,
"stmt21": true,
"stmt22": true,
"stmt24": true,
"stmt26": true,
"stmt28": true,
"stmt3": true,
"stmt5": true,
"stmt7": true
}
}
{}
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
{
"explain_todo": {
"stmt4": true
}
}
{}
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
{
"explain_todo": {
"stmt1": true
}
}
{}
4 changes: 1 addition & 3 deletions parser/testdata/02126_lc_window_functions/metadata.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"explain_todo": {
"stmt2": true,
"stmt3": true,
"stmt4": true,
"stmt5": true
"stmt4": true
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
{
"explain_todo": {
"stmt4": true,
"stmt6": true
}
}
{}
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
{
"explain_todo": {
"stmt1": true
}
}
{}
22 changes: 1 addition & 21 deletions parser/testdata/02346_non_negative_derivative/metadata.json
Original file line number Diff line number Diff line change
@@ -1,21 +1 @@
{
"explain_todo": {
"stmt10": true,
"stmt11": true,
"stmt12": true,
"stmt13": true,
"stmt14": true,
"stmt15": true,
"stmt16": true,
"stmt17": true,
"stmt18": true,
"stmt19": true,
"stmt20": true,
"stmt21": true,
"stmt22": true,
"stmt6": true,
"stmt7": true,
"stmt8": true,
"stmt9": true
}
}
{}
7 changes: 1 addition & 6 deletions parser/testdata/02366_window_function_order_by/metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
{
"explain_todo": {
"stmt2": true,
"stmt3": true
}
}
{}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"explain_todo":{"stmt5":true,"stmt6":true,"stmt7":true,"stmt8":true,"stmt9":true}}
{}
2 changes: 1 addition & 1 deletion parser/testdata/02513_analyzer_sort_msan/metadata.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"explain_todo":{"stmt5":true}}
{}
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
{
"explain_todo": {
"stmt2": true
}
}
{}
24 changes: 1 addition & 23 deletions parser/testdata/02560_window_ntile/metadata.json
Original file line number Diff line number Diff line change
@@ -1,23 +1 @@
{
"explain_todo": {
"stmt1": true,
"stmt10": true,
"stmt11": true,
"stmt12": true,
"stmt13": true,
"stmt14": true,
"stmt15": true,
"stmt16": true,
"stmt17": true,
"stmt18": true,
"stmt19": true,
"stmt2": true,
"stmt3": true,
"stmt4": true,
"stmt5": true,
"stmt6": true,
"stmt7": true,
"stmt8": true,
"stmt9": true
}
}
{}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"explain_todo": {
"stmt3": true,
"stmt5": true,
"stmt7": true
}
}
9 changes: 1 addition & 8 deletions parser/testdata/02833_window_func_range_offset/metadata.json
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
{
"explain_todo": {
"stmt1": true,
"stmt2": true,
"stmt3": true,
"stmt4": true
}
}
{}
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"explain_todo": {
"stmt2": true,
"stmt3": true,
"stmt4": true,
"stmt6": true
"stmt2": true
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"explain_todo": {
"stmt1": true,
"stmt2": true,
"stmt5": true
"stmt2": true
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{
"explain_todo": {
"stmt3": true,
"stmt4": true,
"stmt5": true,
"stmt7": true,
"stmt8": true
"stmt7": true
}
}
20 changes: 1 addition & 19 deletions parser/testdata/02922_respect_nulls_extensive/metadata.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,13 @@
{
"explain_todo": {
"stmt1": true,
"stmt10": true,
"stmt11": true,
"stmt12": true,
"stmt13": true,
"stmt14": true,
"stmt15": true,
"stmt2": true,
"stmt3": true,
"stmt32": true,
"stmt33": true,
"stmt34": true,
"stmt35": true,
"stmt36": true,
"stmt38": true,
"stmt4": true,
"stmt40": true,
"stmt41": true,
"stmt42": true,
"stmt44": true,
"stmt46": true,
"stmt47": true,
"stmt5": true,
"stmt6": true,
"stmt7": true,
"stmt8": true,
"stmt9": true
"stmt6": true
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
{
"explain_todo": {
"stmt5": true,
"stmt6": true
}
}
{}
7 changes: 1 addition & 6 deletions parser/testdata/03037_precent_rank/metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
{
"explain_todo": {
"stmt12": true,
"stmt9": true
}
}
{}
9 changes: 1 addition & 8 deletions parser/testdata/03095_window_functions_qualify/metadata.json
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
{
"explain_todo": {
"stmt12": true,
"stmt14": true,
"stmt2": true,
"stmt4": true
}
}
{}
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
{
"explain_todo": {
"stmt5": true
}
}
{}
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
{
"explain_todo": {
"stmt6": true
}
}
{}
7 changes: 1 addition & 6 deletions parser/testdata/03146_tpc_ds_grouping/metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
{
"explain_todo": {
"stmt3": true,
"stmt4": true
}
}
{}
Loading