Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion datafusion/functions-aggregate/src/average.rs
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,7 @@ where
}

fn size(&self) -> usize {
self.counts.capacity() * size_of::<u64>() + self.sums.capacity() * size_of::<T>()
self.counts.capacity() * size_of::<u64>()
+ self.sums.capacity() * size_of::<T::Native>()
Comment on lines +973 to +974

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.counts.capacity() * size_of::<u64>()
+ self.sums.capacity() * size_of::<T::Native>()
// Heap buffers
self.counts.capacity() * size_of::<u64>()
+ self.sums.capacity() * size_of::<T::Native>()
// Vec struct overhead (ptr, len, cap) for each field
+ size_of::<Vec<u64>>()
+ size_of::<Vec<T::Native>>()

Adding small overhead to maintain Vec

}
}
6 changes: 3 additions & 3 deletions datafusion/functions-aggregate/src/median.rs
Original file line number Diff line number Diff line change
Expand Up @@ -543,10 +543,10 @@ impl<T: ArrowNumericType + Send> GroupsAccumulator for MedianGroupsAccumulator<T
fn size(&self) -> usize {
self.group_values
.iter()
.map(|values| values.capacity() * size_of::<T>())
.map(|values| values.capacity() * size_of::<T::Native>())
.sum::<usize>()
// account for size of self.grou_values too
+ self.group_values.capacity() * size_of::<Vec<T>>()
// account for size of self.group_values too
+ self.group_values.capacity() * size_of::<Vec<T::Native>>()
}
}

Expand Down
Loading