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

ulyssesyou 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 f10d3b7bd [GLUTEN-5852][CH] fix mismatch result columns size exception 
(#5853)
f10d3b7bd is described below

commit f10d3b7bdd02dc28f85bf25207789251a265fa67
Author: shuai.xu <[email protected]>
AuthorDate: Wed May 29 19:35:52 2024 +0800

    [GLUTEN-5852][CH] fix mismatch result columns size exception (#5853)
---
 .../gluten/execution/GlutenClickhouseCountDistinctSuite.scala      | 7 +++++++
 .../main/scala/org/apache/gluten/utils/PullOutProjectHelper.scala  | 7 ++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git 
a/backends-clickhouse/src/test/scala/org/apache/gluten/execution/GlutenClickhouseCountDistinctSuite.scala
 
b/backends-clickhouse/src/test/scala/org/apache/gluten/execution/GlutenClickhouseCountDistinctSuite.scala
index 1b954df22..5887050d0 100644
--- 
a/backends-clickhouse/src/test/scala/org/apache/gluten/execution/GlutenClickhouseCountDistinctSuite.scala
+++ 
b/backends-clickhouse/src/test/scala/org/apache/gluten/execution/GlutenClickhouseCountDistinctSuite.scala
@@ -213,4 +213,11 @@ class GlutenClickhouseCountDistinctSuite extends 
GlutenClickHouseWholeStageTrans
       }
     )
   }
+
+  test("GLUTEN-5852: Fix mismatch result columns size exception related to 
5618") {
+    val sql =
+      "select distinct * from (select 2 as r3, count(distinct a, b, c), 2 as 
r1, 2 as r2  from " +
+        "values (0, null, 1), (1, 1, 1), (2, 2, 1), (1, 2, 1) ,(2, 2, 2) as 
data(a,b,c) group by c)"
+    compareResultsAgainstVanillaSpark(sql, true, { _ => })
+  }
 }
diff --git 
a/gluten-core/src/main/scala/org/apache/gluten/utils/PullOutProjectHelper.scala 
b/gluten-core/src/main/scala/org/apache/gluten/utils/PullOutProjectHelper.scala
index 824694837..505f13f26 100644
--- 
a/gluten-core/src/main/scala/org/apache/gluten/utils/PullOutProjectHelper.scala
+++ 
b/gluten-core/src/main/scala/org/apache/gluten/utils/PullOutProjectHelper.scala
@@ -61,7 +61,12 @@ trait PullOutProjectHelper {
       replaceBoundReference: Boolean = false): Expression =
     expr match {
       case alias: Alias =>
-        projectExprsMap.getOrElseUpdate(alias.child.canonicalized, 
alias).toAttribute
+        alias.child match {
+          case _: Literal =>
+            projectExprsMap.getOrElseUpdate(alias, alias).toAttribute
+          case _ =>
+            projectExprsMap.getOrElseUpdate(alias.child.canonicalized, 
alias).toAttribute
+        }
       case attr: Attribute => attr
       case e: BoundReference if !replaceBoundReference => e
       case other =>


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

Reply via email to