Backport PR #38094 on branch 1.1.x (REGR: fix regression in groupby aggregation with out-of-bounds datetimes)
Backport PR #38094: REGR: fix regression in groupby aggregation with out-of-bounds datetimes