@@ -5753,7 +5753,7 @@ def array_agg(
57535753
57545754
57555755def grouping (
5756- expression : Expr ,
5756+ expression : Expr | str ,
57575757 distinct : bool = False ,
57585758 filter : Expr | None = None ,
57595759) -> Expr :
@@ -5783,7 +5783,8 @@ def grouping(
57835783 on the result DataFrame instead.
57845784
57855785 Args:
5786- expression: The column to check grouping status for
5786+ expression: The column to check grouping status for (expression or column
5787+ name)
57875788 distinct: If True, compute on distinct values only
57885789 filter: If provided, only compute against rows for which the filter is True
57895790
@@ -5808,7 +5809,9 @@ def grouping(
58085809 :py:class:`~datafusion.expr.GroupingSet`
58095810 """
58105811 filter_raw = filter .expr if filter is not None else None
5811- return Expr (f .grouping (expression .expr , distinct = distinct , filter = filter_raw ))
5812+ return Expr (
5813+ f .grouping (_to_raw_expr (expression ), distinct = distinct , filter = filter_raw )
5814+ )
58125815
58135816
58145817def avg (
@@ -5906,8 +5909,8 @@ def count(
59065909 the options ``order_by`` and ``null_treatment``.
59075910
59085911 Args:
5909- expressions: Argument to perform bitwise calculation on (expression, column
5910- name, or a list of either)
5912+ expressions: Values to count (expression, column name, or a list of
5913+ either). ``"*"`` counts all rows, the same as ``count()``.
59115914 distinct: If True, a single entry for each distinct value will be in the result
59125915 filter: If provided, only compute against rows for which the filter is True
59135916
@@ -5932,7 +5935,7 @@ def count(
59325935 """
59335936 filter_raw = filter .expr if filter is not None else None
59345937
5935- if expressions is None :
5938+ if expressions is None or ( isinstance ( expressions , str ) and expressions == "*" ) :
59365939 args = [Expr .literal (1 ).expr ]
59375940 elif isinstance (expressions , list ):
59385941 args = [_to_raw_expr (arg ) for arg in expressions ]
0 commit comments