@@ -989,13 +989,18 @@ cdef inline bint _treat_as_na(numeric_object_t val, bint is_datetimelike) nogil:
989989 return False
990990
991991
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 ):
993993 """
994994 Find either the min or the max supported by numeric_t; 'val' is a placeholder
995995 to effectively make numeric_t an argument.
996996 """
997997 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
9991004 elif numeric_t is int32_t:
10001005 return util.INT32_MIN if compute_max else util.INT32_MAX
10011006 elif numeric_t is int16_t:
@@ -1395,7 +1400,7 @@ cdef group_min_max(
13951400 nobs = np.zeros((< object > out).shape, dtype = np.int64)
13961401
13971402 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 )
13991404
14001405 if iu_64_floating_t is int64_t:
14011406 # TODO: only if is_datetimelike?
@@ -1564,7 +1569,7 @@ cdef group_cummin_max(
15641569 bint isna_entry
15651570
15661571 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 )
15681573
15691574 na_val = _get_na_val(< iu_64_floating_t> 0 , is_datetimelike)
15701575
0 commit comments