Skip to content

Commit

Permalink
fix accounting
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb committed Oct 10, 2024
1 parent c7aa11f commit 8e876bf
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions datafusion/functions-aggregate/src/min_max/min_max_bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,14 +497,13 @@ impl MinMaxBytesState {
)
}
EmitTo::First(n) => {
let min_maxes = self.min_max.drain(..n).collect();
let data_capacity: usize = self
.min_max
let first_min_maxes: Vec<_> = self.min_max.drain(..n).collect();
let first_data_capacity: usize = first_min_maxes
.iter()
.map(|opt| opt.as_ref().map(|s| s.len()).unwrap_or(0))
.sum();
self.total_data_bytes -= data_capacity;
(data_capacity, min_maxes)
self.total_data_bytes -= first_data_capacity;
(first_data_capacity, first_min_maxes)
}
}
}
Expand Down

0 comments on commit 8e876bf

Please sign in to comment.