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

rui 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 94e1638c5 [VL] Add large precision tests for decimal sum and avg 
(#4961)
94e1638c5 is described below

commit 94e1638c543b1397b709e2fe5ad0717223053c80
Author: Joey <joey....@alibaba-inc.com>
AuthorDate: Tue Mar 19 13:11:44 2024 +0800

    [VL] Add large precision tests for decimal sum and avg (#4961)
---
 .../execution/VeloxAggregateFunctionsSuite.scala   | 27 ++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git 
a/backends-velox/src/test/scala/io/glutenproject/execution/VeloxAggregateFunctionsSuite.scala
 
b/backends-velox/src/test/scala/io/glutenproject/execution/VeloxAggregateFunctionsSuite.scala
index 26bea5b1c..c0143d0ae 100644
--- 
a/backends-velox/src/test/scala/io/glutenproject/execution/VeloxAggregateFunctionsSuite.scala
+++ 
b/backends-velox/src/test/scala/io/glutenproject/execution/VeloxAggregateFunctionsSuite.scala
@@ -99,6 +99,19 @@ abstract class VeloxAggregateFunctionsSuite extends 
VeloxWholeStageTransformerSu
               }) == 4)
         }
     }
+    // Test the situation that precision + 4 of input decimal value exceeds 38.
+    runQueryAndCompare(
+      "select avg(cast (l_quantity as DECIMAL(36, 2))), " +
+        "count(distinct l_partkey) from lineitem") {
+      df =>
+        {
+          assert(
+            getExecutedPlan(df).count(
+              plan => {
+                plan.isInstanceOf[HashAggregateExecTransformer]
+              }) == 4)
+        }
+    }
   }
 
   test("sum") {
@@ -142,6 +155,20 @@ abstract class VeloxAggregateFunctionsSuite extends 
VeloxWholeStageTransformerSu
               }) == 4)
         }
     }
+
+    // Test the situation that precision + 4 of input decimal value exceeds 38.
+    runQueryAndCompare(
+      "select sum(cast (l_quantity as DECIMAL(36, 2))), " +
+        "count(distinct l_partkey) from lineitem") {
+      df =>
+        {
+          assert(
+            getExecutedPlan(df).count(
+              plan => {
+                plan.isInstanceOf[HashAggregateExecTransformer]
+              }) == 4)
+        }
+    }
   }
 
   test("min and max") {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@gluten.apache.org
For additional commands, e-mail: commits-h...@gluten.apache.org

Reply via email to