Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pola-rs
GitHub Repository: pola-rs/polars
Path: blob/main/crates/polars-plan/src/plans/aexpr/function_expr/rolling_by.rs
7889 views
1
use super::*;
2
3
#[derive(Clone, PartialEq, Debug)]
4
#[cfg_attr(feature = "ir_serde", derive(serde::Serialize, serde::Deserialize))]
5
pub enum IRRollingFunctionBy {
6
MinBy,
7
MaxBy,
8
MeanBy,
9
SumBy,
10
QuantileBy,
11
VarBy,
12
StdBy,
13
RankBy,
14
}
15
16
impl Display for IRRollingFunctionBy {
17
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
18
use IRRollingFunctionBy::*;
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
RankBy => "rolling_rank_by",
29
};
30
31
write!(f, "{name}")
32
}
33
}
34
35
impl Hash for IRRollingFunctionBy {
36
fn hash<H: Hasher>(&self, state: &mut H) {
37
std::mem::discriminant(self).hash(state);
38
}
39
}
40
41