@@ -583,23 +583,13 @@ fn col(name: &str) -> PyResult<PyExpr> {
583583 } )
584584}
585585
586- // TODO: do we want to create an equivalent?
587- // /// Create a COUNT(1) aggregate expression
588- // #[pyfunction]
589- // fn count_star() -> PyResult<PyExpr> {
590- // Ok(PyExpr {
591- // expr: Expr::AggregateFunction(AggregateFunction {
592- // func_def: datafusion_expr::expr::AggregateFunctionDefinition::BuiltIn(
593- // aggregate_function::AggregateFunction::Count,
594- // ),
595- // args: vec![lit(1)],
596- // distinct: false,
597- // filter: None,
598- // order_by: None,
599- // null_treatment: None,
600- // }),
601- // })
602- // }
586+ // TODO: should we just expose this in python?
587+ /// Create a COUNT(1) aggregate expression
588+ #[ pyfunction]
589+ fn count_star ( ) -> PyExpr {
590+ functions_aggregate:: expr_fn:: count ( lit ( 1 ) ) . into ( )
591+
592+ }
603593
604594/// Wrapper for [`functions_aggregate::expr_fn::count`]
605595/// Count the number of non-null values in the column
@@ -1030,7 +1020,7 @@ pub(crate) fn init_module(m: &Bound<'_, PyModule>) -> PyResult<()> {
10301020 m. add_wrapped ( wrap_pyfunction ! ( cosh) ) ?;
10311021 m. add_wrapped ( wrap_pyfunction ! ( cot) ) ?;
10321022 m. add_wrapped ( wrap_pyfunction ! ( count) ) ?;
1033- // m.add_wrapped(wrap_pyfunction!(count_star))?;
1023+ m. add_wrapped ( wrap_pyfunction ! ( count_star) ) ?;
10341024 m. add_wrapped ( wrap_pyfunction ! ( covar) ) ?;
10351025 m. add_wrapped ( wrap_pyfunction ! ( covar_pop) ) ?;
10361026 m. add_wrapped ( wrap_pyfunction ! ( covar_samp) ) ?;
0 commit comments