You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "NGA-TRAN (via GitHub)" <gi...@apache.org> on 2023/06/01 18:53:30 UTC

[GitHub] [arrow-datafusion] NGA-TRAN commented on a diff in pull request #6522: fix: error instead of panic when date_bin interval is 0

NGA-TRAN commented on code in PR #6522:
URL: https://github.com/apache/arrow-datafusion/pull/6522#discussion_r1213550891


##########
datafusion/core/tests/sqllogictests/test_files/timestamps.slt:
##########
@@ -392,11 +392,28 @@ drop table ts_data_millis
 statement ok
 drop table ts_data_secs
 
-
-
 ##########
 ## test date_bin function
 ##########
+
+# not support interval 0
+statement error Execution error: DATE_BIN stride must be non-zero and positive
+SELECT DATE_BIN(INTERVAL '0 second', TIMESTAMP '2022-08-03 14:38:50.000000006Z', TIMESTAMP '1970-01-01T00:00:00Z')
+
+statement error Execution error: DATE_BIN stride must be non-zero and positive
+SELECT DATE_BIN(INTERVAL '0 month', TIMESTAMP '2022-08-03 14:38:50.000000006Z')
+
+statement error Execution error: DATE_BIN stride must be non-zero and positive
+SELECT
+  DATE_BIN(INTERVAL '0' minute, time) AS time,
+  count(val)
+FROM (
+  VALUES
+    (TIMESTAMP '2021-06-10 17:05:00Z', 0.5),
+    (TIMESTAMP '2021-06-10 17:19:10Z', 0.3)
+  ) as t (time, val)
+group by time;

Review Comment:
   I remember @alamb want just right number of tests, I think these 3 tests are good to capture 2 different forms of stride on constant (second --> nanosecond in the code, and month ->  month) and an aggregate on data.
   



-- 
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