This is an automated email from the ASF dual-hosted git repository.
lgbo 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 b9b44470c4 fix: Invalid result from CoalesceAggregationUnion (#10380)
b9b44470c4 is described below
commit b9b44470c412234620033f4f12e15259df64aaf5
Author: lgbo <[email protected]>
AuthorDate: Fri Aug 8 13:56:59 2025 +0800
fix: Invalid result from CoalesceAggregationUnion (#10380)
---
.../apache/gluten/extension/CoalesceAggregationUnion.scala | 1 +
.../execution/GlutenCoalesceAggregationUnionSuite.scala | 12 ++++++++++++
2 files changed, 13 insertions(+)
diff --git
a/backends-clickhouse/src/main/scala/org/apache/gluten/extension/CoalesceAggregationUnion.scala
b/backends-clickhouse/src/main/scala/org/apache/gluten/extension/CoalesceAggregationUnion.scala
index 90d647f437..ec314b5d5e 100644
---
a/backends-clickhouse/src/main/scala/org/apache/gluten/extension/CoalesceAggregationUnion.scala
+++
b/backends-clickhouse/src/main/scala/org/apache/gluten/extension/CoalesceAggregationUnion.scala
@@ -506,6 +506,7 @@ case class CoalesceAggregationUnion(spark: SparkSession)
extends Rule[LogicalPla
}
override def doValidate(): Boolean = {
+ originalAggregate.groupingExpressions.nonEmpty &&
!hasAggregateWithFilter &&
constructedAggregatePlan.isDefined &&
aggregateResultMatchedGroupingKeysPositions.forall(_ >= 0) &&
diff --git
a/backends-clickhouse/src/test/scala/org/apache/gluten/execution/GlutenCoalesceAggregationUnionSuite.scala
b/backends-clickhouse/src/test/scala/org/apache/gluten/execution/GlutenCoalesceAggregationUnionSuite.scala
index 5df4a41352..a232b4adb4 100644
---
a/backends-clickhouse/src/test/scala/org/apache/gluten/execution/GlutenCoalesceAggregationUnionSuite.scala
+++
b/backends-clickhouse/src/test/scala/org/apache/gluten/execution/GlutenCoalesceAggregationUnionSuite.scala
@@ -519,6 +519,18 @@ class GlutenCoalesceAggregationUnionSuite extends
GlutenClickHouseWholeStageTran
compareResultsAgainstVanillaSpark(sql, true, checkHasUnion, true)
}
+ test("no coalesce project union. case 4") {
+ val sql =
+ """
+ |select t, b from (
+ | select 1 as t, sum(b) as b from coalesce_union_t1 where a = 'c'
+ | union all
+ | select 2 as t, sum(b) as b from coalesce_union_t1 where a = 'd'
+ |) order by t, b
+ |""".stripMargin
+ compareResultsAgainstVanillaSpark(sql, true, checkHasUnion, true)
+ }
+
test("GLUTEN-9646: fix coalesce project union when has subquery") {
val schema_fact = StructType(
Array(
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]