@@ -855,6 +855,27 @@ def test_window_functions(partitioned_df, name, expr, result):
855855 assert table .sort_by ("a" ).to_pydict () == expected
856856
857857
858+ @pytest .mark .parametrize ("partition" , ["c" , df_col ("c" )])
859+ def test_rank_partition_by_accepts_string (partitioned_df , partition ):
860+ """Passing a string to partition_by should match using col()."""
861+ df = partitioned_df .select (
862+ f .rank (order_by = column ("a" ), partition_by = partition ).alias ("r" )
863+ )
864+ table = pa .Table .from_batches (df .sort (column ("a" )).collect ())
865+ assert table .column ("r" ).to_pylist () == [1 , 2 , 3 , 4 , 1 , 2 , 3 ]
866+
867+
868+ @pytest .mark .parametrize ("partition" , ["c" , df_col ("c" )])
869+ def test_window_partition_by_accepts_string (partitioned_df , partition ):
870+ """Window.partition_by accepts string identifiers."""
871+ expr = f .first_value (column ("a" )).over (
872+ Window (partition_by = partition , order_by = column ("b" ))
873+ )
874+ df = partitioned_df .select (expr .alias ("fv" ))
875+ table = pa .Table .from_batches (df .sort (column ("a" )).collect ())
876+ assert table .column ("fv" ).to_pylist () == [1 , 1 , 1 , 1 , 5 , 5 , 5 ]
877+
878+
858879@pytest .mark .parametrize (
859880 ("units" , "start_bound" , "end_bound" ),
860881 [
0 commit comments