Skip to content

Commit f9d699c

Browse files
migrage var_pop to UDAF
Ref: apache/datafusion#10836
1 parent 0055538 commit f9d699c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/functions.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,16 @@ pub fn var(y: PyExpr) -> PyExpr {
181181
var_samp(y)
182182
}
183183

184+
#[pyfunction]
185+
pub fn var_pop(expression: PyExpr, distinct: bool) -> PyResult<PyExpr> {
186+
let expr = functions_aggregate::expr_fn::var_pop(expression.expr);
187+
if distinct {
188+
Ok(expr.distinct().build()?.into())
189+
} else {
190+
Ok(expr.into())
191+
}
192+
}
193+
184194
#[pyfunction]
185195
#[pyo3(signature = (expr, distinct = false, filter = None, order_by = None, null_treatment = None))]
186196
pub fn first_value(
@@ -837,7 +847,6 @@ array_fn!(range, start stop step);
837847
aggregate_function!(array_agg, ArrayAgg);
838848
aggregate_function!(max, Max);
839849
aggregate_function!(min, Min);
840-
aggregate_function!(var_pop, VariancePop);
841850
aggregate_function!(regr_avgx, RegrAvgx);
842851
aggregate_function!(regr_avgy, RegrAvgy);
843852
aggregate_function!(regr_count, RegrCount);

0 commit comments

Comments
 (0)