Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pola-rs
GitHub Repository: pola-rs/polars
Path: blob/main/crates/polars-plan/src/dsl/function_expr/rolling_by.rs
6940 views
1
use super::*;
2
3
#[derive(Clone, PartialEq, Debug)]
4
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
5
#[cfg_attr(feature = "dsl-schema", derive(schemars::JsonSchema))]
6
pub enum RollingFunctionBy {
7
MinBy,
8
MaxBy,
9
MeanBy,
10
SumBy,
11
QuantileBy,
12
VarBy,
13
StdBy,
14
}
15
16
impl Display for RollingFunctionBy {
17
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
18
use RollingFunctionBy::*;
19
20
let name = match self {
21
MinBy => "rolling_min_by",
22
MaxBy => "rolling_max_by",
23
MeanBy => "rolling_mean_by",
24
SumBy => "rolling_sum_by",
25
QuantileBy => "rolling_quantile_by",
26
VarBy => "rolling_var_by",
27
StdBy => "rolling_std_by",
28
};
29
30
write!(f, "{name}")
31
}
32
}
33
34
impl Hash for RollingFunctionBy {
35
fn hash<H: Hasher>(&self, state: &mut H) {
36
std::mem::discriminant(self).hash(state);
37
}
38
}
39
40