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

felixybw pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-gluten.git


The following commit(s) were added to refs/heads/main by this push:
     new 8e87c38de6 [GLUTEN-10678] Refactor transformSortDirection for 
SortExecTransformer (#10679)
8e87c38de6 is described below

commit 8e87c38de6941272b315da7f46ba5e90fcfbbbc1
Author: Jiaan Geng <[email protected]>
AuthorDate: Sat Sep 13 15:47:27 2025 +0800

    [GLUTEN-10678] Refactor transformSortDirection for SortExecTransformer 
(#10679)
    
    This PR proposes to refactor transformSortDirection for SortExecTransformer.
---
 .../apache/gluten/execution/SortExecTransformer.scala   | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git 
a/gluten-substrait/src/main/scala/org/apache/gluten/execution/SortExecTransformer.scala
 
b/gluten-substrait/src/main/scala/org/apache/gluten/execution/SortExecTransformer.scala
index b951dc744c..767ec03cd1 100644
--- 
a/gluten-substrait/src/main/scala/org/apache/gluten/execution/SortExecTransformer.scala
+++ 
b/gluten-substrait/src/main/scala/org/apache/gluten/execution/SortExecTransformer.scala
@@ -123,17 +123,10 @@ case class SortExecTransformer(
 }
 
 object SortExecTransformer {
-  def transformSortDirection(order: SortOrder): Int = {
-    transformSortDirection(order.direction.sql, order.nullOrdering.sql)
-  }
-
-  def transformSortDirection(direction: String, nullOrdering: String): Int = {
-    (direction, nullOrdering) match {
-      case ("ASC", "NULLS FIRST") => 1
-      case ("ASC", "NULLS LAST") => 2
-      case ("DESC", "NULLS FIRST") => 3
-      case ("DESC", "NULLS LAST") => 4
-      case _ => 0
-    }
+  def transformSortDirection(order: SortOrder): Int = order match {
+    case SortOrder(_, Ascending, NullsFirst, _) => 1
+    case SortOrder(_, Ascending, NullsLast, _) => 2
+    case SortOrder(_, Descending, NullsFirst, _) => 3
+    case SortOrder(_, Descending, NullsLast, _) => 4
   }
 }


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

Reply via email to