This is an automated email from the ASF dual-hosted git repository.

beliefer pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-4.0 by this push:
     new 1b84e50644f3 [SPARK-42746][SQL][FOLLOWUP] Correct the comments for 
SupportsOrderingWithinGroup and Mode
1b84e50644f3 is described below

commit 1b84e50644f30070990daf98a6cc0e8f28f0b9ea
Author: beliefer <[email protected]>
AuthorDate: Mon Feb 17 14:25:49 2025 +0800

    [SPARK-42746][SQL][FOLLOWUP] Correct the comments for 
SupportsOrderingWithinGroup and Mode
    
    ### What changes were proposed in this pull request?
    This PR propose to correct the comments for `SupportsOrderingWithinGroup` 
and `Mode`.
    
    ### Why are the changes needed?
    First, some comments added with incorrect style.
    Second, replace `QueryCompilationErrors.functionMissingWithinGroupError` 
with the correct 
`QueryCompilationErrors.distinctWithOrderingFunctionUnsupportedError`.
    
    ### Does this PR introduce _any_ user-facing change?
    'No'.
    New feature.
    
    ### How was this patch tested?
    GA.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    'No'.
    
    Closes #49907 from beliefer/SPARK-42746_followup2.
    
    Lead-authored-by: beliefer <[email protected]>
    Co-authored-by: Jiaan Geng <[email protected]>
    Signed-off-by: beliefer <[email protected]>
    (cherry picked from commit 0002cdd6ea1f2be79611a89b0976ecb86f21c05f)
    Signed-off-by: beliefer <[email protected]>
---
 .../sql/catalyst/expressions/aggregate/Mode.scala  | 29 +++++++++++-----------
 .../aggregate/SupportsOrderingWithinGroup.scala    |  2 +-
 2 files changed, 15 insertions(+), 16 deletions(-)

diff --git 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/Mode.scala
 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/Mode.scala
index f3eeaa96b3d4..7a4f04bf04f7 100644
--- 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/Mode.scala
+++ 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/Mode.scala
@@ -137,21 +137,20 @@ case class Mode(
     if (buffer.isEmpty) {
       return null
     }
-    /*
-      * The Mode class uses special collation awareness logic
-      *  to handle string data types with various collations.
-      *
-      * For string types that don't support binary equality,
-      * we create a new map where the keys are the collation keys of the 
original strings.
-      *
-      * Keys from the original map are aggregated based on the corresponding 
collation keys.
-      *  The groupMapReduce method groups the entries by collation key and 
maps each group
-      *  to a single value (the sum of the counts), and finally reduces the 
groups to a single map.
-      *
-      * The new map is then used in the rest of the Mode evaluation logic.
-      *
-      * It is expected to work for all simple and complex types with collated 
fields.
-      */
+
+    // The Mode class uses special collation awareness logic
+    // to handle string data types with various collations.
+    //
+    // For string types that don't support binary equality,
+    // we create a new map where the keys are the collation keys of the 
original strings.
+    //
+    // Keys from the original map are aggregated based on the corresponding 
collation keys.
+    // The groupMapReduce method groups the entries by collation key and maps 
each group
+    // to a single value (the sum of the counts), and finally reduces the 
groups to a single map.
+    //
+    // The new map is then used in the rest of the Mode evaluation logic.
+    //
+    // It is expected to work for all simple and complex types with collated 
fields.
     val collationAwareBuffer = getCollationAwareBuffer(child.dataType, buffer)
 
     reverseOpt.map { reverse =>
diff --git 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/SupportsOrderingWithinGroup.scala
 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/SupportsOrderingWithinGroup.scala
index 453251ac61cd..cb4555d4b902 100644
--- 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/SupportsOrderingWithinGroup.scala
+++ 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/SupportsOrderingWithinGroup.scala
@@ -39,7 +39,7 @@ trait SupportsOrderingWithinGroup { self: AggregateFunction =>
    * Tells Analyzer that DISTINCT is supported.
    * The DISTINCT can conflict with order so some functions can ban it.
    *
-   * @see [[QueryCompilationErrors.functionMissingWithinGroupError]]
+   * @see 
[[QueryCompilationErrors.distinctWithOrderingFunctionUnsupportedError]]
    */
   def isDistinctSupported: Boolean
 }


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

Reply via email to