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

chengchengjin 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 fdd8371406 [GLUTEN-9245][VL] Fix partial project expression contains 
subquery (#9259)
fdd8371406 is described below

commit fdd83714067c4a77006d6695b2bd8f6ad9e3ef23
Author: Jin Chengcheng <[email protected]>
AuthorDate: Wed Apr 9 09:43:01 2025 +0100

    [GLUTEN-9245][VL] Fix partial project expression contains subquery (#9259)
    
    With argument projectList in class ColumnarPartialProjectExec, function 
QueryPlan.expressions can return the Expression list correctly, then the 
function executeQuery can find the SubQuery from Expression.
---
 .../gluten/execution/ColumnarPartialProjectExec.scala       | 13 ++++++++++---
 .../apache/gluten/expression/UDFPartialProjectSuite.scala   |  9 +++++++++
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git 
a/backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala
 
b/backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala
index e97385b7cf..a432b84115 100644
--- 
a/backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala
+++ 
b/backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala
@@ -47,11 +47,17 @@ import scala.collection.mutable.ListBuffer
  * @param original
  *   extract the ScalaUDF from original project list as Alias in 
UnsafeProjection and
  *   AttributeReference in ColumnarPartialProjectExec output
+ * @param projectList
+ *   The project output, with this argument in case class, function 
QueryPlan.expressions can return
+ *   the Expression list correctly, then the function executeQuery can find 
the SubQuery from
+ *   Expression
  * @param child
  *   child plan
  */
-case class ColumnarPartialProjectExec(original: ProjectExec, child: SparkPlan)(
-    replacedAliasUdf: Seq[Alias])
+case class ColumnarPartialProjectExec(
+    original: ProjectExec,
+    projectList: Seq[NamedExpression],
+    child: SparkPlan)(replacedAliasUdf: Seq[Alias])
   extends UnaryExecNode
   with ValidatablePlan {
 
@@ -343,7 +349,8 @@ object ColumnarPartialProjectExec {
       p => replaceExpressionUDF(p, 
replacedAliasUdf).asInstanceOf[NamedExpression]
     }
     val partialProject =
-      ColumnarPartialProjectExec(original, 
original.child)(replacedAliasUdf.toSeq)
+      ColumnarPartialProjectExec(original, original.projectList, 
original.child)(
+        replacedAliasUdf.toSeq)
     ProjectExecTransformer(newProjectList, partialProject)
   }
 }
diff --git 
a/backends-velox/src/test/scala/org/apache/gluten/expression/UDFPartialProjectSuite.scala
 
b/backends-velox/src/test/scala/org/apache/gluten/expression/UDFPartialProjectSuite.scala
index 3f1a68993f..ff691906ef 100644
--- 
a/backends-velox/src/test/scala/org/apache/gluten/expression/UDFPartialProjectSuite.scala
+++ 
b/backends-velox/src/test/scala/org/apache/gluten/expression/UDFPartialProjectSuite.scala
@@ -83,6 +83,15 @@ abstract class UDFPartialProjectSuite extends 
WholeStageTransformerSuite {
     }
   }
 
+  test("test subquery") {
+    runQueryAndCompare(
+      "select plus_one(" +
+        "(select plus_one(count(*)) from (values (1)) t0(inner_c))) as col " +
+        "from (values (2),(3)) t1(outer_c)") {
+      checkGlutenOperatorMatch[ColumnarPartialProjectExec]
+    }
+  }
+
   ignore("test plus_one with column used twice") {
     runQueryAndCompare(
       "SELECT sum(plus_one(cast(l_orderkey as long)) + hash(l_orderkey)) from 
lineitem") {


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

Reply via email to