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/extension.rs
7884 views
1
use super::*;
2
3
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
4
#[cfg_attr(feature = "dsl-schema", derive(schemars::JsonSchema))]
5
#[derive(Clone, PartialEq, Debug, Hash)]
6
pub enum ExtensionFunction {
7
To(DataTypeExpr),
8
Storage,
9
}
10
11
impl Display for ExtensionFunction {
12
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
13
use ExtensionFunction::*;
14
match self {
15
To(dtype) => write!(f, "ext.to({dtype:?})"),
16
Storage => write!(f, "ext.storage()"),
17
}
18
}
19
}
20
21
impl From<ExtensionFunction> for FunctionExpr {
22
fn from(func: ExtensionFunction) -> Self {
23
FunctionExpr::Extension(func)
24
}
25
}
26
27