Skip to content

Commit

Permalink
update signature for covar_samp
Browse files Browse the repository at this point in the history
AggregateUDF expressions now have a builder API design, which removes arguments like filter and order_by

Ref apache/datafusion#10545
Ref apache/datafusion#10492
  • Loading branch information
Michael-J-Ward committed Jun 12, 2024
1 parent 656905c commit 232ab81
Showing 1 changed file with 4 additions and 23 deletions.
27 changes: 4 additions & 23 deletions src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,33 +36,14 @@ use datafusion_expr::{
};

#[pyfunction]
#[pyo3(signature = (y, x, distinct = false, filter = None, order_by = None))]
pub fn covar_samp(
y: PyExpr,
x: PyExpr,
distinct: bool,
filter: Option<PyExpr>,
order_by: Option<Vec<PyExpr>>,
// null_treatment: Option<sqlparser::ast::NullTreatment>,
) -> PyExpr {
let filter = filter.map(|x| Box::new(x.expr));
let order_by = order_by.map(|x| x.into_iter().map(|x| x.expr).collect::<Vec<_>>());
todo!()
// functions_aggregate::expr_fn::covar_samp(y.expr, x.expr, distinct, filter, order_by, None)
// .into()
pub fn covar_samp(y: PyExpr, x: PyExpr) -> PyExpr {
functions_aggregate::expr_fn::covar_samp(y.expr, x.expr).into()
}

#[pyfunction]
#[pyo3(signature = (y, x, distinct = false, filter = None, order_by = None))]
pub fn covar(
y: PyExpr,
x: PyExpr,
distinct: bool,
filter: Option<PyExpr>,
order_by: Option<Vec<PyExpr>>,
) -> PyExpr {
pub fn covar(y: PyExpr, x: PyExpr) -> PyExpr {
// alias for covar_samp
covar_samp(y, x, distinct, filter, order_by)
covar_samp(y, x)
}

#[pyfunction]
Expand Down

0 comments on commit 232ab81

Please sign in to comment.