enhance: mmap data corrupted after seal the column (#29422)

this bug was introduced in recent changes

Signed-off-by: yah01 <yang.cen@zilliz.com>
pull/29437/head
yah01 2023-12-23 15:20:43 +08:00 committed by GitHub
parent 1cbe3cd5fc
commit 1b7f1d7067
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 9 deletions

View File

@ -318,18 +318,22 @@ class VariableColumn : public ColumnBase {
if (!indices.empty()) {
indices_ = std::move(indices);
}
num_rows_ = indices_.size();
size_t total_size = size_;
size_ = 0;
Expand(total_size);
// for variable length column in memory mode only
if (data_ == nullptr) {
num_rows_ = indices_.size();
while (!load_buf_.empty()) {
auto data = std::move(load_buf_.front());
load_buf_.pop();
size_t total_size = size_;
size_ = 0;
Expand(total_size);
std::copy_n(data.data(), data.length(), data_ + size_);
size_ += data.length();
while (!load_buf_.empty()) {
auto data = std::move(load_buf_.front());
load_buf_.pop();
std::copy_n(data.data(), data.length(), data_ + size_);
size_ += data.length();
}
}
ConstructViews();