Skip to content

Commit

Permalink
fix(rust): Correct err message of check_map_output_len
Browse files Browse the repository at this point in the history
  • Loading branch information
reswqa committed Jan 19, 2024
1 parent 1d434cc commit f526106
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion crates/polars-lazy/src/physical_plan/expressions/apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ fn check_map_output_len(input_len: usize, output_len: usize, expr: &Expr) -> Pol
polars_ensure!(
input_len == output_len, expr = expr, InvalidOperation:
"output length of `map` ({}) must be equal to the input length ({}); \
consider using `apply` instead", input_len, output_len
consider using `apply` instead", output_len, input_len
);
Ok(())
}
Expand Down
8 changes: 4 additions & 4 deletions py-polars/tests/unit/operations/map/test_map_batches.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def test_error_on_reducing_map() -> None:
with pytest.raises(
pl.InvalidOperationError,
match=(
r"output length of `map` \(6\) must be equal to "
r"the input length \(1\); consider using `apply` instead"
r"output length of `map` \(1\) must be equal to "
r"the input length \(6\); consider using `apply` instead"
),
):
df.group_by("id").agg(pl.map_batches(["t", "y"], np.trapz))
Expand All @@ -47,8 +47,8 @@ def test_error_on_reducing_map() -> None:
with pytest.raises(
pl.InvalidOperationError,
match=(
r"output length of `map` \(4\) must be equal to "
r"the input length \(1\); consider using `apply` instead"
r"output length of `map` \(1\) must be equal to "
r"the input length \(4\); consider using `apply` instead"
),
):
df.select(
Expand Down
8 changes: 4 additions & 4 deletions py-polars/tests/unit/test_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def test_error_on_reducing_map() -> None:
with pytest.raises(
pl.InvalidOperationError,
match=(
r"output length of `map` \(6\) must be equal to "
r"the input length \(1\); consider using `apply` instead"
r"output length of `map` \(1\) must be equal to "
r"the input length \(6\); consider using `apply` instead"
),
):
df.group_by("id").agg(pl.map_batches(["t", "y"], np.trapz))
Expand All @@ -40,8 +40,8 @@ def test_error_on_reducing_map() -> None:
with pytest.raises(
pl.InvalidOperationError,
match=(
r"output length of `map` \(4\) must be equal to "
r"the input length \(1\); consider using `apply` instead"
r"output length of `map` \(1\) must be equal to "
r"the input length \(4\); consider using `apply` instead"
),
):
df.select(
Expand Down

0 comments on commit f526106

Please sign in to comment.