Remove invalid offset check while filling data (#26666)

Signed-off-by: yah01 <yah2er0ne@outlook.com>
pull/26656/head
yah01 2023-08-30 09:52:27 +08:00 committed by GitHub
parent cd7f811d40
commit b475f25042
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 15 deletions

View File

@ -469,9 +469,7 @@ SegmentGrowingImpl::bulk_subscript_impl(const VectorBase* vec_raw,
auto output = reinterpret_cast<T*>(output_raw);
for (int64_t i = 0; i < count; ++i) {
auto offset = seg_offsets[i];
if (offset != INVALID_SEG_OFFSET) {
output[i] = vec[offset];
}
output[i] = vec[offset];
}
}

View File

@ -739,9 +739,7 @@ SegmentSealedImpl::bulk_subscript_impl(const void* src_raw,
for (int64_t i = 0; i < count; ++i) {
auto offset = seg_offsets[i];
if (offset != INVALID_SEG_OFFSET) {
dst[i] = src[offset];
}
dst[i] = src[offset];
}
}
@ -755,9 +753,7 @@ SegmentSealedImpl::bulk_subscript_impl(const ColumnBase* column,
auto dst = reinterpret_cast<T*>(dst_raw);
for (int64_t i = 0; i < count; ++i) {
auto offset = seg_offsets[i];
if (offset != INVALID_SEG_OFFSET) {
dst[i] = std::move(T(field->RawAt(offset)));
}
dst[i] = std::move(T(field->RawAt(offset)));
}
}
@ -772,13 +768,8 @@ SegmentSealedImpl::bulk_subscript_impl(int64_t element_sizeof,
auto dst_vec = reinterpret_cast<char*>(dst_raw);
for (int64_t i = 0; i < count; ++i) {
auto offset = seg_offsets[i];
auto src = src_vec + element_sizeof * offset;
auto dst = dst_vec + i * element_sizeof;
const char* src = (offset == INVALID_SEG_OFFSET
? nullptr
: (src_vec + element_sizeof * offset));
if (!src) {
continue;
}
memcpy(dst, src, element_sizeof);
}
}