MCPcopy Create free account
hub / github.com/apache/datafusion / try_from

Method try_from

datafusion/expr/src/window_frame.rs:121–142  ·  view source on GitHub ↗
(value: ast::WindowFrame)

Source from the content-addressed store, hash-verified

119 type Error = datafusion_common::error::DataFusionError;
120
121 fn try_from(value: ast::WindowFrame) -> Result<Self> {
122 let start_bound = WindowFrameBound::try_parse(value.start_bound, &value.units)?;
123 let end_bound = match value.end_bound {
124 Some(bound) => WindowFrameBound::try_parse(bound, &value.units)?,
125 None => WindowFrameBound::CurrentRow,
126 };
127
128 if let WindowFrameBound::Following(val) = &start_bound {
129 if val.is_null() {
130 plan_err!(
131 "Invalid window frame: start bound cannot be UNBOUNDED FOLLOWING"
132 )?
133 }
134 } else if let WindowFrameBound::Preceding(val) = &end_bound
135 && val.is_null()
136 {
137 plan_err!("Invalid window frame: end bound cannot be UNBOUNDED PRECEDING")?
138 };
139
140 let units = value.units.into();
141 Ok(Self::new_bounds(units, start_bound, end_bound))
142 }
143}
144
145impl WindowFrame {

Callers

nothing calls this directly

Calls 2

is_nullMethod · 0.45
intoMethod · 0.45

Tested by

no test coverage detected