Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic on date_bin with interval 0 #6517

Closed
NGA-TRAN opened this issue Jun 1, 2023 · 2 comments
Closed

Panic on date_bin with interval 0 #6517

NGA-TRAN opened this issue Jun 1, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@NGA-TRAN
Copy link
Contributor

NGA-TRAN commented Jun 1, 2023

Describe the bug

If the interval of the date_bin function is 0, the query will hit panic

To Reproduce

Run the queries below in DataFusion CLI

DataFusion CLI v25.0.0SELECT DATE_BIN(INTERVAL '0 second', TIMESTAMP '2022-08-03 14:38:50Z');
thread 'main' panicked at 'attempt to calculate the remainder with a divisor of zero',  /arrow-datafusion/datafusion/physical-expr/src/datetime_expressions.rs:354:34
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

❯ SELECT DATE_BIN(INTERVAL '0 day', TIMESTAMP '2022-08-03 14:38:50Z');
thread 'main' panicked at 'attempt to calculate the remainder with a divisor of zero', /arrow-datafusion/datafusion/physical-expr/src/datetime_expressions.rs:354:34
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

SELECT
  DATE_BIN(INTERVAL '0' minute, time) AS time,
  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);
thread 'tokio-runtime-worker' panicked at 'attempt to calculate the remainder with a divisor of zero', /arrow-datafusion/datafusion/physical-expr/src/datetime_expressions.rs:354:34
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
0 rows in set. Query took 0.012 seconds.

Expected behavior

A normal error message rather than a panic. Something like "interval 0 is not supported in date_bin`

Additional context

No response

@NGA-TRAN NGA-TRAN added the bug Something isn't working label Jun 1, 2023
@NGA-TRAN
Copy link
Contributor Author

NGA-TRAN commented Jun 1, 2023

@alamb I am working on this

@NGA-TRAN
Copy link
Contributor Author

NGA-TRAN commented Jun 6, 2023

Close this as the fixed #6522 is merged

@NGA-TRAN NGA-TRAN closed this as completed Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant