alamb opened a new issue, #5650:
URL: https://github.com/apache/arrow-datafusion/issues/5650

   **Describe the bug**
   I ran a query and got an internal error
   
   **To Reproduce**
   Using `datafusion-cli`:
   
   ```sql
   ❯ create table foo(x timestamp) as select '2023-03-01'::timestamp;
   0 rows in set. Query took 0.002 seconds.
   ❯ select * from foo;
   +---------------------+
   | x                   |
   +---------------------+
   | 2023-03-01T00:00:00 |
   +---------------------+
   1 row in set. Query took 0.001 seconds.
   ❯ select * from foo where x < now() - '1 day';
   The type of Timestamp(Nanosecond, Some("+00:00")) Minus Utf8 of binary 
physical should be same. This was likely caused by a bug in DataFusion's code 
and we would welcome that you file an bug report in our issue tracker
   ```
   
   Note it is possible to use the `interval` syntax things work out correctly
   
   ```
   ❯ select * from foo where x < now() - interval '1 day';
   +---------------------+
   | x                   |
   +---------------------+
   | 2023-03-01T00:00:00 |
   +---------------------+
   ```
   
   Note if you try to use the same predicate outside of the where clause, we 
get a planning error (correctly):
   ```
   ❯ select now()  - '1 day';
   Error during planning: 'Timestamp(Nanosecond, Some("+00:00")) - Utf8' can't 
be evaluated because there isn't a common type to coerce the types to
   ```
   
   **Expected behavior**
   1. (minimum) `select * from foo where x < now() - '1 day';` should produce a 
planning error (rather than an internal error)
   2. (ideal) Make the query work
   
   **Additional context**
   <!--
   Add any other context about the problem here.
   -->
   


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