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

Method simplify

datafusion-examples/examples/udf/advanced_udwf.rs:191–208  ·  view source on GitHub ↗

this function will simplify `SimplifySmoothItUdf` to `AggregateUDF` for `Avg` default implementation will not be called (left as `todo!()`)

(&self)

Source from the content-addressed store, hash-verified

189 /// this function will simplify `SimplifySmoothItUdf` to `AggregateUDF` for `Avg`
190 /// default implementation will not be called (left as `todo!()`)
191 fn simplify(&self) -> Option<WindowFunctionSimplification> {
192 let simplify = |window_function: WindowFunction, _: &SimplifyContext| {
193 Ok(Expr::from(WindowFunction {
194 fun: WindowFunctionDefinition::AggregateUDF(avg_udaf()),
195 params: WindowFunctionParams {
196 args: window_function.params.args,
197 partition_by: window_function.params.partition_by,
198 order_by: window_function.params.order_by,
199 window_frame: window_function.params.window_frame,
200 null_treatment: window_function.params.null_treatment,
201 distinct: window_function.params.distinct,
202 filter: window_function.params.filter,
203 },
204 }))
205 };
206
207 Some(Box::new(simplify))
208 }
209
210 fn field(&self, field_args: WindowUDFFieldArgs) -> Result<FieldRef> {
211 Ok(Field::new(field_args.name(), DataType::Float64, true).into())

Callers

nothing calls this directly

Calls 2

AggregateUDFClass · 0.85
newFunction · 0.85

Tested by

no test coverage detected