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

zhli 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 cba12050f [VL] Enable timestamp and binary type for HLL agg function 
(#6619)
cba12050f is described below

commit cba12050f4b89fc9a4d09e7cf75486d74fd94465
Author: Zhen Li <[email protected]>
AuthorDate: Mon Jul 29 14:23:23 2024 +0800

    [VL] Enable timestamp and binary type for HLL agg function (#6619)
    
    [VL] Enable timestamp and binary type for HLL agg function.
---
 .../scala/org/apache/gluten/extension/HLLRewriteRule.scala |  2 +-
 .../gluten/execution/VeloxAggregateFunctionsSuite.scala    | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git 
a/backends-velox/src/main/scala/org/apache/gluten/extension/HLLRewriteRule.scala
 
b/backends-velox/src/main/scala/org/apache/gluten/extension/HLLRewriteRule.scala
index 7bae64ff8..2b17cbfd6 100644
--- 
a/backends-velox/src/main/scala/org/apache/gluten/extension/HLLRewriteRule.scala
+++ 
b/backends-velox/src/main/scala/org/apache/gluten/extension/HLLRewriteRule.scala
@@ -58,7 +58,7 @@ case class HLLRewriteRule(spark: SparkSession) extends 
Rule[LogicalPlan] {
     // be parsed by velox, it would cause the error: 'Unexpected type of HLL'.
     dataType match {
       case BooleanType | ByteType | ShortType | IntegerType | LongType | 
FloatType | DoubleType |
-          StringType | _: CharType | _: DecimalType | DateType =>
+          StringType | _: CharType | _: DecimalType | DateType | TimestampType 
| BinaryType =>
         true
       case _ => false
     }
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 992106d13..270334011 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
@@ -26,6 +26,8 @@ import org.apache.spark.sql.functions._
 import org.apache.spark.sql.internal.SQLConf
 import org.apache.spark.sql.types._
 
+import java.sql.Timestamp
+
 abstract class VeloxAggregateFunctionsSuite extends 
VeloxWholeStageTransformerSuite {
 
   protected val rootPath: String = getClass.getResource("/").getPath
@@ -565,6 +567,18 @@ abstract class VeloxAggregateFunctionsSuite extends 
VeloxWholeStageTransformerSu
       "select approx_count_distinct(l_discount), count(distinct l_orderkey) 
from lineitem") {
       checkGlutenOperatorMatch[HashAggregateExecTransformer]
     }
+    withTempPath {
+      path =>
+        val t1 = Timestamp.valueOf("2024-08-22 10:10:10.010")
+        val t2 = Timestamp.valueOf("2014-12-31 00:00:00.012")
+        val t3 = Timestamp.valueOf("1968-12-31 23:59:59.001")
+        Seq(t1, t2, t3).toDF("t").write.parquet(path.getCanonicalPath)
+
+        
spark.read.parquet(path.getCanonicalPath).createOrReplaceTempView("view")
+        runQueryAndCompare("select approx_count_distinct(t) from view") {
+          checkGlutenOperatorMatch[HashAggregateExecTransformer]
+        }
+    }
   }
 
   test("max_by") {


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

Reply via email to