cloud-fan commented on code in PR #43786:
URL: https://github.com/apache/spark/pull/43786#discussion_r1393889797


##########
connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/functions.scala:
##########
@@ -842,19 +842,20 @@ object functions {
    * @group agg_funcs
    * @since 3.4.0
    */
-  def mode(e: Column): Column = mode(e, deterministic = false)
+  def mode(e: Column): Column = Column.fn("mode", e)
 
   /**
    * Aggregate function: returns the most frequent value in a group.
    *
-   * When multiple values have the same greatest frequency then either any of 
values is returned
-   * if deterministic is false or is not defined, or the lowest value is 
returned if deterministic
-   * is true.
+   * If there are multiple values with the greatest frequency only one value 
will be returned. The
+   * value will be chosen based on optional sort direction. Use ascending 
order to get smallest
+   * value or descending order to get largest value from multiple values with 
the same frequency.
+   * If this clause is not specified the exact chosen value is not determined.
    *
    * @group agg_funcs
    * @since 4.0.0
    */
-  def mode(e: Column, deterministic: Boolean): Column = Column.fn("mode", e, 
lit(deterministic))
+  def mode(e: Column, isSortAsc: Boolean): Column = Column.fn("mode", e, 
lit(isSortAsc))

Review Comment:
   If we do want to support specify ordering, we should support ordering 
columns. I don't agree with this partial API change. Let's finish the SQL side 
first, then we can think about how the Scala API should look like.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to