sadboy commented on code in PR #18356:
URL: https://github.com/apache/datafusion/pull/18356#discussion_r2476027904


##########
datafusion/sqllogictest/test_files/timestamps.slt:
##########
@@ -1687,6 +1687,13 @@ SELECT DATE_TRUNC('second', '2022-08-03 14:38:50Z');
 ----
 2022-08-03T14:38:50
 
+# DATE_TRUNC handling of times before the unix epoch (issue 18334)
+query PPP
+SELECT d, DATE_TRUNC('hour', d), DATE_TRUNC('hour', TIMESTAMP '1900-06-15 
07:09:00')
+FROM (VALUES (TIMESTAMP '1900-06-15 07:09:00')) AS t(d);

Review Comment:
   Let's test the whole lot:
   ```suggestion
   select d as datetime,
          DATE_TRUNC('year', d) as year,
          DATE_TRUNC('quarter', d) as quarter,
          DATE_TRUNC('month', d) as month,
          DATE_TRUNC('week', d) as week,
          DATE_TRUNC('day', d) as day,
          DATE_TRUNC('hour', d) as hour,
          DATE_TRUNC('minute', d) as minute,
          DATE_TRUNC('second', d) as second
          DATE_TRUNC('microsecond', d) as microsecond
          DATE_TRUNC('millisecond', d) as millisecond
   from (values (timestamp '1900-06-15 07:31:23'),
                (timestamp '1970-07-14 03:10:59'),
                (timestamp '2024-12-31 23:39:01')) as T(d)
   ```



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