NGA-TRAN opened a new issue, #6517:
URL: https://github.com/apache/arrow-datafusion/issues/6517

   ### 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
   ```SQL
   DataFusion CLI v25.0.0
   ❯ SELECT 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_


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to