Fix quadratic runtime in min_max_bytes (#18044)
## Which issue does this PR close?
- Closes https://github.com/apache/datafusion/issues/17897
## What changes are included in this PR?
This PR replaces the `locations` vector used to reduce the number of
allocations / resizes in the accumulator with. a HashMap instead.
## Are these changes tested?
Not in particular. Additional unit-tests and broader regression testing
would be useful. A microbenchmark verifies that the runtime is no longer
quadratic.
## Are there any user-facing changes?
No.
---------
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>