Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/4592#discussion_r24703110
--- Diff: sql/core/src/main/scala/org/apache/spark/sql/GroupedData.scala ---
@@ -149,28 +157,70 @@ class GroupedData protected[sql](df: DataFrameImpl,
groupingExprs: Seq[Expressio
* The resulting [[DataFrame]] will also contain the grouping columns.
*/
def mean(): DataFrame = aggregateNumericColumns(Average)
+
+ /**
+ * Compute the average value for given numeric columns for each group.
This is an alias for `avg`.
+ * The resulting [[DataFrame]] will also contain the grouping columns.
+ */
+ def mean(colName: String, colNames: String*): DataFrame = {
+ aggregateNumericColumns(colName, colNames:_*)(Average)
+ }
/**
* Compute the max value for each numeric columns for each group.
* The resulting [[DataFrame]] will also contain the grouping columns.
*/
def max(): DataFrame = aggregateNumericColumns(Max)
+
+ /**
+ * Compute the max value for given numeric columns for each group.
+ * The resulting [[DataFrame]] will also contain the grouping columns.
+ */
+ def max(colName: String, colNames: String*): DataFrame = {
--- End diff --
seems to me you can combine the two max functions, and then run aggregate
all on columns if the vararg is empty.
also make sure you annotate the varargs
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]