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
7 changes: 3 additions & 4 deletions be/src/olap/rowset/segment_v2/ann_index/faiss_ann_index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ struct FaissIndexReader : faiss::IOReader {
lucene::store::IndexInput* _input = nullptr;
};

doris::Status FaissVectorIndex::train(vectorized::Int64 n, const float* x) {
DCHECK(x != nullptr);
doris::Status FaissVectorIndex::train(vectorized::Int64 n, const float* vec) {
DCHECK(vec != nullptr);
DCHECK(_index != nullptr);

// For PQ index, check if we have enough training data
Expand All @@ -239,9 +239,8 @@ doris::Status FaissVectorIndex::train(vectorized::Int64 n, const float* x) {
ScopedThreadName scoped_name("faiss_train_idx");
// Reserve OpenMP threads globally so concurrent builds stay under omp_threads_limit.
ScopedOmpThreadBudget thread_budget;
omp_set_num_threads(config::omp_threads_limit);
try {
_index->train(n, x);
_index->train(n, vec);
} catch (faiss::FaissException& e) {
return doris::Status::RuntimeError("exception occurred during training: {}", e.what());
}
Expand Down
13 changes: 12 additions & 1 deletion be/src/olap/rowset/segment_v2/ann_index/faiss_ann_index.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,18 @@ class FaissVectorIndex : public VectorIndex {

~FaissVectorIndex();

doris::Status train(vectorized::Int64 n, const float* x) override;
/**
* @brief Trains the index with the provided data.
*
* This method is used to train the FAISS index with a set of vectors.
* Training is required for certain index types that need to learn
* parameters from the data before adding vectors.
*
* @param n Number of training vectors
* @param vec Pointer to training vector data (n * dim float values)
* @return Status indicating success or failure
*/
doris::Status train(vectorized::Int64 n, const float* vec) override;

/**
* @brief Adds vectors to the index for future searches.
Expand Down
Loading