Skip to content

Commit

Permalink
resolve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
vsian committed Dec 13, 2024
1 parent df418d6 commit c4460d8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/storage/knn_index/sparse/bmp_alg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ template class BMPIvt<f64, BMPCompressType::kCompressed>;
template class BMPIvt<f64, BMPCompressType::kRaw>;

template <typename DataType, typename IdxType>
SizeT TailFwd<DataType, IdxType>::AddDoc(const SparseVecRef<DataType, IdxType> &doc, SizeT &mem_usage) {
SizeT TailFwd<DataType, IdxType>::AddDoc(const SparseVecRef<DataType, IdxType> &doc) {
Vector<IdxType> indices;
Vector<DataType> data;
indices.reserve(doc.nnz_);
Expand All @@ -78,7 +78,6 @@ SizeT TailFwd<DataType, IdxType>::AddDoc(const SparseVecRef<DataType, IdxType> &
data.push_back(doc.data_[i]);
}
tail_terms_.emplace_back(std::move(indices), std::move(data));
mem_usage += doc.nnz_ * (sizeof(IdxType) + sizeof(DataType));
return tail_terms_.size();
}

Expand Down Expand Up @@ -149,7 +148,7 @@ template class TailFwd<f64, i8>;

template <typename DataType, typename IdxType>
Optional<TailFwd<DataType, IdxType>> BlockFwd<DataType, IdxType>::AddDoc(const SparseVecRef<DataType, IdxType> &doc, SizeT &mem_usage) {
SizeT tail_size = tail_fwd_.AddDoc(doc, mem_usage);
SizeT tail_size = tail_fwd_.AddDoc(doc);
if (tail_size < block_size_) {
return None;
}
Expand Down
2 changes: 1 addition & 1 deletion src/storage/knn_index/sparse/bmp_alg.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private:
public:
TailFwd(SizeT block_size) { tail_terms_.reserve(block_size); }

SizeT AddDoc(const SparseVecRef<DataType, IdxType> &doc, SizeT &mem_usage);
SizeT AddDoc(const SparseVecRef<DataType, IdxType> &doc);

const Vector<Pair<Vector<IdxType>, Vector<DataType>>> &GetTailTerms() const { return tail_terms_; }

Expand Down
2 changes: 1 addition & 1 deletion src/storage/knn_index/sparse/bmp_posting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void BlockData<DataType, BMPCompressType::kRaw>::Calculate(Vector<DataType> &upp
template <typename DataType>
void BlockData<DataType, BMPCompressType::kRaw>::AddBlock(BMPBlockID block_id, DataType max_score, SizeT &mem_usage) {
if (block_id >= (BMPBlockID)max_scores_.size()) {
mem_usage += sizeof(BMPBlockID);
mem_usage += sizeof(BMPBlockID) * (block_id + 1 - max_scores_.size());
max_scores_.resize(block_id + 1, 0.0);
}
max_scores_[block_id] = max_score;
Expand Down

0 comments on commit c4460d8

Please sign in to comment.