comphead commented on code in PR #8193:
URL: https://github.com/apache/arrow-datafusion/pull/8193#discussion_r1399809339
##########
datafusion/sqllogictest/test_files/timestamps.slt:
##########
@@ -1788,8 +1788,45 @@ SELECT TIMESTAMPTZ '2020-01-01 00:00:00Z' = TIMESTAMP
'2020-01-01'
----
true
-# verify to_timestamp edge cases to be in sync with postgresql
-query PPPPP
-SELECT to_timestamp(null), to_timestamp(-62125747200), to_timestamp(0),
to_timestamp(1926632005177), to_timestamp(1926632005)
+# verify timestamp cast with integer input
+query PPPPPP
+SELECT to_timestamp(null), to_timestamp(0), to_timestamp(1926632005),
to_timestamp(1), to_timestamp(-1), to_timestamp(0-1)
----
-NULL 0001-04-25T00:00:00 1970-01-01T00:00:00 +63022-07-16T12:59:37
2031-01-19T23:33:25
+NULL 1970-01-01T00:00:00 2031-01-19T23:33:25 1970-01-01T00:00:01
1969-12-31T23:59:59 1969-12-31T23:59:59
+
+# verify timestamp cast with integer input timestamp literal syntax
+query PPPPPP
+SELECT null::timestamp, 0::timestamp, 1926632005::timestamp, 1::timestamp,
-1::timestamp, (0-1)::timestamp
+----
+NULL 1970-01-01T00:00:00 2031-01-19T23:33:25 1970-01-01T00:00:01
1969-12-31T23:59:59 1969-12-31T23:59:59
+
+# verify timestamp cast with integer input timestamp literal syntax using CAST
syntax
+query PPPPPP
+SELECT cast(null as timestamp), cast(0 as timestamp), cast(1926632005 as
timestamp), cast(1 as timestamp), cast(-1 as timestamp), cast(0-1 as timestamp)
+----
+NULL 1970-01-01T00:00:00 2031-01-19T23:33:25 1970-01-01T00:00:01
1969-12-31T23:59:59 1969-12-31T23:59:59
+
+# verify timestamp output types
+query TTT
+SELECT arrow_typeof(to_timestamp(1)), arrow_typeof(to_timestamp(null)),
arrow_typeof(to_timestamp('2023-01-10 12:34:56.000'))
+----
+Timestamp(Nanosecond, None) Timestamp(Nanosecond, None) Timestamp(Nanosecond,
None)
+
+# verify timestamp output types using timestamp literal syntax
+query TTT
+SELECT arrow_typeof(1::timestamp), arrow_typeof(null::timestamp),
arrow_typeof('2023-01-10 12:34:56.000'::timestamp)
+----
+Timestamp(Nanosecond, None) Timestamp(Nanosecond, None) Timestamp(Nanosecond,
None)
+
+# verify timestamp output types using CAST syntax
+query TTT
+SELECT arrow_typeof(cast(1 as timestamp)), arrow_typeof(cast(null as
timestamp)), arrow_typeof(cast('2023-01-10 12:34:56.000' as timestamp))
+----
+Timestamp(Nanosecond, None) Timestamp(Nanosecond, None) Timestamp(Nanosecond,
None)
+
+
+# verify extreme values (expects default precision to be microsecond instead
of nanoseconds. Work pending)
Review Comment:
Ive intentionally added this test to be uncommented once we figure out the
overflow solution
--
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]