Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(rust): Correct err message of check_map_output_len #13854

Merged
merged 1 commit into from
Jan 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 "
reswqa marked this conversation as resolved.
Show resolved Hide resolved
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