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