File tree Expand file tree Collapse file tree
crates/polars-expr/src/expressions
py-polars/tests/unit/operations Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -391,6 +391,11 @@ impl PhysicalExpr for SortByExpr {
391391
392392 groups?
393393 } else {
394+ let groups_in = ac_in. groups ( ) ;
395+ for ac in ac_sort_by. iter ( ) {
396+ check_groups ( groups_in. as_ref ( ) . as_ref ( ) , ac. groups . as_ref ( ) . as_ref ( ) ) ?;
397+ }
398+
394399 let groups = ac_sort_by[ 0 ] . groups ( ) ;
395400
396401 let groups = RAYON . install ( || {
Original file line number Diff line number Diff line change @@ -1316,3 +1316,17 @@ def test_sort_maintain_order_all_nulls_27514(
13161316 .collect ()
13171317 )
13181318 assert_frame_equal (result , df )
1319+
1320+
1321+ def test_sort_by_multiple_length_mismatch_27759 () -> None :
1322+ df = pl .DataFrame (
1323+ {
1324+ "a" : [0 , 0 ],
1325+ "b" : ["foo" , "blah" ],
1326+ "c" : [False , True ],
1327+ "d" : [0 , 0 ],
1328+ "e" : [0 , 0 ],
1329+ }
1330+ )
1331+ with pytest .raises (pl .exceptions .ShapeError ):
1332+ df .group_by ("a" ).agg (pl .col ("b" ).filter ("c" ).sort_by (["d" , "e" ]))
You can’t perform that action at this time.
0 commit comments