presto-main/src/main/java/io/prestosql/operator/aggregation/histogram/SingleTypedHistogram.java/SingleTypedHistogram/serialize
class SingleTypedHistogram:    @Override
    public void serialize(BlockBuilder out)
    {
        if (values.getPositionCount() == 0) {
            out.appendNull();
        }
        else {
            Block valuesBlock = values.build();
            BlockBuilder blockBuilder = out.beginBlockEntry();
            for (int i = 0; i < valuesBlock.getPositionCount(); i++) {
                type.appendTo(valuesBlock, i, blockBuilder);
                BIGINT.writeLong(blockBuilder, counts.get(i));
            }
            out.closeEntry();
        }
    }