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

philo 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 a85889c6c5 [GLUTEN-8061][VL] Fall back nth_value if input is foldable 
(#8062)
a85889c6c5 is described below

commit a85889c6c5cf82edddddc685d06894554df856d9
Author: Mingliang Zhu <[email protected]>
AuthorDate: Wed Nov 27 20:17:42 2024 +0800

    [GLUTEN-8061][VL] Fall back nth_value if input is foldable (#8062)
---
 .../scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala   | 4 ++--
 .../test/scala/org/apache/gluten/execution/MiscOperatorSuite.scala | 7 +++++++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git 
a/backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala
 
b/backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala
index b1245687b0..45ffd77652 100644
--- 
a/backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala
+++ 
b/backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala
@@ -399,8 +399,8 @@ object VeloxBackendSettings extends BackendSettingsApi {
             case _ =>
           }
           windowExpression.windowFunction match {
-            case _: RowNumber | _: Rank | _: CumeDist | _: DenseRank | _: 
PercentRank |
-                _: NthValue | _: NTile =>
+            case _: RowNumber | _: Rank | _: CumeDist | _: DenseRank | _: 
PercentRank | _: NTile =>
+            case nv: NthValue if !nv.input.foldable =>
             case l: Lag if !l.input.foldable =>
             case l: Lead if !l.input.foldable =>
             case aggrExpr: AggregateExpression
diff --git 
a/backends-velox/src/test/scala/org/apache/gluten/execution/MiscOperatorSuite.scala
 
b/backends-velox/src/test/scala/org/apache/gluten/execution/MiscOperatorSuite.scala
index 58c748d37b..5cb2b65260 100644
--- 
a/backends-velox/src/test/scala/org/apache/gluten/execution/MiscOperatorSuite.scala
+++ 
b/backends-velox/src/test/scala/org/apache/gluten/execution/MiscOperatorSuite.scala
@@ -512,6 +512,13 @@ class MiscOperatorSuite extends 
VeloxWholeStageTransformerSuite with AdaptiveSpa
             checkGlutenOperatorMatch[WindowExecTransformer]
           }
         }
+
+        // Foldable input of nth_value is not supported.
+        runQueryAndCompare(
+          "select l_suppkey, l_orderkey, nth_value(1, 2) over" +
+            " (partition by l_suppkey order by l_orderkey) from lineitem ") {
+          checkSparkOperatorMatch[WindowExec]
+        }
     }
   }
 


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

Reply via email to