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

   ### Is your feature request related to a problem or challenge?
   
   After changing the resulting datatype of **timestamp - timestamp** 
operations from **time interval** to **duration**, we may encounter a scenario 
like this in the constraint propagation algorithm:
   
   **Parent Node**: Timestamp
   **Left Node**: Timestamp - **Operator**: Plus - **Right Node**: Interval
   
   In this case, when we propagate to the right child, we subtract the updated 
value of the left child from the parent and then intersect it with the right 
child. During this intersection operation, one of the interval types is a time 
interval, and the other one is a duration, causing problems in the interval 
library. Similar issues may arise in different placements like this.
   
   We want to provide this support in order not to deprive users of using 
values such as `1 month` in filters.
   
   ### Describe the solution you'd like
   
   In the `propagate_arithmetic` function (also in `propagate_comparison`), if 
there is a time interval child, we follow such a path:
   
   **a.** If the time interval is a singleton, we do not need to propagate over 
it. We leave it unchanged and only propagate to the other child.
   
   **b.** If the time interval is a columnar data, we check its interval type. 
If it contains a month field, we can return an error because we can't 
accurately convert it to a duration type without a valid timestamp reference 
(this check can be performed in one of the outer scopes). Otherwise, we simply 
convert the time interval type to a duration type, and after the propagation, 
we convert the duration back to the time interval type again.
   
   ### Describe alternatives you've considered
   
   _No response_
   
   ### 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