You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "yugant-git (via GitHub)" <gi...@apache.org> on 2023/09/13 08:44:57 UTC

[GitHub] [arrow] yugant-git opened a new issue, #37691: When using the `pa.compute.cast` function to cast a string representation of a timestamp to a timestamp data type with a specified unit (e.g., "ns"), the function does not raise an overflow exception when the input string represents a timestamp that is out of bounds.

yugant-git opened a new issue, #37691:
URL: https://github.com/apache/arrow/issues/37691

   ### Describe the bug, including details regarding any error messages, version, and platform.
   
   **Description:**
   
   When using the `pa.compute.cast` function to cast a string representation of a timestamp to a timestamp data type with a specified unit (e.g., "ns"), the function does not raise an overflow exception when the input string represents a timestamp that is out of bounds.
   
   **Steps to Reproduce:**
   
   ```python
   import pyarrow as pa
   result = pa.compute.cast("0001-01-01T00:00:00.0000000", pa.timestamp("ns"))
   print(result)
   ```
   
   Expected Behavior:
   
   I expect the pa.compute.cast function to raise an overflow exception when attempting to parse a timestamp that is out of bounds, indicating that the provided timestamp is invalid.
   
   Actual Behavior:
   
   The pa.compute.cast function does not raise an overflow exception and returns a TimestampScalar object with a value that appears to be incorrect: Timestamp('1754-08-30 22:43:41.128654848').
   
   Additional Information:
   
   Python version: 3.11.2
   pyarrow version: 13.0.0
   Operating System: Windows 11
   
   ### Component(s)
   
   Python


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

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


[GitHub] [arrow] AlenkaF commented on issue #37691: [C++][Python] Converting string to timestamp silently overflows

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

   I get that using `pc.strptime` also:
   
   ```python
   >>> ts = "0001-01-01 00:00"
   >>> format = "%Y-%m-%d %I:%M"
   >>> pc.strptime(ts, format= format, unit='ns')
   <pyarrow.TimestampScalar: '1754-08-30T22:43:41.128654848'>
   ```


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