Path: blob/main/crates/polars-plan/src/dsl/function_expr/rolling.rs
6940 views
use super::*;12#[derive(Clone, PartialEq, Debug, Hash)]3#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]4#[cfg_attr(feature = "dsl-schema", derive(schemars::JsonSchema))]5pub enum RollingFunction {6Min,7Max,8Mean,9Sum,10Quantile,11Var,12Std,13#[cfg(feature = "moment")]14Skew,15#[cfg(feature = "moment")]16Kurtosis,17#[cfg(feature = "cov")]18CorrCov {19corr_cov_options: RollingCovOptions,20// Whether is Corr or Cov21is_corr: bool,22},23Map(PlanCallback<Series, Series>),24}2526impl Display for RollingFunction {27fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {28use RollingFunction::*;2930let name = match self {31Min => "min",32Max => "max",33Mean => "mean",34Sum => "rsum",35Quantile => "quantile",36Var => "var",37Std => "std",38#[cfg(feature = "moment")]39Skew => "skew",40#[cfg(feature = "moment")]41Kurtosis => "kurtosis",42#[cfg(feature = "cov")]43CorrCov { is_corr, .. } => {44if *is_corr {45"corr"46} else {47"cov"48}49},50Map(_) => "map",51};5253write!(f, "rolling_{name}")54}55}565758