You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "xudong963 (via GitHub)" <gi...@apache.org> on 2023/02/01 12:46:58 UTC

[GitHub] [arrow-datafusion] xudong963 commented on a diff in pull request #5115: minor: port date_bin tests to sqllogictests

xudong963 commented on code in PR #5115:
URL: https://github.com/apache/arrow-datafusion/pull/5115#discussion_r1093172382


##########
datafusion/core/tests/sqllogictests/test_files/timestamps.slt:
##########
@@ -67,3 +67,69 @@ select * from foo where ts != '2000-02-01T00:00:00';
 
 statement ok
 drop table foo;
+
+###
+## test date_bin function
+###
+query T
+SELECT DATE_BIN(INTERVAL '15 minutes', TIMESTAMP '2022-08-03 14:38:50Z', TIMESTAMP '1970-01-01T00:00:00Z') AS res
+----
+2022-08-03T14:30:00
+
+# Shift forward by 5 minutes
+query T
+SELECT DATE_BIN(INTERVAL '15 minutes', TIMESTAMP '2022-08-03 14:38:50Z', TIMESTAMP '1970-01-01T00:05:00Z') AS res
+----
+2022-08-03T14:35:00
+
+
+# Shift backward by 5 minutes
+query T
+SELECT DATE_BIN(INTERVAL '15 minutes', TIMESTAMP '2022-08-03 14:38:50Z', TIMESTAMP '1970-01-01T23:55:00Z') AS res
+----
+2022-08-03T14:25:00
+
+# origin after source, timestamp in previous bucket
+query T
+SELECT DATE_BIN(INTERVAL '15 minutes', TIMESTAMP '2022-08-03 14:38:50Z', TIMESTAMP '2022-08-03 14:40:00Z') AS res
+----
+2022-08-03T14:25:00
+
+# stride by 7 days
+query T
+SELECT DATE_BIN(INTERVAL '7 days', TIMESTAMP '2022-08-03 14:38:50Z', TIMESTAMP '1970-01-01 00:00:00Z') AS res
+----
+2022-07-28T00:00:00
+
+
+# origin shifts bins forward 1 day
+query T
+SELECT DATE_BIN(INTERVAL '7 days', TIMESTAMP '2022-08-03 14:38:50Z', TIMESTAMP '1970-01-02 00:00:00Z') AS res
+----
+2022-07-29T00:00:00
+
+
+# demonstrates array values (rather than scalar) for the source argument
+query T

Review Comment:
   ```suggestion
   query T rowsort
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org