pearu opened a new issue, #54643:
URL: https://github.com/apache/arrow/issues/54643

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   Timestamp parsing with a `strptime` format rolls an impossible date over 
into the next month. Where the platform's `strptime` accepts day `00` (macOS, 
Windows), it is taken as the first of the month:
   
   ```python
   import pyarrow as pa
   import pyarrow.compute as pc
   
   for value in ["2021-02-30", "2021-04-31", "2021-02-00"]:
       try:
           print(pc.strptime(pa.array([value]), format="%Y-%m-%d", unit="s")[0])
       except pa.ArrowInvalid as e:
           print(e)
   ```
   
   Output on Linux (pyarrow 27.0.0.dev18):
   
   ```
   2021-03-02 00:00:00
   2021-05-01 00:00:00
   Failed to parse string: '2021-02-00' as a scalar of type timestamp[s]
   ```
   
   Output on macOS and Windows:
   
   ```
   2021-03-02 00:00:00
   2021-05-01 00:00:00
   2021-02-01 00:00:00
   ```
   
   Expected is a parse failure for all three values, as with the ISO-8601 
parser: `pa.array(["2021-02-30"]).cast(pa.timestamp("s"))` raises 
`ArrowInvalid: Failed to parse string: '2021-02-30' as a scalar of type 
timestamp[s]`.
   
   Found while working on #50146.
   
   ### Component(s)
   
   C++
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to