Skip to content

Commit

Permalink
wip fix rolling options [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
SHIMA Tatsuya committed May 22, 2024
1 parent 0275622 commit 06abd2d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
1 change: 1 addition & 0 deletions src/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ features = [
"replace",
"rle",
"rolling_window",
"rolling_window_by",
"round_series",
"row_hash",
"rows",
Expand Down
19 changes: 5 additions & 14 deletions src/rust/src/lazy/dsl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -684,18 +684,12 @@ impl RPolarsExpr {
weights: Robj,
min_periods: Robj,
center: Robj,
by: Robj,
closed: Robj,
warn_if_unsorted: Robj,
) -> RResult<Self> {
let options = pl::RollingOptions {
window_size: pl::Duration::parse(robj_to!(str, window_size)?),
let options = pl::RollingOptionsFixedWindow {
window_size: robj_to!(usize, window_size)?,
weights: robj_to!(Option, Vec, f64, weights)?,
min_periods: robj_to!(usize, min_periods)?,
center: robj_to!(bool, center)?,
by: robj_to!(Option, String, by)?,
closed_window: robj_to!(Option, ClosedWindow, closed)?,
warn_if_unsorted: robj_to!(bool, warn_if_unsorted)?,
fn_params: None,
};
let quantile = robj_to!(f64, quantile)?;
Expand Down Expand Up @@ -2624,15 +2618,12 @@ pub fn make_rolling_options(
by_null: Robj,
closed_null: Robj,
warn_if_unsorted: Robj,
) -> RResult<pl::RollingOptions> {
Ok(pl::RollingOptions {
window_size: pl::Duration::parse(robj_to!(str, window_size)?),
) -> RResult<pl::RollingOptionsFixedWindow> {
Ok(pl::RollingOptionsFixedWindow {
window_size: robj_to!(usize, window_size)?,
weights: robj_to!(Option, Vec, f64, weights)?,
min_periods: robj_to!(usize, min_periods)?,
center: robj_to!(bool, center)?,
by: robj_to!(Option, String, by_null)?,
closed_window: robj_to!(Option, ClosedWindow, closed_null)?,
warn_if_unsorted: robj_to!(bool, warn_if_unsorted)?,
..Default::default()
})
}
Expand Down

0 comments on commit 06abd2d

Please sign in to comment.