kyle-mccarthy opened a new issue, #6155:
URL: https://github.com/apache/arrow-datafusion/issues/6155

   ### Describe the bug
   
   When performing an arithmetic operation on timestamps, `now()` causes an 
error when it is used as the LHS argument. It works as expected when it is used 
at the RHS argument.
   
   ```
   Internal("If RHS of the operation is an array, then LHS also must be")
   ```
   
   ### To Reproduce
   
   The following will return and error and then panic on unwrap.
   
   ```rust
   let ctx = SessionContext::new();
   
   let df = ctx
       .sql(
           r#"
   WITH cte AS (
   SELECT now() AS dt 
   )
   SELECT now() - cte.dt FROM cte
   "#,
       )
       .await
       .unwrap();
   ```
   
   ### Expected behavior
   
   The operation should be successfully evaluated.
   
   ### Additional context
   
   The following will successfully run. Note that `now()` is the RHS arg in 
this sample.
   
   ```rust
   let ctx = SessionContext::new();
   
   let df = ctx
       .sql(
           r#"
   WITH cte AS (
   SELECT now() AS dt 
   )
   SELECT cte.dt - now() FROM cte
   "#,
       )
       .await
       .unwrap();
   ```


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