Commit cd848bc
authored
### Rationale for this change
Unbounded hypothesis timedeltas overflow int64 storage when converted to duration[ns]; this adds safe bounds like we're doing it for timestamps.
Assuming from the code, I think overflow is happening here:
https://github.com/apache/arrow/blob/203437b4d6848885de72f32bfb3017919373a736/python/pyarrow/tests/strategies.py#L144
https://github.com/HypothesisWorks/hypothesis/blob/7288aa8f07f6ba61093b1eac6571d13632f31a54/hypothesis-python/src/hypothesis/strategies/_internal/datetime.py#L347C5-L350
Simple example would be:
```python
pa.array([datetime.timedelta.max], type=pa.duration('ns'))
```
Disclaimer: I cannot reproduce it in my local so I can't confirm that the above is correct. There should be something else but I think it's good to set the bounds in any event.
### What changes are included in this PR?
Explicitly set the bounds for `st.timedeltas` in hypothesis. 90% of the capacity when it's a nano second.
### Are these changes tested?
Passed in #48460 (comment)
### Are there any user-facing changes?
No, test-only.
* GitHub Issue: #47734
Authored-by: Hyukjin Kwon <[email protected]>
Signed-off-by: Raúl Cumplido <[email protected]>
1 parent ad9279e commit cd848bc
1 file changed
+18
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
326 | | - | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
327 | 339 | | |
328 | | - | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
329 | 345 | | |
330 | 346 | | |
331 | 347 | | |
| |||
0 commit comments