You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2023/03/27 17:27:35 UTC

[GitHub] [arrow-rs] alamb opened a new issue, #3963: Support `Timestamp` `+`/`-` `Interval` types

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

   **Is your feature request related to a problem or challenge? Please describe what you are trying to do.**
   In DataFusion we would like to add and subtract timestamps. While we currently support this for scalar (singular) values we don't support it for arrays. 
   
   So like
   ```sql
   select * from foo where now() - INTERVAL '1 day' 
   ```
   
   will work
   
   ```sql
   select * from foo where now() > foo.time + foo.sale_duration
   ```
    (aka add `time` column to a `Interval` column)
   
   **Describe the solution you'd like**
   I would like the `add_dyn` and `subtract_dyn` kernels to handle
   
   `Timestamp(Second, ..)` + `Interval(YearMonth)`
   `Timestamp(Second, ..)` + `Interval(DayTime)`
   `Timestamp(Second, ..)` + `Interval(MonthDayNano)`
   
   `Timestamp(Millisecond, ..)` + `Interval(YearMonth)`
   `Timestamp(Millisecond, ..)` + `Interval(DayTime)`
   `Timestamp(Millisecond, ..)` + `Interval(MonthDayNano)`
   
   `Timestamp(MicroSecond, ..)` + `Interval(YearMonth)`
   `Timestamp(Microsecond, ..)` + `Interval(DayTime)`
   `Timestamp(Microsecond, ..)` + `Interval(MonthDayNano)`
   
   `Timestamp(Nanosecond, ..)` + `Interval(YearMonth)`
   `Timestamp(Nanosecond, ..)` + `Interval(DayTime)`
   `Timestamp(Nanosecond, ..)` + `Interval(MonthDayNano)`
   
   **Describe alternatives you've considered**
   <!--
   A clear and concise description of any alternative solutions or features you've considered.
   -->
   
   **Additional context**
   Here is the support for `Date + Interval` -- we should be able to follow much the same pattern for `Timestamp + interval` and `Timestamp - Interval`: 
   
   https://github.com/apache/arrow-rs/blob/9bd2bae586ed5b0edfd699f89a0855d79f61b611/arrow-arith/src/arithmetic.rs#L694-L740
   
   


-- 
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: github-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-rs] Weijun-H commented on issue #3963: Support `Timestamp` `+`/`-` `Interval` types

Posted by "Weijun-H (via GitHub)" <gi...@apache.org>.
Weijun-H commented on issue #3963:
URL: https://github.com/apache/arrow-rs/issues/3963#issuecomment-1500955520

   > If an overflow occurs (e.g. an Interval(DayTime) is added to Timestamp(Nanosecond) that goes beyond the range of i64 in nanoseconds), an error would be raised
   
   This seems to be the job done by `add_dyn_checked ` not `add_dyn`. We should check the overflow in `add_dyn_checked`. 


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-rs] alamb closed issue #3963: Support `Timestamp` `+`/`-` `Interval` types

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb closed issue #3963: Support  `Timestamp` `+`/`-` `Interval` types
URL: https://github.com/apache/arrow-rs/issues/3963


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-rs] Weijun-H commented on issue #3963: Support `Timestamp` `+`/`-` `Interval` types

Posted by "Weijun-H (via GitHub)" <gi...@apache.org>.
Weijun-H commented on issue #3963:
URL: https://github.com/apache/arrow-rs/issues/3963#issuecomment-1499396060

   If no one else is currently assigned to this task, I would be happy to take ownership of this ticket and work on it.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-rs] alamb commented on issue #3963: Support `Timestamp` `+`/`-` `Interval` types

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on issue #3963:
URL: https://github.com/apache/arrow-rs/issues/3963#issuecomment-1485643879

   I think this is a good first issue because the semantics are well defined and there are some existing examples


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-rs] alamb commented on issue #3963: Support `Timestamp` `+`/`-` `Interval` types

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on issue #3963:
URL: https://github.com/apache/arrow-rs/issues/3963#issuecomment-1500161883

   Thanks @Weijun-H  -- that would be great!


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org