@@ -1788,20 +1788,45 @@ SELECT TIMESTAMPTZ '2020-01-01 00:00:00Z' = TIMESTAMP '2020-01-01'
17881788----
17891789true
17901790
1791- # verify to_timestamp edge cases to be in sync with postgresql
1792- query PPPPPPPP
1793- SELECT to_timestamp(null), to_timestamp(-62125747200), to_timestamp(0), to_timestamp(1926632005177 ), to_timestamp(1926632005), to_timestamp(1), to_timestamp(-1), to_timestamp(0-1)
1791+ # verify timestamp cast with integer input
1792+ query PPPPPP
1793+ SELECT to_timestamp(null), to_timestamp(0 ), to_timestamp(1926632005), to_timestamp(1), to_timestamp(-1), to_timestamp(0-1)
17941794----
1795- NULL 0001-04-25T00:00:00 1970-01-01T00:00:00 +63022-07-16T12:59:37 2031-01-19T23:33:25 1970-01-01T00:00:01 1969-12-31T23:59:59 1969-12-31T23:59:59
1795+ 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
17961796
1797- # verify timestamp cast from i64 is in sync with to_timestamp(i64)
1798- query PPPPPPPP
1799- SELECT null::timestamp, -62125747200::timestamp, 0::timestamp, 1926632005177 ::timestamp, 1926632005::timestamp, 1::timestamp, -1::timestamp, (0-1)::timestamp
1797+ # verify timestamp cast with integer input timestamp literal syntax
1798+ query PPPPPP
1799+ SELECT null::timestamp, 0 ::timestamp, 1926632005::timestamp, 1::timestamp, -1::timestamp, (0-1)::timestamp
18001800----
1801- NULL 0001-04-25T00:00:00 1970-01-01T00:00:00 +63022-07-16T12:59:37 2031-01-19T23:33:25 1970-01-01T00:00:01 1969-12-31T23:59:59 1969-12-31T23:59:59
1801+ 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
18021802
1803- # verify timestamp cast from i64 is in sync with to_timestamp(i64) using CAST syntax
1804- query PPPPPPPP
1805- SELECT cast(null as timestamp), cast(-62125747200 as timestamp), cast(0 as timestamp), cast(1926632005177 as timestamp), cast(1926632005 as timestamp), cast(1 as timestamp), cast(-1 as timestamp), cast(0-1 as timestamp)
1803+ # verify timestamp cast with integer input timestamp literal syntax using CAST syntax
1804+ query PPPPPP
1805+ 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)
18061806----
1807- NULL 0001-04-25T00:00:00 1970-01-01T00:00:00 +63022-07-16T12:59:37 2031-01-19T23:33:25 1970-01-01T00:00:01 1969-12-31T23:59:59 1969-12-31T23:59:59
1807+ 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
1808+
1809+ # verify timestamp output types
1810+ query TTT
1811+ SELECT arrow_typeof(to_timestamp(1)), arrow_typeof(to_timestamp(null)), arrow_typeof(to_timestamp('2023-01-10 12:34:56.000'))
1812+ ----
1813+ Timestamp(Nanosecond, None) Timestamp(Nanosecond, None) Timestamp(Nanosecond, None)
1814+
1815+ # verify timestamp output types using timestamp literal syntax
1816+ query TTT
1817+ SELECT arrow_typeof(1::timestamp), arrow_typeof(null::timestamp), arrow_typeof('2023-01-10 12:34:56.000'::timestamp)
1818+ ----
1819+ Timestamp(Nanosecond, None) Timestamp(Nanosecond, None) Timestamp(Nanosecond, None)
1820+
1821+ # verify timestamp output types using CAST syntax
1822+ query TTT
1823+ 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))
1824+ ----
1825+ Timestamp(Nanosecond, None) Timestamp(Nanosecond, None) Timestamp(Nanosecond, None)
1826+
1827+
1828+ # verify extreme values (expects default precision to be microsecond instead of nanoseconds. Work pending)
1829+ #query PPPPPPPP
1830+ #SELECT to_timestamp(-62125747200), to_timestamp(1926632005177), -62125747200::timestamp, 1926632005177::timestamp, cast(-62125747200 as timestamp), cast(1926632005177 as timestamp)
1831+ #----
1832+ #0001-04-25T00:00:00 +63022-07-16T12:59:37 0001-04-25T00:00:00 +63022-07-16T12:59:37 0001-04-25T00:00:00 +63022-07-16T12:59:37
0 commit comments