kosiew commented on code in PR #26154:
URL: https://github.com/apache/datafusion/pull/26154#discussion_r4266427781


##########
datafusion/functions-aggregate/src/min_max/min_max_bytes.rs:
##########
@@ -528,13 +535,20 @@ impl MinMaxBytesState {
                     .map(|opt| opt.as_ref().map(|s| s.len()).unwrap_or(0))
                     .sum();
                 self.total_data_bytes -= first_data_capacity;
+                self.total_data_capacity -= first_min_maxes
+                    .iter()
+                    .flatten()
+                    .map(Vec::capacity)
+                    .sum::<usize>();
                 (first_data_capacity, first_min_maxes)

Review Comment:
   I’ll use your suggested `flatten().fold(...)` approach, subtract each total 
from its counter, and return the logical byte count.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to