olivrlee commented on code in PR #3023:
URL: https://github.com/apache/calcite/pull/3023#discussion_r1072911432
##########
babel/src/test/resources/sql/big-query.iq:
##########
@@ -1097,12 +1097,74 @@ select unix_date(datetime '2008-12-25') as d;
#
# Return Data Type: DATE
-select date(2022, 11, 15) as d;
-+------------+
-| d |
-+------------+
-| 2022-11-15 |
-+------------+
+select date(2022, 11, 15) as d1,
+ date(datetime "2008-01-01 01:03:05") as d2,
+ date(datetime(2008, 1, 1, 1, 3, 5)) as d3;
++------------+------------+------------+
+| d1 | d2 | d3 |
++------------+------------+------------+
+| 2022-11-15 | 2008-01-01 | 2008-01-01 |
++------------+------------+------------+
+(1 row)
+
+!ok
+
+# Test timezone conversion when converting TIMESTAMP to DATE.
+# Denver observes DST whereas Phoenix does not.
+# Both cities have a -07:00 offset in winter, but Denver has -06:00 in summer.
+select date(timestamp("2008-06-21 06:30:00")) as sum_utc,
+ date(timestamp("2008-06-21 06:30:00"), "America/Denver") as sum_dst,
+ date(timestamp("2008-06-21 06:30:00"), "America/Phoenix") as sum_std,
+ date(timestamp("2008-12-21 06:30:00")) as win_utc,
+ date(timestamp("2008-12-21 06:30:00"), "America/Denver") as win_dst,
+ date(timestamp("2008-12-21 06:30:00"), "America/Phoenix") as win_std;
++------------+------------+------------+------------+------------+------------+
+| sum_utc | sum_dst | sum_std | win_utc | win_dst | win_std |
++------------+------------+------------+------------+------------+------------+
+| 2008-06-21 | 2008-06-21 | 2008-06-20 | 2008-12-21 | 2008-12-20 | 2008-12-20 |
++------------+------------+------------+------------+------------+------------+
+(1 row)
+
+!ok
+
+#####################################################################
+# DATETIME
Review Comment:
there's a set of DATETIME tests currently disabled around line 650 btw
https://github.com/apache/calcite/blob/6e5b2f22414b1c1617d0e721d6dcf93f1b82d673/babel/src/test/resources/sql/big-query.iq#L649
--
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]