HyukjinKwon commented on code in PR #48460:
URL: https://github.com/apache/arrow/pull/48460#discussion_r2612310648
##########
python/pyarrow/tests/strategies.py:
##########
@@ -323,9 +323,37 @@ def arrays(draw, type, size=None, nullable=True):
value = st.datetimes(timezones=st.just(tz), min_value=min_datetime,
max_value=max_datetime)
elif pa.types.is_duration(ty):
- value = st.timedeltas()
+ min_int64 = -(2**63)
+ max_int64 = 2**63 - 1
+ if ty.unit == pa.lib.TimeUnit_SECOND:
+ value = st.timedeltas(
+ min_value=datetime.timedelta.min,
+ max_value=datetime.timedelta.max
+ )
+ elif ty.unit == pa.lib.TimeUnit_MILLI:
+ max_millis = max_int64 // 10**3
+ value = st.timedeltas(
+ min_value=datetime.timedelta(milliseconds=-max_millis),
+ max_value=datetime.timedelta(milliseconds=max_millis)
+ )
+ elif ty.unit == pa.lib.TimeUnit_MICRO:
+ max_micros = max_int64 // 10**6
+ value = st.timedeltas(
+ min_value=datetime.timedelta(microseconds=-max_micros),
+ max_value=datetime.timedelta(microseconds=max_micros)
+ )
+ else: # TimeUnit_NANO
+ # Empirically tested value
+ value = st.timedeltas(
+ min_value=datetime.timedelta(days=-96_075),
+ max_value=datetime.timedelta(days=96_075)
+ )
elif pa.types.is_interval(ty):
- value = st.timedeltas()
+ # Empirically tested value
Review Comment:
Seems like we're using nano part always `interval_types =
st.just(pa.month_day_nano_interval())` at L146
--
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]