diff --git a/be/src/vec/columns/column_impl.h b/be/src/vec/columns/column_impl.h index f0a157f41972f3..470825851e1e9d 100644 --- a/be/src/vec/columns/column_impl.h +++ b/be/src/vec/columns/column_impl.h @@ -42,8 +42,11 @@ void IColumn::append_data_by_selector_impl(MutablePtr& res, const Selector& sele "Size of selector: {} is larger than size of column: {}", selector.size(), num_rows); } - - res->reserve(num_rows); + DCHECK_GE(end, begin); + // here wants insert some value from this column, and the nums is (end - begin) + // and many be this column num_rows is 4096, but only need insert num is (1 - 0) = 1 + // so can't call res->reserve(num_rows), it's will be too mush waste memory + res->reserve(res->size() + (end - begin)); for (size_t i = begin; i < end; ++i) { static_cast(*res).insert_from(*this, selector[i]);