Skip to content

Commit

Permalink
migrage var_pop to UDAF
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-J-Ward committed Jul 25, 2024
1 parent d0ae202 commit 40d9d3e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,16 @@ pub fn var(y: PyExpr) -> PyExpr {
var_samp(y)
}

#[pyfunction]
pub fn var_pop(expression: PyExpr, distinct: bool) -> PyResult<PyExpr> {
let expr = functions_aggregate::expr_fn::var_pop(expression.expr);
if distinct {
Ok(expr.distinct().build()?.into())
} else {
Ok(expr.into())
}
}

#[pyfunction]
#[pyo3(signature = (expr, distinct = false, filter = None, order_by = None, null_treatment = None))]
pub fn first_value(
Expand Down Expand Up @@ -837,7 +847,6 @@ array_fn!(range, start stop step);
aggregate_function!(array_agg, ArrayAgg);
aggregate_function!(max, Max);
aggregate_function!(min, Min);
aggregate_function!(var_pop, VariancePop);
aggregate_function!(regr_avgx, RegrAvgx);
aggregate_function!(regr_avgy, RegrAvgy);
aggregate_function!(regr_count, RegrCount);
Expand Down

0 comments on commit 40d9d3e

Please sign in to comment.