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

   **Describe the bug**
   Comparing a `Timestamp` to a `Date32` fails.
   
   **To Reproduce**
   Add the following test to 
[`timestamps.slt`](https://github.com/apache/arrow-datafusion/blob/5c558e9f6b3fe29ef0d5f78ec9465852d020d989/datafusion/core/tests/sqllogictests/test_files/timestamps.slt#L3):
   
   ```
   # Test that we can compare a timestamp to a string casted to a date
   query C rowsort
   select * from foo where ts > '2000-01-01'::date;
   ----
   2 2000-02-01T00:00:00
   3 2000-03-01T00:00:00
   ```
   
   This fails w/:
   
   ```
   [timestamps.slt] Running query: "select * from foo where ts > 
'2000-01-01'::date;"
   Error: SqlLogicTest(query failed: DataFusion error: Internal error: The type 
of Timestamp(Nanosecond, None) > Date32 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
   ```
   
   **Expected behavior**
   It works.
   
   **Additional context**
   Tested on 
https://github.com/apache/arrow-datafusion/commit/5c558e9f6b3fe29ef0d5f78ec9465852d020d989
 .
   
   This is likely due to a like in 
[`temporal_coercion`](https://github.com/apache/arrow-datafusion/blob/5c558e9f6b3fe29ef0d5f78ec9465852d020d989/datafusion/expr/src/type_coercion/binary.rs#L539-L539)
 as well as this workaround:
   
   
https://github.com/apache/arrow-datafusion/blob/5c558e9f6b3fe29ef0d5f78ec9465852d020d989/datafusion/optimizer/src/type_coercion.rs#L232-L239
   
   Also see #3419.
   


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