Skip to content

Apache DataFusion SQL Query Engine

test: `to_timestamp(double)` for vectorized input (#18147)

Khanh Duonge323357b1e24
diff --git a/datafusion/sqllogictest/test_files/timestamps.slt b/datafusion/sqllogictest/test_files/timestamps.slt
index 38b599260d..ebc79533f1 100644
--- a/datafusion/sqllogictest/test_files/timestamps.slt
+++ b/datafusion/sqllogictest/test_files/timestamps.slt
@@ -525,6 +525,29 @@ SELECT to_timestamp(123456789.123456789) as c1, cast(123456789.123456789 as time
----
1973-11-29T21:33:09.123456784 1970-01-01T00:00:00.123456789 1970-01-01T00:00:00.123456789
+## to_timestamp float vectorized inputs
+query PPP
+SELECT
+ to_timestamp(x) as c1,
+ cast(x as timestamp) as c2,
+ x::timestamp as c3
+FROM (
+ VALUES
+ (1.1),
+ (-1.1),
+ (0.0),
+ (1.23456789),
+ (123456789.123456789),
+ (NULL)
+) t(x);
+----
+1970-01-01T00:00:01.100 1970-01-01T00:00:00.000000001 1970-01-01T00:00:00.000000001
+1969-12-31T23:59:58.900 1969-12-31T23:59:59.999999999 1969-12-31T23:59:59.999999999
+1970-01-01T00:00:00 1970-01-01T00:00:00 1970-01-01T00:00:00
+1970-01-01T00:00:01.234567890 1970-01-01T00:00:00.000000001 1970-01-01T00:00:00.000000001
+1973-11-29T21:33:09.123456784 1970-01-01T00:00:00.123456789 1970-01-01T00:00:00.123456789
+NULL NULL NULL
+
# to_timestamp Decimal128 inputs
query PPP