You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: datafusion/sqllogictest/test_files/explain_tree.slt
+218Lines changed: 218 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -577,6 +577,142 @@ physical_plan
577
577
17)│ format: arrow │
578
578
18)└───────────────────────────┘
579
579
580
+
581
+
# Query with window agg.
582
+
query TT
583
+
explain select count(*) over() from table1;
584
+
----
585
+
logical_plan
586
+
01)Projection: count(Int64(1)) ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING AS count(*) ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING
587
+
02)--WindowAggr: windowExpr=[[count(Int64(1)) ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING]]
588
+
03)----TableScan: table1 projection=[]
589
+
physical_plan
590
+
01)┌───────────────────────────┐
591
+
02)│ ProjectionExec │
592
+
03)│ -------------------- │
593
+
04)│ count(*) ROWS BETWEEN │
594
+
05)│ UNBOUNDED PRECEDING │
595
+
06)│ AND UNBOUNDED FOLLOWING: │
596
+
07)│ count(Int64(1)) ROWS │
597
+
08)│ BETWEEN UNBOUNDED │
598
+
09)│ PRECEDING AND UNBOUNDED │
599
+
10)│ FOLLOWING@0 │
600
+
11)└─────────────┬─────────────┘
601
+
12)┌─────────────┴─────────────┐
602
+
13)│ WindowAggExec │
603
+
14)│ -------------------- │
604
+
15)│ select_list: │
605
+
16)│ count(Int64(1)) ROWS │
606
+
17)│ BETWEEN UNBOUNDED │
607
+
18)│ PRECEDING AND UNBOUNDED │
608
+
19)│ FOLLOWING │
609
+
20)└─────────────┬─────────────┘
610
+
21)┌─────────────┴─────────────┐
611
+
22)│ DataSourceExec │
612
+
23)│ -------------------- │
613
+
24)│ files: 1 │
614
+
25)│ format: csv │
615
+
26)└───────────────────────────┘
616
+
617
+
# Query with bounded window agg.
618
+
query TT
619
+
explain SELECT
620
+
v1,
621
+
SUM(v1) OVER (ORDER BY v1 ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) AS rolling_sum
622
+
FROM generate_series(1, 1000) AS t1(v1);
623
+
----
624
+
logical_plan
625
+
01)Projection: t1.v1, sum(t1.v1) ORDER BY [t1.v1 ASC NULLS LAST] ROWS BETWEEN 1 PRECEDING AND CURRENT ROW AS rolling_sum
626
+
02)--WindowAggr: windowExpr=[[sum(t1.v1) ORDER BY [t1.v1 ASC NULLS LAST] ROWS BETWEEN 1 PRECEDING AND CURRENT ROW]]
01)Projection: count(Int64(1)) ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING AS count(*) ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING, row_number() ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING
676
+
02)--WindowAggr: windowExpr=[[count(Int64(1)) ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING, row_number() ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING]]
677
+
03)----TableScan: table1 projection=[]
678
+
physical_plan
679
+
01)┌───────────────────────────┐
680
+
02)│ ProjectionExec │
681
+
03)│ -------------------- │
682
+
04)│ count(*) ROWS BETWEEN │
683
+
05)│ UNBOUNDED PRECEDING │
684
+
06)│ AND UNBOUNDED FOLLOWING: │
685
+
07)│ count(Int64(1)) ROWS │
686
+
08)│ BETWEEN UNBOUNDED │
687
+
09)│ PRECEDING AND UNBOUNDED │
688
+
10)│ FOLLOWING@0 │
689
+
11)│ │
690
+
12)│ row_number() ROWS BETWEEN │
691
+
13)│ UNBOUNDED PRECEDING AND │
692
+
14)│ UNBOUNDED FOLLOWING: │
693
+
15)│ row_number() ROWS BETWEEN │
694
+
16)│ UNBOUNDED PRECEDING AND │
695
+
17)│ UNBOUNDED FOLLOWING@1 │
696
+
18)└─────────────┬─────────────┘
697
+
19)┌─────────────┴─────────────┐
698
+
20)│ WindowAggExec │
699
+
21)│ -------------------- │
700
+
22)│ select_list: │
701
+
23)│ count(Int64(1)) ROWS │
702
+
24)│ BETWEEN UNBOUNDED │
703
+
25)│ PRECEDING AND UNBOUNDED │
704
+
26)│ FOLLOWING, row_number() │
705
+
27)│ ROWS BETWEEN UNBOUNDED │
706
+
28)│ PRECEDING AND UNBOUNDED │
707
+
29)│ FOLLOWING │
708
+
30)└─────────────┬─────────────┘
709
+
31)┌─────────────┴─────────────┐
710
+
32)│ DataSourceExec │
711
+
33)│ -------------------- │
712
+
34)│ files: 1 │
713
+
35)│ format: csv │
714
+
36)└───────────────────────────┘
715
+
580
716
# Query for sort.
581
717
query TT
582
718
explain SELECT * FROM table1 ORDER BY string_col;
@@ -653,6 +789,88 @@ physical_plan
653
789
20)│ format: csv │
654
790
21)└───────────────────────────┘
655
791
792
+
query TT
793
+
explain select
794
+
rank() over(ORDER BY int_col DESC),
795
+
row_number() over (ORDER BY int_col ASC)
796
+
from table1
797
+
----
798
+
logical_plan
799
+
01)Projection: rank() ORDER BY [table1.int_col DESC NULLS FIRST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW, row_number() ORDER BY [table1.int_col ASC NULLS LAST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
800
+
02)--WindowAggr: windowExpr=[[row_number() ORDER BY [table1.int_col ASC NULLS LAST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW]]
801
+
03)----WindowAggr: windowExpr=[[rank() ORDER BY [table1.int_col DESC NULLS FIRST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW]]
0 commit comments