Path: blob/main/crates/polars-time/src/chunkedarray/rolling_window/mod.rs
6940 views
use std::hash::{Hash, Hasher};12mod dispatch;3#[cfg(feature = "rolling_window_by")]4mod rolling_kernels;56use arrow::array::{ArrayRef, PrimitiveArray};7pub use dispatch::*;8use polars_compute::rolling;9use polars_compute::rolling::RollingFnParams;10use polars_core::prelude::*;11#[cfg(feature = "serde")]12use serde::{Deserialize, Serialize};1314use crate::prelude::*;1516#[derive(Clone, Debug)]17#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]18#[cfg_attr(feature = "dsl-schema", derive(schemars::JsonSchema))]19#[cfg_attr(feature = "rolling_window_by", derive(PartialEq))]20pub struct RollingOptionsDynamicWindow {21/// The length of the window.22pub window_size: Duration,23/// Amount of elements in the window that should be filled before computing a result.24pub min_periods: usize,25/// Which side windows should be closed.26pub closed_window: ClosedWindow,27/// Optional parameters for the rolling28#[cfg_attr(any(feature = "serde", feature = "dsl-schema"), serde(default))]29pub fn_params: Option<RollingFnParams>,30}3132impl Hash for RollingOptionsDynamicWindow {33fn hash<H: Hasher>(&self, state: &mut H) {34self.window_size.hash(state);35self.min_periods.hash(state);36self.closed_window.hash(state);37}38}394041