This is an automated email from the ASF dual-hosted git repository.

alamb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git


The following commit(s) were added to refs/heads/master by this push:
     new 9d30479fe Add tests for coercion of timestamps to strings (#4545)
9d30479fe is described below

commit 9d30479fe0db2154991de01cb0d626c35fd922f7
Author: Andrew Lamb <[email protected]>
AuthorDate: Thu Dec 8 13:01:58 2022 -0500

    Add tests for coercion of timestamps to strings (#4545)
    
    * Add tests for coercion of timestamps to strings
    
    * Update datafusion/core/tests/sqllogictests/test_files/timestamps.slt
---
 .../tests/sqllogictests/test_files/timestamps.slt  | 66 ++++++++++++++++++++++
 1 file changed, 66 insertions(+)

diff --git a/datafusion/core/tests/sqllogictests/test_files/timestamps.slt 
b/datafusion/core/tests/sqllogictests/test_files/timestamps.slt
new file mode 100644
index 000000000..f4d627df4
--- /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

Reply via email to