Github user ppadma commented on a diff in the pull request:
https://github.com/apache/drill/pull/1101#discussion_r164634551
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggTemplate.java
---
@@ -215,6 +206,7 @@ public BatchHolder() {
MaterializedField outputField = materializedValueFields[i];
// Create a type-specific ValueVector for this value
vector = TypeHelper.getNewVector(outputField, allocator);
+ int columnSize = new RecordBatchSizer.ColumnSize(vector).estSize;
--- End diff --
Why not just use TypeHelper.getSize(outputField.getType()) ? It seems like
you don't need RecordBatchSizer for this. estSize in RecordBatchSizer is
taking actual memory allocation into account i.e. it includes the over head of
unused vector space and we need that value as well for different reasons. I
also think it is doing right thing by returning zero when there are no rows and
no memory allocated.
---