Path: blob/main/crates/polars-plan/src/dsl/function_expr/rolling.rs
8393 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,13Rank,14#[cfg(feature = "moment")]15Skew,16#[cfg(feature = "moment")]17Kurtosis,18#[cfg(feature = "cov")]19CorrCov {20corr_cov_options: RollingCovOptions,21// Whether is Corr or Cov22is_corr: bool,23},24Map(PlanCallback<Series, Series>),25}2627impl Display for RollingFunction {28fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {29use RollingFunction::*;3031let name = match self {32Min => "min",33Max => "max",34Mean => "mean",35Sum => "rsum",36Quantile => "quantile",37Var => "var",38Std => "std",39Rank => "rank",40#[cfg(feature = "moment")]41Skew => "skew",42#[cfg(feature = "moment")]43Kurtosis => "kurtosis",44#[cfg(feature = "cov")]45CorrCov { is_corr, .. } => {46if *is_corr {47"corr"48} else {49"cov"50}51},52Map(_) => "map",53};5455write!(f, "rolling_{name}")56}57}585960