diff --git a/crates/polars-ops/src/frame/join/dispatch_left_right.rs b/crates/polars-ops/src/frame/join/dispatch_left_right.rs index 452c51154a64..4267c8743bc6 100644 --- a/crates/polars-ops/src/frame/join/dispatch_left_right.rs +++ b/crates/polars-ops/src/frame/join/dispatch_left_right.rs @@ -170,8 +170,7 @@ fn maintain_order_idx( let join_tuples_left = df .column("a") .unwrap() - .as_series() - .unwrap() + .as_materialized_series() .idx() .unwrap() .cont_slice() @@ -180,8 +179,7 @@ fn maintain_order_idx( let join_tuples_right = df .column("b") .unwrap() - .as_series() - .unwrap() + .as_materialized_series() .idx() .unwrap() .cont_slice() diff --git a/py-polars/tests/unit/functions/test_functions.py b/py-polars/tests/unit/functions/test_functions.py index 05bd11976fd8..37fb0e8eae73 100644 --- a/py-polars/tests/unit/functions/test_functions.py +++ b/py-polars/tests/unit/functions/test_functions.py @@ -374,6 +374,14 @@ def test_align_frames_duplicate_key() -> None: ] +def test_align_frames_single_row_20445() -> None: + left = pl.DataFrame({"a": [1], "b": [2]}) + right = pl.DataFrame({"a": [1], "c": [3]}) + result = pl.align_frames(left, right, how="left", on="a") + assert_frame_equal(result[0], left) + assert_frame_equal(result[1], right) + + def test_coalesce() -> None: df = pl.DataFrame( {