We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e3a4a7a commit 9b2f63bCopy full SHA for 9b2f63b
src/functions.rs
@@ -604,8 +604,13 @@ fn col(name: &str) -> PyResult<PyExpr> {
604
/// Wrapper for [`functions_aggregate::expr_fn::count`]
605
/// Count the number of non-null values in the column
606
#[pyfunction]
607
-fn count(expr: PyExpr) -> PyExpr {
608
- functions_aggregate::expr_fn::count(expr.expr).into()
+fn count(expr: PyExpr, distinct: bool) -> PyResult<PyExpr> {
+ let expr = functions_aggregate::expr_fn::count(expr.expr);
609
+ if distinct {
610
+ Ok(expr.distinct().build()?.into())
611
+ } else {
612
+ Ok(expr.into())
613
+ }
614
}
615
616
/// Create a CASE WHEN statement with literal WHEN expressions for comparison to the base expression.
0 commit comments