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:15:01 UTC

[GitHub] [arrow-rs] alamb opened a new issue, #3962: Support Date32/Date64 minus Interval

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

   **Is your feature request related to a problem or challenge? Please describe what you are trying to do.**
   One may like to find out "2 days ago" by computing a date - Interval.
   
   while adding Date to intervals *is* supported, subtracting is not
   
   **Describe the solution you'd like**
   I would like `subtract_dyn` not to panic:
   
   ```rust
   fn add_interval_date() {
       let arr = Arc::new(Date32Array::from(vec![
           1_000_000,
       ])) as ArrayRef;
   
       // Would like to add and subtract intervals:
   
       // would like to add and substract 1 day
       let interval_array = Arc::new(IntervalDayTimeArray::from(vec![
           Some(IntervalDayTimeType::make_value(0, 1)),
       ])) as ArrayRef;
   
       // input:
       // +------------+
       // | input      |
       // +------------+
       // | 4707-11-29 |
       // +------------+
       println!(
           "input:\n{}",
           pretty_format_columns("input", &[arr.clone()]).unwrap()
       );
   
       // interval:
       // +-------------------------------------------------+
       // | interval                                        |
       // +-------------------------------------------------+
       // | 0 years 0 mons 0 days 0 hours 0 mins 0.001 secs |
       // +-------------------------------------------------+
       println!(
           "interval:\n{}",
           pretty_format_columns("interval", &[interval_array.clone()]).unwrap()
       );
   
   
       // add:
       // +------------+
       // | out        |
       // +------------+
       // | 4707-11-29 |
       // +------------+
       let new_arr = add_dyn(&arr, interval_array.as_ref()).unwrap();
       println!(
           "add:\n{}",
           pretty_format_columns("out", &[new_arr]).unwrap()
       );
   
       // panics"
       // thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: CastError("Unsupported data type Date32, Interval(DayTime)")', src/main.rs:154:63
       let new_arr = subtract_dyn(&arr, interval_array.as_ref()).unwrap();
       println!(
           "sub:\n{}",
           pretty_format_columns("out", &[new_arr]).unwrap()
       );
   }
   ```
   
   **Describe alternatives you've considered**
   <!--
   A clear and concise description of any alternative solutions or features you've considered.
   -->
   
   **Additional context**
   <!--
   Add any other context or screenshots about the feature request 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: github-unsubscribe@arrow.apache.org.apache.org

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


[GitHub] [arrow-rs] alamb commented on issue #3962: Support Date32/Date64 minus Interval

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

   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] SinanGncgl commented on issue #3962: Support Date32/Date64 minus Interval

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

   Hi, I would like to take this if it is okay for you? Thank you. 


-- 
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] tustvold closed issue #3962: Support Date32/Date64 minus Interval

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold closed issue #3962: Support Date32/Date64 minus Interval
URL: https://github.com/apache/arrow-rs/issues/3962


-- 
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] SinanGncgl commented on issue #3962: Support Date32/Date64 minus Interval

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

   I linked a pr so that you can review and I can fix if you want any changes, thank you!


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