@@ -989,13 +989,18 @@ cdef inline bint _treat_as_na(numeric_object_t val, bint is_datetimelike) nogil:
989
989
return False
990
990
991
991
992
- cdef numeric_t _get_min_or_max(numeric_t val, bint compute_max):
992
+ cdef numeric_t _get_min_or_max(numeric_t val, bint compute_max, bint is_datetimelike ):
993
993
"""
994
994
Find either the min or the max supported by numeric_t; 'val' is a placeholder
995
995
to effectively make numeric_t an argument.
996
996
"""
997
997
if numeric_t is int64_t:
998
- return - _int64_max if compute_max else util.INT64_MAX
998
+ if compute_max and is_datetimelike:
999
+ return - _int64_max
1000
+ # Note(jbrockmendel) 2022-03-15 for reasons unknown, using util.INT64_MIN
1001
+ # instead of NPY_NAT here causes build warnings and failure in
1002
+ # test_cummax_i8_at_implementation_bound
1003
+ return NPY_NAT if compute_max else util.INT64_MAX
999
1004
elif numeric_t is int32_t:
1000
1005
return util.INT32_MIN if compute_max else util.INT32_MAX
1001
1006
elif numeric_t is int16_t:
@@ -1395,7 +1400,7 @@ cdef group_min_max(
1395
1400
nobs = np.zeros((< object > out).shape, dtype = np.int64)
1396
1401
1397
1402
group_min_or_max = np.empty_like(out)
1398
- group_min_or_max[:] = _get_min_or_max(< iu_64_floating_t> 0 , compute_max)
1403
+ group_min_or_max[:] = _get_min_or_max(< iu_64_floating_t> 0 , compute_max, is_datetimelike )
1399
1404
1400
1405
if iu_64_floating_t is int64_t:
1401
1406
# TODO: only if is_datetimelike?
@@ -1564,7 +1569,7 @@ cdef group_cummin_max(
1564
1569
bint isna_entry
1565
1570
1566
1571
accum = np.empty((ngroups, (< object > values).shape[1 ]), dtype = values.dtype)
1567
- accum[:] = _get_min_or_max(< iu_64_floating_t> 0 , compute_max)
1572
+ accum[:] = _get_min_or_max(< iu_64_floating_t> 0 , compute_max, is_datetimelike )
1568
1573
1569
1574
na_val = _get_na_val(< iu_64_floating_t> 0 , is_datetimelike)
1570
1575
0 commit comments