presto-main/src/main/java/io/prestosql/operator/aggregation/state/BlockState.java/BlockState/write
class BlockState:    static void write(Type type, BlockState state, BlockBuilder out)
    {
        if (state.getBlock() == null) {
            out.appendNull();
        }
        else {
            type.writeObject(out, state.getBlock());
        }
    }