Skip to content

Commit

Permalink
fix: Fix variable name in error message for "unsupported data type" i…
Browse files Browse the repository at this point in the history
…n rolling and upsampling operations (#20553)
  • Loading branch information
MarcoGorelli authored Jan 5, 2025
1 parent 305ba5f commit e360e0a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crates/polars-time/src/windows/duration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@ pub fn ensure_duration_matches_dtype(
InvalidOperation: "`{}` duration may not be a parsed integer (i.e. use '2d', not '2i') when working with a temporal column", variable_name);
},
_ => {
polars_bail!(InvalidOperation: "unsupported data type: {} for `{}`, expected UInt64, UInt32, Int64, Int32, Datetime, Date, Duration, or Time", dtype, variable_name)
polars_bail!(InvalidOperation: "unsupported data type: {} for temporal/index column, expected UInt64, UInt32, Int64, Int32, Datetime, Date, Duration, or Time", dtype)
},
}
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion py-polars/tests/unit/operations/rolling/test_rolling.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def test_rolling_by_invalid() -> None:
df = pl.DataFrame(
{"a": [1, 2, 3], "b": [4, 5, 6]}, schema_overrides={"a": pl.Int16}
).sort("a")
msg = "unsupported data type: i16 for `window_size`, expected UInt64, UInt32, Int64, Int32, Datetime, Date, Duration, or Time"
msg = "unsupported data type: i16 for temporal/index column, expected UInt64, UInt32, Int64, Int32, Datetime, Date, Duration, or Time"
with pytest.raises(InvalidOperationError, match=msg):
df.select(pl.col("b").rolling_min_by("a", "2i"))
df = pl.DataFrame({"a": [1, 2, 3], "b": [date(2020, 1, 1)] * 3}).sort("b")
Expand Down

0 comments on commit e360e0a

Please sign in to comment.