Hyukjin Kwon created SPARK-61028:
------------------------------------
Summary: Name the column of GroupedData.count, aggregate every
numeric column by default, and take a dict in DataFrame.agg, in the Python
client as PySpark does
Key: SPARK-61028
URL: https://issues.apache.org/jira/browse/SPARK-61028
Project: Spark
Issue Type: Bug
Components: Connect
Affects Versions: connect-rust-4.3.0
Reporter: Hyukjin Kwon
In PySpark, {{df.groupBy(...).count()}} names its column {{count}}, as it
aggregates {{count(lit(1)).alias("count")}}. {{sum}}, {{avg}}, {{mean}},
{{max}} and {{min}} of a GroupedData aggregate every numeric column of the
DataFrame when no column is given, and raise {{NOT_NUMERIC_COLUMNS}} for a
column that is not numeric. {{GroupedData.agg}} asserts that it is given
expressions, which are Columns unless they are one dict. {{df.agg}} raises
{{CANNOT_BE_EMPTY}} without expressions, and aggregates a dict as
{{df.groupBy().agg}} does.
The Rust-backed Python client names the column of {{count()}} {{count(1)}}, so
{{df.groupBy("k").count().orderBy("count")}} fails. {{sum()}}, {{avg()}},
{{mean()}}, {{max()}} and {{min()}} without columns aggregate no column,
{{df.groupBy("k").sum("k")}} fails on the server, and {{df.agg({"x": "max"})}}
raises a TypeError. Do as PySpark does.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]