You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by al...@apache.org on 2023/06/13 01:28:56 UTC

[arrow-datafusion] branch main updated: Minor: Add test for date_trunc schema on scalars (#6655)

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

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


The following commit(s) were added to refs/heads/main by this push:
     new d602de2ebc Minor: Add test for date_trunc schema on scalars (#6655)
d602de2ebc is described below

commit d602de2ebc741a5f7042c9e474cb2105a585541a
Author: Andrew Lamb <an...@nerdnetworks.org>
AuthorDate: Mon Jun 12 21:28:51 2023 -0400

    Minor: Add test for date_trunc schema on scalars (#6655)
    
    * Minor: Add test for date_trunc schema on scalars
    
    * Add rowsort
---
 .../core/tests/sqllogictests/test_files/timestamps.slt  | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/datafusion/core/tests/sqllogictests/test_files/timestamps.slt b/datafusion/core/tests/sqllogictests/test_files/timestamps.slt
index e90fb3bc7b..8ccb863f31 100644
--- a/datafusion/core/tests/sqllogictests/test_files/timestamps.slt
+++ b/datafusion/core/tests/sqllogictests/test_files/timestamps.slt
@@ -907,7 +907,7 @@ SELECT DATE_TRUNC('SECOND', TIMESTAMP '2022-08-03 14:38:50Z');
 ----
 2022-08-03T14:38:50
 
-# Test date trunc on different timestamp types
+# Test date trunc on different timestamp types and ensure types are consistent
 query TP rowsort
 SELECT 'ts_data_nanos', DATE_TRUNC('day', ts) FROM ts_data_nanos
  UNION ALL
@@ -930,6 +930,21 @@ ts_data_secs 2020-09-08T00:00:00
 ts_data_secs 2020-09-08T00:00:00
 ts_data_secs 2020-09-08T00:00:00
 
+# test date trunc on different timestamp scalar types and ensure they are consistent
+query P rowsort
+SELECT DATE_TRUNC('second', arrow_cast(TIMESTAMP '2023-08-03 14:38:50Z', 'Timestamp(Second, None)')) as ts
+  UNION ALL
+SELECT DATE_TRUNC('second', arrow_cast(TIMESTAMP '2023-08-03 14:38:50Z', 'Timestamp(Nanosecond, None)')) as ts
+  UNION ALL
+SELECT DATE_TRUNC('day', arrow_cast(TIMESTAMP '2023-08-03 14:38:50Z', 'Timestamp(Microsecond, None)')) as ts
+  UNION ALL
+SELECT DATE_TRUNC('day', arrow_cast(TIMESTAMP '2023-08-03 14:38:50Z', 'Timestamp(Millisecond, None)')) as ts
+----
+2023-08-03T00:00:00
+2023-08-03T00:00:00
+2023-08-03T14:38:50
+2023-08-03T14:38:50
+