@@ -1041,41 +1041,22 @@ def test_invalid_window_frame(units, start_bound, end_bound):
10411041
10421042
10431043def test_window_frame_defaults_match_postgres (partitioned_df ):
1044- # ref: https://github.com/apache/datafusion-python/issues/688
1045-
1046- window_frame = WindowFrame ("rows" , None , None )
1047-
10481044 col_a = column ("a" )
10491045
1050- # Using `f.window` with or without an unbounded window_frame produces the same
1051- # results. These tests are included as a regression check but can be removed when
1052- # f.window() is deprecated in favor of using the .over() approach.
1053- no_frame = f .window ("avg" , [col_a ]).alias ("no_frame" )
1054- with_frame = f .window ("avg" , [col_a ], window_frame = window_frame ).alias ("with_frame" )
1055- df_1 = partitioned_df .select (col_a , no_frame , with_frame )
1056-
1057- expected = {
1058- "a" : [0 , 1 , 2 , 3 , 4 , 5 , 6 ],
1059- "no_frame" : [3.0 , 3.0 , 3.0 , 3.0 , 3.0 , 3.0 , 3.0 ],
1060- "with_frame" : [3.0 , 3.0 , 3.0 , 3.0 , 3.0 , 3.0 , 3.0 ],
1061- }
1062-
1063- assert df_1 .sort (col_a ).to_pydict () == expected
1064-
10651046 # When order is not set, the default frame should be unbounded preceding to
10661047 # unbounded following. When order is set, the default frame is unbounded preceding
10671048 # to current row.
10681049 no_order = f .avg (col_a ).over (Window ()).alias ("over_no_order" )
10691050 with_order = f .avg (col_a ).over (Window (order_by = [col_a ])).alias ("over_with_order" )
1070- df_2 = partitioned_df .select (col_a , no_order , with_order )
1051+ df = partitioned_df .select (col_a , no_order , with_order )
10711052
10721053 expected = {
10731054 "a" : [0 , 1 , 2 , 3 , 4 , 5 , 6 ],
10741055 "over_no_order" : [3.0 , 3.0 , 3.0 , 3.0 , 3.0 , 3.0 , 3.0 ],
10751056 "over_with_order" : [0.0 , 0.5 , 1.0 , 1.5 , 2.0 , 2.5 , 3.0 ],
10761057 }
10771058
1078- assert df_2 .sort (col_a ).to_pydict () == expected
1059+ assert df .sort (col_a ).to_pydict () == expected
10791060
10801061
10811062def _build_last_value_df (df ):
0 commit comments