LiaCastaneda commented on code in PR #19501:
URL: https://github.com/apache/datafusion/pull/19501#discussion_r2655323607
##########
datafusion/functions-aggregate/src/array_agg.rs:
##########
@@ -390,27 +393,25 @@ impl Accumulator for ArrayAggAccumulator {
Ok(SingleRowListArrayBuilder::new(concated_array).build_list_scalar())
}
- fn size(&self) -> usize {
- size_of_val(self)
+ fn size(&self, pool: Option<&dyn MemoryPool>) -> usize {
+ let mut total = size_of_val(self)
+ (size_of::<ArrayRef>() * self.values.capacity())
- + self
+ + self.datatype.size()
+ - size_of_val(&self.datatype);
+
+ if let Some(pool) = pool {
+ for arr in &self.values {
+ claim_buffers_recursive(&arr.to_data(), pool);
Review Comment:
it will call claim() multiple times on the same `Buffer`/`Bytes`, but is
safe because each call replaces the previous reservation (and does not add to
it), so the pool will only track each buffer once regardless of how many times
size() is called
--
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]