You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "tustvold (via GitHub)" <gi...@apache.org> on 2023/06/28 16:39:28 UTC

[GitHub] [arrow-rs] tustvold opened a new issue, #4457: Timestamp Interval Arithmetic Ignores Timezone

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

   **Is your feature request related to a problem or challenge? Please describe what you are trying to do.**
   <!--
   A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 
   (This section helps Arrow developers understand the context and *why* for this feature, in addition to  the *what*)
   -->
   
   The timestamp arithmetic added in #4038 fails to correctly account for timezones
   
   ```
   #[test]
   fn test_timezone_interval() {
       let tz_str = "-01:00";
       let tz: Tz = tz_str.parse().unwrap();
   
       let array =
           TimestampNanosecondArray::from(vec![2419200000000000]).with_timezone(tz_str);
   
       let value = array.value_as_datetime_with_tz(0, tz).unwrap();
       assert_eq!(value.to_rfc3339(), "1970-01-28T23:00:00-01:00");
   
       // Add 1 month
       let interval = IntervalYearMonthArray::from(vec![1]);
       let date = add_dyn(&array, &interval).unwrap();
       let output = date.as_primitive::<TimestampNanosecondType>();
   
       let value = output.value_as_datetime_with_tz(0, tz).unwrap();
       assert_eq!(value.to_rfc3339(), "1970-02-28T23:00:00-01:00");
   }
   ```
   
   The above test should pass but it instead fails with the result `1970-02-27T23:00:00-01:00`. This is because the month addition is done in the UTC epoch instead of the epoch of the array's timezone.
   
   **Describe the solution you'd like**
   <!--
   A clear and concise description of what you want to happen.
   -->
   
   
   **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] tustvold commented on issue #4457: Timestamp Interval Arithmetic Ignores Timezone

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

   `label_issue.py` automatically added labels {'arrow'} from #4546


-- 
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 #4457: Timestamp Interval Arithmetic Ignores Timezone

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold closed issue #4457: Timestamp Interval Arithmetic Ignores Timezone
URL: https://github.com/apache/arrow-rs/issues/4457


-- 
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] alexandreyc commented on issue #4457: Timestamp Interval Arithmetic Ignores Timezone

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

   I started working on this one 🐛 


-- 
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 commented on issue #4457: Timestamp Interval Arithmetic Ignores Timezone

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

   Thank you, let me know if you get stuck. I would recommend making use of https://docs.rs/arrow-array/latest/arrow_array/temporal_conversions/fn.as_datetime_with_timezone.html and punting the non-trivial timezone logic onto chrono. In particular correctly handling DST is complex


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