[Backport 2.4] Fix incorrect results returned by min
, max
and avg
#1022
+409
−15
min
, max
and avg
#1022