Skip to content

Commit

Permalink
Minor: Add test for date_trunc schema on scalars (#6655)
Browse files Browse the repository at this point in the history
* Minor: Add test for date_trunc schema on scalars

* Add rowsort
  • Loading branch information
alamb authored Jun 13, 2023
1 parent 3fc009b commit d602de2
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion datafusion/core/tests/sqllogictests/test_files/timestamps.slt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand 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




Expand Down

0 comments on commit d602de2

Please sign in to comment.