Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions be/src/vec/common/pod_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,8 @@ class PODArray : public PODArrayBase<sizeof(T), initial_bytes, TAllocator, pad_r
this->c_end = this->c_start + new_size;
}

/// reset the array capacity
/// fill the new additional elements using the value
void resize_fill(size_t n, const T& value) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add some ut for resize fill, we should make sure it only reset the additional new element's value

size_t old_size = this->size();
const auto new_size = this->byte_size(n);
Expand Down Expand Up @@ -689,6 +691,8 @@ class PODArray : public PODArrayBase<sizeof(T), initial_bytes, TAllocator, pad_r
}
}

/// reset the array capacity
/// replace the all elements using the value
void assign(size_t n, const T& x) {
this->resize(n);
std::fill(begin(), end(), x);
Expand Down
6 changes: 4 additions & 2 deletions be/src/vec/exec/format/table/equality_delete.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ Status SimpleEqualityDelete::filter_data_block(Block* data_block) {
if (_filter == nullptr) {
_filter = std::make_unique<IColumn::Filter>(rows, 0);
} else {
_filter->resize_fill(rows, 0);
// reset the array capacity and fill all elements using the 0
_filter->assign(rows, UInt8(0));
}

if (column_and_type->column->is_nullable()) {
Expand Down Expand Up @@ -132,7 +133,8 @@ Status MultiEqualityDelete::filter_data_block(Block* data_block) {
if (_filter == nullptr) {
_filter = std::make_unique<IColumn::Filter>(rows, 1);
} else {
_filter->resize_fill(rows, 1);
//reset the array capacity and fill all elements using the 0
_filter->assign(rows, UInt8(1));
}
auto* filter_data = _filter->data();
for (size_t i = 0; i < rows; ++i) {
Expand Down
Loading