zhli1142015 commented on code in PR #6036:
URL: https://github.com/apache/incubator-gluten/pull/6036#discussion_r1635727579


##########
backends-velox/src/test/scala/org/apache/gluten/execution/ScalarFunctionsValidateSuite.scala:
##########
@@ -1077,4 +1077,25 @@ class ScalarFunctionsValidateSuite extends 
FunctionsValidateTest {
         }
     }
   }
+
+  test("PreciseTimestampConversion") {
+    withTempPath {
+      path =>
+        val df = spark
+          .sql(
+            "select * from VALUES ('A1', TIMESTAMP'2021-01-01 00:00:00'), " +
+              "('A1', TIMESTAMP'2021-01-01 00:04:30'), ('A1', 
TIMESTAMP'2021-01-01 00:06:00'), " +
+              "('A2', TIMESTAMP'2021-01-01 00:01:00') AS tab(a, b)")
+          .write
+          .parquet(path.getCanonicalPath)
+
+        
spark.read.parquet(path.getCanonicalPath).createOrReplaceTempView("string_timestamp")
+
+        runQueryAndCompare(
+          "SELECT a, window.start, window.end, count(*) as cnt FROM" +
+            " string_timestamp GROUP by a, window(b, '5 minutes') ORDER BY a, 
start;") {
+          checkGlutenOperatorMatch[ProjectExecTransformer]

Review Comment:
   Yes, below is the fallback before this change.
   ```
   (9) Project [codegen id : 2]
   Output [2]: [named_struct(start, 
knownnullable(precisetimestampconversion(((precisetimestampconversion(b#28, 
TimestampType, LongType) - CASE WHEN (((precisetimestampconversion(b#28, 
TimestampType, LongType) - 0) % 300000000) < 0) THEN 
(((precisetimestampconversion(b#28, TimestampType, LongType) - 0) % 300000000) 
+ 300000000) ELSE ((precisetimestampconversion(b#28, TimestampType, LongType) - 
0) % 300000000) END) - 0), LongType, TimestampType)), end, 
knownnullable(precisetimestampconversion((((precisetimestampconversion(b#28, 
TimestampType, LongType) - CASE WHEN (((precisetimestampconversion(b#28, 
TimestampType, LongType) - 0) % 300000000) < 0) THEN 
(((precisetimestampconversion(b#28, TimestampType, LongType) - 0) % 300000000) 
+ 300000000) ELSE ((precisetimestampconversion(b#28, TimestampType, LongType) - 
0) % 300000000) END) - 0) + 300000000), LongType, TimestampType))) AS 
window#33, a#27]
   Input [2]: [a#27, b#28]
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to