From 7aff4c49db54db8a2f433e7a5887b80cbcab3cee Mon Sep 17 00:00:00 2001 From: zml1206 Date: Mon, 19 Jan 2026 14:40:30 +0800 Subject: [PATCH 1/3] [DNM] Test agg --- .../gluten/execution/VeloxAggregateFunctionsSuite.scala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxAggregateFunctionsSuite.scala b/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxAggregateFunctionsSuite.scala index 14d755bbf1ff..ef657791f351 100644 --- a/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxAggregateFunctionsSuite.scala +++ b/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxAggregateFunctionsSuite.scala @@ -122,7 +122,12 @@ abstract class VeloxAggregateFunctionsSuite extends VeloxWholeStageTransformerSu } test("sum") { - runQueryAndCompare("select sum(l_partkey) from lineitem where l_partkey < 2000") { + runQueryAndCompare( + """ + |select l_orderkey, sum(l_partkey), sum(l_partkey1) from + | (select l_orderkey, l_partkey, l_partkey as l_partkey1 from lineitem) + | group by l_orderkey + |""".stripMargin) { checkGlutenPlan[HashAggregateExecTransformer] } runQueryAndCompare("select sum(l_quantity), count(distinct l_partkey) from lineitem") { From d445d065665bd2e4505e1db08910fba1c33b7372 Mon Sep 17 00:00:00 2001 From: zml1206 Date: Mon, 19 Jan 2026 14:46:20 +0800 Subject: [PATCH 2/3] fix style --- .../execution/VeloxAggregateFunctionsSuite.scala | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxAggregateFunctionsSuite.scala b/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxAggregateFunctionsSuite.scala index ef657791f351..1caf1fbadb1d 100644 --- a/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxAggregateFunctionsSuite.scala +++ b/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxAggregateFunctionsSuite.scala @@ -122,12 +122,11 @@ abstract class VeloxAggregateFunctionsSuite extends VeloxWholeStageTransformerSu } test("sum") { - runQueryAndCompare( - """ - |select l_orderkey, sum(l_partkey), sum(l_partkey1) from - | (select l_orderkey, l_partkey, l_partkey as l_partkey1 from lineitem) - | group by l_orderkey - |""".stripMargin) { + runQueryAndCompare(""" + |select l_orderkey, sum(l_partkey), sum(l_partkey1) from + | (select l_orderkey, l_partkey, l_partkey as l_partkey1 from lineitem) + | group by l_orderkey + |""".stripMargin) { checkGlutenPlan[HashAggregateExecTransformer] } runQueryAndCompare("select sum(l_quantity), count(distinct l_partkey) from lineitem") { From 817ba832ff2d128324f3bfaf4e5c9c7b38fdc373 Mon Sep 17 00:00:00 2001 From: zml1206 Date: Sat, 28 Feb 2026 09:29:07 +0800 Subject: [PATCH 3/3] [VL][TEST] Add test for aggregate with duplicate project --- .../execution/VeloxAggregateFunctionsSuite.scala | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxAggregateFunctionsSuite.scala b/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxAggregateFunctionsSuite.scala index 013f26ee9119..e1c89f986967 100644 --- a/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxAggregateFunctionsSuite.scala +++ b/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxAggregateFunctionsSuite.scala @@ -122,11 +122,7 @@ abstract class VeloxAggregateFunctionsSuite extends VeloxWholeStageTransformerSu } test("sum") { - runQueryAndCompare(""" - |select l_orderkey, sum(l_partkey), sum(l_partkey1) from - | (select l_orderkey, l_partkey, l_partkey as l_partkey1 from lineitem) - | group by l_orderkey - |""".stripMargin) { + runQueryAndCompare("select sum(l_partkey) from lineitem where l_partkey < 2000") { checkGlutenPlan[HashAggregateExecTransformer] } runQueryAndCompare("select sum(l_quantity), count(distinct l_partkey) from lineitem") { @@ -180,6 +176,15 @@ abstract class VeloxAggregateFunctionsSuite extends VeloxWholeStageTransformerSu }) == 4) } } + + // Test duplicate field project. + runQueryAndCompare(""" + |select l_orderkey, sum(l_partkey), sum(l_partkey1) from + | (select l_orderkey, l_partkey, l_partkey as l_partkey1 from lineitem) + | group by l_orderkey + |""".stripMargin) { + checkGlutenPlan[HashAggregateExecTransformer] + } } test("min and max") {