PHILO-HE commented on code in PR #10248:
URL: 
https://github.com/apache/incubator-gluten/pull/10248#discussion_r2241643041


##########
gluten-flink/ut/src/test/java/org/apache/gluten/table/runtime/stream/custom/ScalarFunctionsTest.java:
##########
@@ -169,4 +172,28 @@ void testDecimal() {
     query = "select b + e as x from tblDecimal where a > 0";
     runAndCheck(query, Arrays.asList("+I[2.0]", "+I[5.0]", "+I[7.0]"));
   }
+
+  @Test
+  void testDateFormat() {
+    List<Row> rows =
+        Arrays.asList(Row.of(1, "2024-12-31 12:12:12"), Row.of(2, "2025-02-28 
12:12:12"));
+    createSimpleBoundedValuesTable("dateFormatTbl", "a int, b string", rows);
+    String query =
+        "select a, DATE_FORMAT(cast(b as Timestamp(3)), 'yyyy-MM-dd'), 
DATE_FORMAT(cast(b as Timestamp(3)), 'yyyy-MM-dd HH:mm:ss') from dateFormatTbl";
+    runAndCheck(
+        query,
+        Arrays.asList(
+            "+I[1, 2024-12-31, 2024-12-31 12:12:12]", "+I[2, 2025-02-28, 
2025-02-28 12:12:12]"));
+    Map<String, String> configs =
+        Map.of(
+            VeloxQueryConfig.ADJUST_TIMESTMP_TO_SESSION_TIMEZONE.key(),
+            "true",
+            TableConfigOptions.LOCAL_TIME_ZONE.key(),
+            "America/Los_Angeles");

Review Comment:
   @KevinyhZou, it may not well test the behavior of date_format function on 
respecting timezone.
   
   Could you confirm if the suggestion below makes sense?
   
   1. Set timezone to UTC
   `CREATE TEMPRARY VIEW my_view AS SELECT CAST(b AS TIMESTAMP) as c1 FROM tbl;`
   
   2. Set timezone to "America/Los_Angeles"
   `SELECT date_format(c1) FROM my_view;`
   Check the result to see if it matches the expected string (-8 hours offset, 
compared with the string column b).
   
   3. Set timezone to "Asia/Shanghai"
   `SELECT date_format(c1) FROM my_view;`
   Check the result to see if it matches the expected string (+8 hours offset, 
compared with the string column b).
   
   
   
   



-- 
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