Consider instance size when calculating estimated size
@@ -24,6 +24,7 @@ import com.facebook.presto.spi.type.BigintType;
import com.facebook.presto.spi.type.Type;
import com.facebook.presto.type.BigintOperators;
import com.google.common.collect.ImmutableList;
+import org.openjdk.jol.info.ClassLayout;
import java.util.List;
@@ -38,6 +39,8 @@ import static it.unimi.dsi.fastutil.HashCommon.murmurHash3;
public class BigintGroupByHash
implements GroupByHash
{
+ private static final int INSTANCE_SIZE = ClassLayout.parseClass(BigintGroupByHash.class).instanceSize();
+
private static final float FILL_RATIO = 0.75f;
private static final List<Type> TYPES = ImmutableList.of(BIGINT);
private static final List<Type> TYPES_WITH_RAW_HASH = ImmutableList.of(BIGINT, BIGINT);
@@ -87,7 +90,8 @@ public class BigintGroupByHash
@Override
public long getEstimatedSize()
{
- return groupIds.sizeOf() +
+ return INSTANCE_SIZE +
+ groupIds.sizeOf() +
values.sizeOf() +
valuesByGroupId.sizeOf();
}
