zhiqiang-hhhh commented on code in PR #57623:
URL: https://github.com/apache/doris/pull/57623#discussion_r2502325102
##########
be/src/olap/rowset/segment_v2/ann_index/ann_index_writer.h:
##########
@@ -70,6 +70,7 @@ class AnnIndexColumnWriter : public IndexColumnWriter {
// VectorIndex should be weak shared by AnnIndexWriter and
VectorIndexReader
// This should be a weak_ptr
std::shared_ptr<VectorIndex> _vector_index;
+ std::vector<float> _ann_vec;
Review Comment:
replace `std::vector` with `DorisVector` for memory safe.
##########
be/src/olap/rowset/segment_v2/ann_index/ann_index_writer.cpp:
##########
@@ -104,10 +104,28 @@ Status AnnIndexColumnWriter::add_array_values(size_t
field_size, const void* val
}
const float* p = reinterpret_cast<const float*>(value_ptr);
+
+ // Add to buffer
+ _ann_vec.insert(_ann_vec.end(), p, p + num_rows * dim);
Review Comment:
as we have the information of rows of these batch, we can reserve enough
memory in advance to avoid re-alloc memory.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]