@@ -1794,17 +1794,23 @@ SELECT to_timestamp(null), to_timestamp(0), to_timestamp(1926632005), to_timesta
17941794----
17951795NULL 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 with integer input timestamp literal syntax
1798- query PPPPPP
1799- SELECT null::timestamp, 0::timestamp, 1926632005::timestamp, 1::timestamp, -1::timestamp, (0-1)::timestamp
1800- ----
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
1802-
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)
1806- ----
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
1797+ # verify timestamp syntax stlyes are consistent
1798+ query BBBBBBBBBBBBB
1799+ SELECT to_timestamp(null) is null as c1,
1800+ null::timestamp is null as c2,
1801+ cast(null as timestamp) is null as c3,
1802+ to_timestamp(0) = 0::timestamp as c4,
1803+ to_timestamp(1926632005) = 1926632005::timestamp as c5,
1804+ to_timestamp(1) = 1::timestamp as c6,
1805+ to_timestamp(-1) = -1::timestamp as c7,
1806+ to_timestamp(0-1) = (0-1)::timestamp as c8,
1807+ to_timestamp(0) = cast(0 as timestamp) as c9,
1808+ to_timestamp(1926632005) = cast(1926632005 as timestamp) as c10,
1809+ to_timestamp(1) = cast(1 as timestamp) as c11,
1810+ to_timestamp(-1) = cast(-1 as timestamp) as c12,
1811+ to_timestamp(0-1) = cast(0-1 as timestamp) as c13
1812+ ----
1813+ true true true true true true true true true true true true true
18081814
18091815# verify timestamp output types
18101816query TTT
@@ -1813,17 +1819,15 @@ SELECT arrow_typeof(to_timestamp(1)), arrow_typeof(to_timestamp(null)), arrow_ty
18131819Timestamp(Nanosecond, None) Timestamp(Nanosecond, None) Timestamp(Nanosecond, None)
18141820
18151821# 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-
1822+ query BBBBBB
1823+ SELECT arrow_typeof(to_timestamp(1)) = arrow_typeof(1::timestamp) as c1,
1824+ arrow_typeof(to_timestamp(null)) = arrow_typeof(null::timestamp) as c2,
1825+ arrow_typeof(to_timestamp('2023-01-10 12:34:56.000')) = arrow_typeof('2023-01-10 12:34:56.000'::timestamp) as c3,
1826+ arrow_typeof(to_timestamp(1)) = arrow_typeof(cast(1 as timestamp)) as c4,
1827+ arrow_typeof(to_timestamp(null)) = arrow_typeof(cast(null as timestamp)) as c5,
1828+ arrow_typeof(to_timestamp('2023-01-10 12:34:56.000')) = arrow_typeof(cast('2023-01-10 12:34:56.000' as timestamp)) as c6
1829+ ----
1830+ true true true true true true
18271831
18281832# known issues. currently overflows (expects default precision to be microsecond instead of nanoseconds. Work pending)
18291833#verify extreme values
0 commit comments