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/range_partitioning.slt
+37-7Lines changed: 37 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -779,7 +779,37 @@ SELECT non_range_key, value, SUM(value) OVER (PARTITION BY non_range_key ORDER B
779
779
780
780
781
781
##########
782
-
# TEST 22: Window Subset Satisfaction on Range Partition Column
782
+
# TEST 22: Unbounded-Frame Window on Non-Range Column Rehashes
783
+
# The unbounded frame makes DataFusion use WindowAggExec; Range([range_key])
784
+
# does not colocate non_range_key values, so PARTITION BY non_range_key
785
+
# still requires a hash repartition.
786
+
##########
787
+
788
+
query TT
789
+
EXPLAIN SELECT non_range_key, SUM(value) OVER (PARTITION BY non_range_key ORDER BY value ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM range_partitioned;
790
+
----
791
+
physical_plan
792
+
01)ProjectionExec: expr=[non_range_key@0 as non_range_key, sum(range_partitioned.value) PARTITION BY [range_partitioned.non_range_key] ORDER BY [range_partitioned.value ASC NULLS LAST] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING@2 as sum(range_partitioned.value) PARTITION BY [range_partitioned.non_range_key] ORDER BY [range_partitioned.value ASC NULLS LAST] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING]
793
+
02)--WindowAggExec: wdw=[sum(range_partitioned.value) PARTITION BY [range_partitioned.non_range_key] ORDER BY [range_partitioned.value ASC NULLS LAST] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING: Ok(Field { name: "sum(range_partitioned.value) PARTITION BY [range_partitioned.non_range_key] ORDER BY [range_partitioned.value ASC NULLS LAST] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING", data_type: Int64, nullable: true }), frame: WindowFrame { units: Rows, start_bound: Preceding(UInt64(NULL)), end_bound: Following(UInt64(NULL)), is_causal: false }]
794
+
03)----SortExec: expr=[non_range_key@0 ASC NULLS LAST, value@1 ASC NULLS LAST], preserve_partitioning=[true]
SELECT non_range_key, value, SUM(value) OVER (PARTITION BY non_range_key ORDER BY value ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM range_partitioned ORDER BY non_range_key, value;
800
+
----
801
+
1 10 610
802
+
1 100 610
803
+
1 200 610
804
+
1 300 610
805
+
2 50 800
806
+
2 150 800
807
+
2 250 800
808
+
2 350 800
809
+
810
+
811
+
##########
812
+
# TEST 23: Window Subset Satisfaction on Range Partition Column
783
813
# With the subset threshold met, Range([range_key]) satisfies
784
814
# PARTITION BY (range_key, non_range_key): equal composite keys share the
785
815
# same range_key, so they are already colocated.
@@ -811,7 +841,7 @@ SELECT range_key, SUM(value) OVER (PARTITION BY range_key, non_range_key ORDER B
811
841
812
842
813
843
##########
814
-
# TEST 23: Exact Range Window Below Subset Threshold
844
+
# TEST 24: Exact Range Window Below Subset Threshold
815
845
# Even when subset satisfaction is disabled, exact Range([range_key])
816
846
# satisfies PARTITION BY range_key when repartitioning would not increase
817
847
# partition count.
@@ -837,7 +867,7 @@ physical_plan
837
867
838
868
839
869
##########
840
-
# TEST 24: Window Subset Rehashes Below Subset Threshold
870
+
# TEST 25: Window Subset Rehashes Below Subset Threshold
841
871
# Range([range_key]) is only a subset of PARTITION BY
842
872
# (range_key, non_range_key), so it should not satisfy the window key when
0 commit comments