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/04/07 13:05:21 UTC

[GitHub] [arrow-rs] tustvold opened a new issue, #4033: Incorrect Overflow Casting String to Timestamp

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

   **Describe the bug**
   <!--
   A clear and concise description of what the bug is.
   -->
   
   When casting strings to timestamps, they are converted to nanoseconds using `string_to_timestamp_nanos`. This results in erroneous overflow when handling quantities that can't be represented in an i64 as nanoseconds, but can be encoded as a larger timeunit.
   
   **To Reproduce**
   <!--
   Steps to reproduce the behavior:
   -->
   
   ```
   #[test]
   fn test_cast_string_to_timestamp_overflow() {
       // let array = TimestampSecondArray::from(vec![chrono::DateTime::MAX_UTC]);
       // let array = cast(&array, &DataType::Utf8).unwrap();
   
       let array = StringArray::from(vec!["9800-09-08T12:00:00.123456789"]);
       let result = cast(&array, &DataType::Timestamp(TimeUnit::Second, None)).unwrap();
       let result = result.as_primitive::<TimestampSecondType>();
       assert_eq!(result.values(), &[247112596800]);
   }
   ```
   
   **Expected behavior**
   <!--
   A clear and concise description of what you expected to happen.
   -->
   
   **Additional context**
   <!--
   Add any other context about the problem 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 closed issue #4033: Incorrect Overflow Casting String to Timestamp

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold closed issue #4033: Incorrect Overflow Casting String to Timestamp
URL: https://github.com/apache/arrow-rs/issues/4033


-- 
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 #4033: Incorrect Overflow Casting String to Timestamp

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

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


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