Skip to content

Commit

Permalink
fix bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
LeslieKid committed Nov 4, 2024
1 parent 9b4624b commit f4884cc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions datafusion/functions-aggregate/src/min_max/min_max_bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,10 @@ impl GroupsAccumulator for MinMaxBytesAccumulator {
/// This is a heuristic to avoid allocating too many small buffers
fn capacity_to_view_block_size(data_capacity: usize) -> u32 {
let max_block_size = 2 * 1024 * 1024;
// Avoid block size equal to zero when calling `with_fixed_block_size()`.
if data_capacity == 0 {
return 1;
}
if let Ok(block_size) = u32::try_from(data_capacity) {
block_size.min(max_block_size)
} else {
Expand Down

0 comments on commit f4884cc

Please sign in to comment.