presto-main/src/main/java/io/prestosql/operator/aggregation/multimapagg/LegacyGroupedMultimapAggregationState.java/LegacyGroupedMultimapAggregationState/add
class LegacyGroupedMultimapAggregationState:    @Override
    public void add(Block key, Block value, int position)
    {
        BlockBuilder keyBlockBuilder = keyBlockBuilders.get(getGroupId());
        BlockBuilder valueBlockBuilder = valueBlockBuilders.get(getGroupId());
        if (keyBlockBuilder != null) {
            size -= keyBlockBuilder.getRetainedSizeInBytes();
            size -= valueBlockBuilder.getRetainedSizeInBytes();
        }
        else {
            keyBlockBuilder = keyType.createBlockBuilder(null, EXPECTED_ENTRIES, expectedValueSize(keyType, EXPECTED_ENTRY_SIZE));
            valueBlockBuilder = valueType.createBlockBuilder(null, EXPECTED_ENTRIES, expectedValueSize(valueType, EXPECTED_ENTRY_SIZE));
            keyBlockBuilders.set(getGroupId(), keyBlockBuilder);
            valueBlockBuilders.set(getGroupId(), valueBlockBuilder);
        }
        keyType.appendTo(key, position, keyBlockBuilder);
        valueType.appendTo(value, position, valueBlockBuilder);
        size += keyBlockBuilder.getRetainedSizeInBytes();
        size += valueBlockBuilder.getRetainedSizeInBytes();
    }