Skip to content

Commit

Permalink
migrage corr to UDAF
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-J-Ward committed Jul 24, 2024
1 parent 6509d6d commit da69cee
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 @@ -97,6 +97,16 @@ pub fn avg(expression: PyExpr, distinct: bool) -> PyResult<PyExpr> {
}
}

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

#[pyfunction]
pub fn sum(args: PyExpr) -> PyExpr {
functions_aggregate::expr_fn::sum(args.expr).into()
Expand Down Expand Up @@ -759,7 +769,6 @@ array_fn!(flatten, array);
array_fn!(range, start stop step);

aggregate_function!(array_agg, ArrayAgg);
aggregate_function!(corr, Correlation);
aggregate_function!(grouping, Grouping);
aggregate_function!(max, Max);
aggregate_function!(mean, Avg);
Expand Down

0 comments on commit da69cee

Please sign in to comment.