Apache DataFusion SQL Query Engine
Add tests for coercion of timestamps to strings (#4545)
Andrew Lamb9d30479fe0db
diff --git a/datafusion/core/tests/sqllogictests/test_files/timestamps.slt b/datafusion/core/tests/sqllogictests/test_files/timestamps.sltnew file mode 100644index 0000000000..f4d627df45--- /dev/null+++ b/datafusion/core/tests/sqllogictests/test_files/timestamps.slt@@ -0,0 +1,66 @@+# Licensed to the Apache Software Foundation (ASF) under one+# or more contributor license agreements. See the NOTICE file+# distributed with this work for additional information+# regarding copyright ownership. The ASF licenses this file+# to you under the Apache License, Version 2.0 (the+# "License"); you may not use this file except in compliance+# with the License. You may obtain a copy of the License at++# http://www.apache.org/licenses/LICENSE-2.0++# Unless required by applicable law or agreed to in writing,+# software distributed under the License is distributed on an+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+# KIND, either express or implied. See the License for the+# specific language governing permissions and limitations+# under the License.++##########+## Timestamp Handling Tests+##########++statement ok+create table foo (val int, ts timestamp) as values (1, '2000-01-01T00:00:00'::timestamp), (2, '2000-02-01T00:00:00'::timestamp), (3, '2000-03-01T00:00:00'::timestamp);++query C rowsort+select * from foo;+----+1 2000-01-01T00:00:00.000000000+2 2000-02-01T00:00:00.000000000+3 2000-03-01T00:00:00.000000000++# Test that we can compare a timestamp to a casted string+query C rowsort+select * from foo where ts > '2000-01-01T00:00:00'::timestamp;+----+2 2000-02-01T00:00:00.000000000+3 2000-03-01T00:00:00.000000000++# Test that we can compare a timestamp to a string and it will be coerced+query C rowsort+select * from foo where ts > '2000-01-01T00:00:00';+----+2 2000-02-01T00:00:00.000000000+3 2000-03-01T00:00:00.000000000++query C rowsort+select * from foo where ts < '2000-02-01T00:00:00';+----+1 2000-01-01T00:00:00.000000000++query C rowsort+select * from foo where ts <= '2000-02-01T00:00:00';+----+1 2000-01-01T00:00:00.000000000+2 2000-02-01T00:00:00.000000000++query C rowsort+select * from foo where ts = '2000-02-01T00:00:00';+----+2 2000-02-01T00:00:00.000000000++query C rowsort+select * from foo where ts != '2000-02-01T00:00:00';+----+1 2000-01-01T00:00:00.000000000+3 2000-03-01T00:00:00.000000000