You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/10/09 05:57:47 UTC

[GitHub] [spark] HyukjinKwon commented on a change in pull request #34229: [SPARK-36963][SQL] Add max_by/min_by to sql.functions

HyukjinKwon commented on a change in pull request #34229:
URL: https://github.com/apache/spark/pull/34229#discussion_r725439408



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/functions.scala
##########
@@ -673,6 +673,23 @@ object functions {
    */
   def max(columnName: String): Column = max(Column(columnName))
 
+  /**
+   * Aggregate function: returns the value associated with the maximum value of ord.
+   *
+   * @group agg_funcs
+   * @since 3.3.0
+   */
+  def max_by(e: Column, ord: Column): Column = withAggregateFunction { MaxBy(e.expr, ord.expr) }
+
+  /**
+   * Aggregate function: returns the value associated with the maximum value of ord.
+   *
+   * @group agg_funcs
+   * @since 3.3.0
+   */
+  def max_by(columnName: String, ordColumnName: String): Column =

Review comment:
       Let's avoid adding string overriden version (see the comments on the top of this file)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org