berkaysynnada commented on PR #7758:
URL: 
https://github.com/apache/arrow-datafusion/pull/7758#issuecomment-1752011933

   I've observed the problem is in `new_zero()` function while defining the 
target node for timestamps.
   
   
https://github.com/apache/arrow-datafusion/blob/3d1b23a04bdc04c526e2dcb06e0cf1995707587d/datafusion/common/src/scalar.rs#L836-L845
   
   x>y is reformed as x-y>0, and (x-y) node is assigned with a new interval of 
[0, inf). However, `new_zero()` of `ScalarValue::Duration`'s are set as None, I 
don't know why these are left in that way but I believe they need to be set as 
`Some(0)`, similar to other types.
   
   ```
               DataType::Duration(TimeUnit::Second) => 
ScalarValue::DurationSecond(None),
               DataType::Duration(TimeUnit::Millisecond) => {
                   ScalarValue::DurationMillisecond(Some(0))
               }
               DataType::Duration(TimeUnit::Microsecond) => {
                   ScalarValue::DurationMicrosecond(Some(0))
               }
               DataType::Duration(TimeUnit::Nanosecond) => {
                   ScalarValue::DurationNanosecond(Some(0))
               }
   ```
   
   I think no additional implementation is needed to handle timestamp cases. 
When I applied these changes, the test mentioned in the issue passed 
successfully. 


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