presto-main/src/main/java/io/prestosql/operator/aggregation/state/NullableLongState.java/NullableLongState/write
class NullableLongState:    static void write(Type type, NullableLongState state, BlockBuilder out)
    {
        if (state.isNull()) {
            out.appendNull();
        }
        else {
            type.writeLong(out, state.getLong());
        }
    }