From 4cb83837754b90bbb540ccc1b1128ffedbb02ba8 Mon Sep 17 00:00:00 2001 From: Cai Yudong Date: Wed, 15 Jul 2020 11:37:05 +0800 Subject: [PATCH] move index type try2 (#2860) * move EngineType and MetricType to MetaTypes.h Signed-off-by: yudong.cai * move IndexType Signed-off-by: yudong.cai * update changelog Signed-off-by: yudong.cai * update changelog Signed-off-by: yudong.cai --- CHANGELOG.md | 1 + core/src/db/engine/ExecutionEngine.h | 67 ++----------------- core/src/db/engine/ExecutionEngineImpl.cpp | 38 +++++------ core/src/db/engine/ExecutionEngineImpl.h | 9 +-- core/src/db/meta/MetaTypes.h | 46 ++++++++++++- core/src/index/knowhere/CMakeLists.txt | 2 +- .../index/{vector_index => }/IndexType.cpp | 3 +- .../index/{vector_index => }/IndexType.h | 0 .../knowhere/index/vector_index/ConfAdapter.h | 2 +- .../index/vector_index/ConfAdapterMgr.h | 2 +- .../index/vector_index/FaissBaseBinaryIndex.h | 2 +- .../index/vector_index/FaissBaseIndex.cpp | 2 +- .../index/vector_index/FaissBaseIndex.h | 2 +- .../knowhere/index/vector_index/IndexNSG.cpp | 2 +- .../knowhere/index/vector_index/VecIndex.h | 2 +- .../index/vector_index/VecIndexFactory.h | 2 +- .../index/vector_index/gpu/IndexGPUIDMAP.cpp | 2 +- .../index/vector_offset_index/IndexNSG_NM.cpp | 2 +- .../vector_offset_index/OffsetBaseIndex.cpp | 2 +- .../vector_offset_index/OffsetBaseIndex.h | 2 +- core/src/index/unittest/CMakeLists.txt | 2 +- core/src/index/unittest/Helper.h | 2 +- .../index/unittest/test_customized_index.cpp | 2 +- core/src/index/unittest/test_gpuresource.cpp | 2 +- core/src/index/unittest/test_idmap.cpp | 2 +- core/src/index/unittest/test_ivf.cpp | 2 +- core/src/index/unittest/test_ivf_cpu_nm.cpp | 2 +- core/src/index/unittest/test_ivf_gpu_nm.cpp | 2 +- core/src/index/unittest/test_vecindex.cpp | 2 +- core/src/scheduler/Definition.h | 1 + core/src/scheduler/task/SearchTask.cpp | 8 +-- 31 files changed, 103 insertions(+), 114 deletions(-) rename core/src/index/knowhere/knowhere/index/{vector_index => }/IndexType.cpp (98%) rename core/src/index/knowhere/knowhere/index/{vector_index => }/IndexType.h (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3011f54c..3bb852a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ Please mark all changes in change log and use the issue from GitHub - \#2561 Clean util dependencies with other modules - \#2612 Move all APIs in utils into namespace milvus - \#2675 Print out system memory size when report invalid cpu cache size +- \#2841 Replace IndexType/EngineType/MetricType ## Task diff --git a/core/src/db/engine/ExecutionEngine.h b/core/src/db/engine/ExecutionEngine.h index a59d05e5..1f91a951 100644 --- a/core/src/db/engine/ExecutionEngine.h +++ b/core/src/db/engine/ExecutionEngine.h @@ -19,6 +19,7 @@ #include +#include "db/meta/MetaTypes.h" #include "query/GeneralQuery.h" #include "utils/Json.h" #include "utils/Status.h" @@ -32,67 +33,6 @@ using SearchJobPtr = std::shared_ptr; namespace engine { -// TODO(linxj): replace with VecIndex::IndexType -enum class EngineType { - INVALID = 0, - FAISS_IDMAP = 1, - FAISS_IVFFLAT, - FAISS_IVFSQ8, - NSG_MIX, - FAISS_IVFSQ8H, - FAISS_PQ, - SPTAG_KDT, - SPTAG_BKT, - FAISS_BIN_IDMAP, - FAISS_BIN_IVFFLAT, - HNSW, - ANNOY, - FAISS_IVFSQ8NR, - HNSW_SQ8NR, - MAX_VALUE = HNSW_SQ8NR, -}; - -static std::map s_map_engine_type = {{"FLAT", EngineType::FAISS_IDMAP}, - {"IVFFLAT", EngineType::FAISS_IVFFLAT}, - {"IVFSQ8", EngineType::FAISS_IVFSQ8}, - {"RNSG", EngineType::NSG_MIX}, - {"IVFSQ8H", EngineType::FAISS_IVFSQ8H}, - {"IVFPQ", EngineType::FAISS_PQ}, - {"SPTAGKDT", EngineType::SPTAG_KDT}, - {"SPTAGBKT", EngineType::SPTAG_BKT}, - {"HNSW", EngineType::HNSW}, - {"ANNOY", EngineType::ANNOY}, - {"IVFSQ8NR", EngineType::FAISS_IVFSQ8NR}, - {"HNSW_SQ8NR", EngineType::HNSW_SQ8NR}}; - -enum class MetricType { - L2 = 1, // Euclidean Distance - IP = 2, // Cosine Similarity - HAMMING = 3, // Hamming Distance - JACCARD = 4, // Jaccard Distance - TANIMOTO = 5, // Tanimoto Distance - SUBSTRUCTURE = 6, // Substructure Distance - SUPERSTRUCTURE = 7, // Superstructure Distance - MAX_VALUE = SUPERSTRUCTURE -}; - -enum class DataType { - INT8 = 1, - INT16 = 2, - INT32 = 3, - INT64 = 4, - - STRING = 20, - - BOOL = 30, - - FLOAT = 40, - DOUBLE = 41, - - VECTOR = 100, - UNKNOWN = 9999, -}; - class ExecutionEngine { public: virtual Status @@ -144,10 +84,11 @@ class ExecutionEngine { virtual Status ExecBinaryQuery(query::GeneralQueryPtr general_query, faiss::ConcurrentBitsetPtr& bitset, - std::unordered_map& attr_type, std::string& vector_placeholder) = 0; + std::unordered_map& attr_type, + std::string& vector_placeholder) = 0; virtual Status - HybridSearch(scheduler::SearchJobPtr job, std::unordered_map& attr_type, + HybridSearch(scheduler::SearchJobPtr job, std::unordered_map& attr_type, std::vector& distances, std::vector& search_ids, bool hybrid) = 0; virtual Status diff --git a/core/src/db/engine/ExecutionEngineImpl.cpp b/core/src/db/engine/ExecutionEngineImpl.cpp index a1e69a3e..6871c483 100644 --- a/core/src/db/engine/ExecutionEngineImpl.cpp +++ b/core/src/db/engine/ExecutionEngineImpl.cpp @@ -807,12 +807,12 @@ MapAndCopyResult(const knowhere::DatasetPtr& dataset, const std::vector& attr_type) { + std::unordered_map& attr_type) { auto field_name = general_query->leaf->term_query->field_name; auto type = attr_type.at(field_name); switch (type) { - case DataType::INT8: { + case meta::hybrid::DataType::INT8: { auto int8_index = std::dynamic_pointer_cast>( attr_index_->attr_index_data().at(field_name)); if (not int8_index) { @@ -827,7 +827,7 @@ ExecutionEngineImpl::ProcessTermQuery(faiss::ConcurrentBitsetPtr& bitset, query: bitset = int8_index->In(term_size, term_value.data()); break; } - case DataType::INT16: { + case meta::hybrid::DataType::INT16: { auto int16_index = std::dynamic_pointer_cast>( attr_index_->attr_index_data().at(field_name)); if (not int16_index) { @@ -842,7 +842,7 @@ ExecutionEngineImpl::ProcessTermQuery(faiss::ConcurrentBitsetPtr& bitset, query: bitset = int16_index->In(term_size, term_value.data()); break; } - case DataType::INT32: { + case meta::hybrid::DataType::INT32: { auto int32_index = std::dynamic_pointer_cast>( attr_index_->attr_index_data().at(field_name)); if (not int32_index) { @@ -857,7 +857,7 @@ ExecutionEngineImpl::ProcessTermQuery(faiss::ConcurrentBitsetPtr& bitset, query: bitset = int32_index->In(term_size, term_value.data()); break; } - case DataType::INT64: { + case meta::hybrid::DataType::INT64: { auto int64_index = std::dynamic_pointer_cast>( attr_index_->attr_index_data().at(field_name)); if (not int64_index) { @@ -872,7 +872,7 @@ ExecutionEngineImpl::ProcessTermQuery(faiss::ConcurrentBitsetPtr& bitset, query: bitset = int64_index->In(term_size, term_value.data()); break; } - case DataType::FLOAT: { + case meta::hybrid::DataType::FLOAT: { auto float_index = std::dynamic_pointer_cast>( attr_index_->attr_index_data().at(field_name)); if (not float_index) { @@ -887,7 +887,7 @@ ExecutionEngineImpl::ProcessTermQuery(faiss::ConcurrentBitsetPtr& bitset, query: bitset = float_index->In(term_size, term_value.data()); break; } - case DataType::DOUBLE: { + case meta::hybrid::DataType::DOUBLE: { auto double_index = std::dynamic_pointer_cast>( attr_index_->attr_index_data().at(field_name)); if (not double_index) { @@ -909,39 +909,39 @@ ExecutionEngineImpl::ProcessTermQuery(faiss::ConcurrentBitsetPtr& bitset, query: } Status -ExecutionEngineImpl::ProcessRangeQuery(const engine::DataType data_type, const std::string& operand, +ExecutionEngineImpl::ProcessRangeQuery(const meta::hybrid::DataType data_type, const std::string& operand, const query::CompareOperator& com_operator, knowhere::IndexPtr& index_ptr, faiss::ConcurrentBitsetPtr& bitset) { switch (data_type) { - case DataType::INT8: { + case meta::hybrid::DataType::INT8: { auto int8_index = std::dynamic_pointer_cast>(index_ptr); int8_t value = atoi(operand.c_str()); bitset = int8_index->Range(value, (knowhere::OperatorType)com_operator); break; } - case DataType::INT16: { + case meta::hybrid::DataType::INT16: { auto int16_index = std::dynamic_pointer_cast>(index_ptr); int16_t value = atoi(operand.c_str()); bitset = int16_index->Range(value, (knowhere::OperatorType)com_operator); break; } - case DataType::INT32: { + case meta::hybrid::DataType::INT32: { auto int32_index = std::dynamic_pointer_cast>(index_ptr); int32_t value = atoi(operand.c_str()); bitset = int32_index->Range(value, (knowhere::OperatorType)com_operator); break; } - case DataType::INT64: { + case meta::hybrid::DataType::INT64: { auto int64_index = std::dynamic_pointer_cast>(index_ptr); int64_t value = atoi(operand.c_str()); bitset = int64_index->Range(value, (knowhere::OperatorType)com_operator); break; } - case DataType::FLOAT: { + case meta::hybrid::DataType::FLOAT: { auto float_index = std::dynamic_pointer_cast>(index_ptr); std::istringstream iss(operand); @@ -950,7 +950,7 @@ ExecutionEngineImpl::ProcessRangeQuery(const engine::DataType data_type, const s bitset = float_index->Range(value, (knowhere::OperatorType)com_operator); break; } - case DataType::DOUBLE: { + case meta::hybrid::DataType::DOUBLE: { auto double_index = std::dynamic_pointer_cast>(index_ptr); std::istringstream iss(operand); @@ -967,8 +967,8 @@ ExecutionEngineImpl::ProcessRangeQuery(const engine::DataType data_type, const s Status ExecutionEngineImpl::HybridSearch(scheduler::SearchJobPtr search_job, - std::unordered_map& attr_type, std::vector& distances, - std::vector& search_ids, bool hybrid) { + std::unordered_map& attr_type, + std::vector& distances, std::vector& search_ids, bool hybrid) { faiss::ConcurrentBitsetPtr bitset; std::string vector_placeholder; auto status = ExecBinaryQuery(search_job->general_query(), bitset, attr_type, vector_placeholder); @@ -991,7 +991,7 @@ ExecutionEngineImpl::HybridSearch(scheduler::SearchJobPtr search_job, int64_t topk = vector_query->topk; int64_t nq = vector_query->query_vector.float_data.size() / dim_; - engine::VectorsData vectors; + VectorsData vectors; vectors.vector_count_ = nq; vectors.float_data_ = vector_query->query_vector.float_data; vectors.binary_data_ = vector_query->query_vector.binary_data; @@ -1009,7 +1009,7 @@ ExecutionEngineImpl::HybridSearch(scheduler::SearchJobPtr search_job, } Status ExecutionEngineImpl::ExecBinaryQuery(milvus::query::GeneralQueryPtr general_query, faiss::ConcurrentBitsetPtr& bitset, - std::unordered_map& attr_type, + std::unordered_map& attr_type, std::string& vector_placeholder) { Status status = Status::OK(); if (general_query->leaf == nullptr) { @@ -1273,7 +1273,7 @@ ExecutionEngineImpl::Search(std::vector& ids, std::vector& dista uint64_t nq = job->nq(); uint64_t topk = job->topk(); - const engine::VectorsData& vectors = job->vectors(); + const VectorsData& vectors = job->vectors(); ids.resize(topk * nq); distances.resize(topk * nq); diff --git a/core/src/db/engine/ExecutionEngineImpl.h b/core/src/db/engine/ExecutionEngineImpl.h index c4a5c6bd..cbef0808 100644 --- a/core/src/db/engine/ExecutionEngineImpl.h +++ b/core/src/db/engine/ExecutionEngineImpl.h @@ -78,10 +78,11 @@ class ExecutionEngineImpl : public ExecutionEngine { Status ExecBinaryQuery(query::GeneralQueryPtr general_query, faiss::ConcurrentBitsetPtr& bitset, - std::unordered_map& attr_type, std::string& vector_placeholder) override; + std::unordered_map& attr_type, + std::string& vector_placeholder) override; Status - HybridSearch(scheduler::SearchJobPtr job, std::unordered_map& attr_type, + HybridSearch(scheduler::SearchJobPtr job, std::unordered_map& attr_type, std::vector& distances, std::vector& search_ids, bool hybrid) override; Status @@ -128,10 +129,10 @@ class ExecutionEngineImpl : public ExecutionEngine { Status ProcessTermQuery(faiss::ConcurrentBitsetPtr& bitset, query::GeneralQueryPtr general_query, - std::unordered_map& attr_type); + std::unordered_map& attr_type); Status - ProcessRangeQuery(const engine::DataType data_type, const std::string& operand, + ProcessRangeQuery(const meta::hybrid::DataType data_type, const std::string& operand, const query::CompareOperator& com_operator, knowhere::IndexPtr& index_ptr, faiss::ConcurrentBitsetPtr& bitset); diff --git a/core/src/db/meta/MetaTypes.h b/core/src/db/meta/MetaTypes.h index 029347fe..c7685b01 100644 --- a/core/src/db/meta/MetaTypes.h +++ b/core/src/db/meta/MetaTypes.h @@ -17,11 +17,55 @@ #include #include "db/Constants.h" -#include "db/engine/ExecutionEngine.h" #include "src/version.h" namespace milvus { namespace engine { + +// TODO(linxj): replace with VecIndex::IndexType +enum class EngineType { + INVALID = 0, + FAISS_IDMAP = 1, + FAISS_IVFFLAT, + FAISS_IVFSQ8, + NSG_MIX, + FAISS_IVFSQ8H, + FAISS_PQ, + SPTAG_KDT, + SPTAG_BKT, + FAISS_BIN_IDMAP, + FAISS_BIN_IVFFLAT, + HNSW, + ANNOY, + FAISS_IVFSQ8NR, + HNSW_SQ8NR, + MAX_VALUE = HNSW_SQ8NR, +}; + +static std::map s_map_engine_type = {{"FLAT", EngineType::FAISS_IDMAP}, + {"IVFFLAT", EngineType::FAISS_IVFFLAT}, + {"IVFSQ8", EngineType::FAISS_IVFSQ8}, + {"RNSG", EngineType::NSG_MIX}, + {"IVFSQ8H", EngineType::FAISS_IVFSQ8H}, + {"IVFPQ", EngineType::FAISS_PQ}, + {"SPTAGKDT", EngineType::SPTAG_KDT}, + {"SPTAGBKT", EngineType::SPTAG_BKT}, + {"HNSW", EngineType::HNSW}, + {"ANNOY", EngineType::ANNOY}, + {"IVFSQ8NR", EngineType::FAISS_IVFSQ8NR}, + {"HNSW_SQ8NR", EngineType::HNSW_SQ8NR}}; + +enum class MetricType { + L2 = 1, // Euclidean Distance + IP = 2, // Cosine Similarity + HAMMING = 3, // Hamming Distance + JACCARD = 4, // Jaccard Distance + TANIMOTO = 5, // Tanimoto Distance + SUBSTRUCTURE = 6, // Substructure Distance + SUPERSTRUCTURE = 7, // Superstructure Distance + MAX_VALUE = SUPERSTRUCTURE +}; + namespace meta { constexpr int32_t DEFAULT_ENGINE_TYPE = (int)EngineType::FAISS_IDMAP; diff --git a/core/src/index/knowhere/CMakeLists.txt b/core/src/index/knowhere/CMakeLists.txt index 28a7cfdf..9cffa800 100644 --- a/core/src/index/knowhere/CMakeLists.txt +++ b/core/src/index/knowhere/CMakeLists.txt @@ -61,7 +61,7 @@ set(vector_index_srcs knowhere/index/vector_index/IndexIVFPQ.cpp knowhere/index/vector_index/IndexIVFSQ.cpp knowhere/index/vector_index/IndexIVFSQNR.cpp - knowhere/index/vector_index/IndexType.cpp + knowhere/index/IndexType.cpp knowhere/index/vector_index/VecIndexFactory.cpp knowhere/index/vector_index/IndexAnnoy.cpp ) diff --git a/core/src/index/knowhere/knowhere/index/vector_index/IndexType.cpp b/core/src/index/knowhere/knowhere/index/IndexType.cpp similarity index 98% rename from core/src/index/knowhere/knowhere/index/vector_index/IndexType.cpp rename to core/src/index/knowhere/knowhere/index/IndexType.cpp index 02fbbb40..b8c5ffef 100644 --- a/core/src/index/knowhere/knowhere/index/vector_index/IndexType.cpp +++ b/core/src/index/knowhere/knowhere/index/IndexType.cpp @@ -9,9 +9,10 @@ // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express // or implied. See the License for the specific language governing permissions and limitations under the License -#include "knowhere/index/vector_index/IndexType.h" #include + #include "knowhere/common/Exception.h" +#include "knowhere/index/IndexType.h" namespace milvus { namespace knowhere { diff --git a/core/src/index/knowhere/knowhere/index/vector_index/IndexType.h b/core/src/index/knowhere/knowhere/index/IndexType.h similarity index 100% rename from core/src/index/knowhere/knowhere/index/vector_index/IndexType.h rename to core/src/index/knowhere/knowhere/index/IndexType.h diff --git a/core/src/index/knowhere/knowhere/index/vector_index/ConfAdapter.h b/core/src/index/knowhere/knowhere/index/vector_index/ConfAdapter.h index 11ecd560..7ac14542 100644 --- a/core/src/index/knowhere/knowhere/index/vector_index/ConfAdapter.h +++ b/core/src/index/knowhere/knowhere/index/vector_index/ConfAdapter.h @@ -16,7 +16,7 @@ #include #include "knowhere/common/Config.h" -#include "knowhere/index/vector_index/IndexType.h" +#include "knowhere/index/IndexType.h" namespace milvus { namespace knowhere { diff --git a/core/src/index/knowhere/knowhere/index/vector_index/ConfAdapterMgr.h b/core/src/index/knowhere/knowhere/index/vector_index/ConfAdapterMgr.h index 5d8c24f3..83b9d0f5 100644 --- a/core/src/index/knowhere/knowhere/index/vector_index/ConfAdapterMgr.h +++ b/core/src/index/knowhere/knowhere/index/vector_index/ConfAdapterMgr.h @@ -15,8 +15,8 @@ #include #include +#include "knowhere/index/IndexType.h" #include "knowhere/index/vector_index/ConfAdapter.h" -#include "knowhere/index/vector_index/IndexType.h" namespace milvus { namespace knowhere { diff --git a/core/src/index/knowhere/knowhere/index/vector_index/FaissBaseBinaryIndex.h b/core/src/index/knowhere/knowhere/index/vector_index/FaissBaseBinaryIndex.h index f4d87847..5db3fb49 100644 --- a/core/src/index/knowhere/knowhere/index/vector_index/FaissBaseBinaryIndex.h +++ b/core/src/index/knowhere/knowhere/index/vector_index/FaissBaseBinaryIndex.h @@ -18,7 +18,7 @@ #include "knowhere/common/BinarySet.h" #include "knowhere/common/Dataset.h" -#include "knowhere/index/vector_index/IndexType.h" +#include "knowhere/index/IndexType.h" namespace milvus { namespace knowhere { diff --git a/core/src/index/knowhere/knowhere/index/vector_index/FaissBaseIndex.cpp b/core/src/index/knowhere/knowhere/index/vector_index/FaissBaseIndex.cpp index f0a6face..99693366 100644 --- a/core/src/index/knowhere/knowhere/index/vector_index/FaissBaseIndex.cpp +++ b/core/src/index/knowhere/knowhere/index/vector_index/FaissBaseIndex.cpp @@ -13,8 +13,8 @@ #include #include "knowhere/common/Exception.h" +#include "knowhere/index/IndexType.h" #include "knowhere/index/vector_index/FaissBaseIndex.h" -#include "knowhere/index/vector_index/IndexType.h" #include "knowhere/index/vector_index/helpers/FaissIO.h" namespace milvus { diff --git a/core/src/index/knowhere/knowhere/index/vector_index/FaissBaseIndex.h b/core/src/index/knowhere/knowhere/index/vector_index/FaissBaseIndex.h index 0da01238..53a9c3a3 100644 --- a/core/src/index/knowhere/knowhere/index/vector_index/FaissBaseIndex.h +++ b/core/src/index/knowhere/knowhere/index/vector_index/FaissBaseIndex.h @@ -17,7 +17,7 @@ #include #include "knowhere/common/BinarySet.h" -#include "knowhere/index/vector_index/IndexType.h" +#include "knowhere/index/IndexType.h" namespace milvus { namespace knowhere { diff --git a/core/src/index/knowhere/knowhere/index/vector_index/IndexNSG.cpp b/core/src/index/knowhere/knowhere/index/vector_index/IndexNSG.cpp index fe9933e7..782e08c3 100644 --- a/core/src/index/knowhere/knowhere/index/vector_index/IndexNSG.cpp +++ b/core/src/index/knowhere/knowhere/index/vector_index/IndexNSG.cpp @@ -14,10 +14,10 @@ #include "knowhere/common/Exception.h" #include "knowhere/common/Timer.h" +#include "knowhere/index/IndexType.h" #include "knowhere/index/vector_index/IndexIDMAP.h" #include "knowhere/index/vector_index/IndexIVF.h" #include "knowhere/index/vector_index/IndexNSG.h" -#include "knowhere/index/vector_index/IndexType.h" #include "knowhere/index/vector_index/adapter/VectorAdapter.h" #include "knowhere/index/vector_index/impl/nsg/NSG.h" #include "knowhere/index/vector_index/impl/nsg/NSGIO.h" diff --git a/core/src/index/knowhere/knowhere/index/vector_index/VecIndex.h b/core/src/index/knowhere/knowhere/index/vector_index/VecIndex.h index 2bb3e181..35283cda 100644 --- a/core/src/index/knowhere/knowhere/index/vector_index/VecIndex.h +++ b/core/src/index/knowhere/knowhere/index/vector_index/VecIndex.h @@ -20,7 +20,7 @@ #include "knowhere/common/Exception.h" #include "knowhere/common/Typedef.h" #include "knowhere/index/Index.h" -#include "knowhere/index/vector_index/IndexType.h" +#include "knowhere/index/IndexType.h" namespace milvus { namespace knowhere { diff --git a/core/src/index/knowhere/knowhere/index/vector_index/VecIndexFactory.h b/core/src/index/knowhere/knowhere/index/vector_index/VecIndexFactory.h index 7a09b54b..c96bd1dc 100644 --- a/core/src/index/knowhere/knowhere/index/vector_index/VecIndexFactory.h +++ b/core/src/index/knowhere/knowhere/index/vector_index/VecIndexFactory.h @@ -13,7 +13,7 @@ #include -#include "knowhere/index/vector_index/IndexType.h" +#include "knowhere/index/IndexType.h" #include "knowhere/index/vector_index/VecIndex.h" namespace milvus { diff --git a/core/src/index/knowhere/knowhere/index/vector_index/gpu/IndexGPUIDMAP.cpp b/core/src/index/knowhere/knowhere/index/vector_index/gpu/IndexGPUIDMAP.cpp index 5bcc288c..2585f88b 100644 --- a/core/src/index/knowhere/knowhere/index/vector_index/gpu/IndexGPUIDMAP.cpp +++ b/core/src/index/knowhere/knowhere/index/vector_index/gpu/IndexGPUIDMAP.cpp @@ -19,8 +19,8 @@ #include #include "knowhere/common/Exception.h" +#include "knowhere/index/IndexType.h" #include "knowhere/index/vector_index/IndexIDMAP.h" -#include "knowhere/index/vector_index/IndexType.h" #include "knowhere/index/vector_index/adapter/VectorAdapter.h" #include "knowhere/index/vector_index/gpu/IndexGPUIDMAP.h" #include "knowhere/index/vector_index/helpers/FaissIO.h" diff --git a/core/src/index/knowhere/knowhere/index/vector_offset_index/IndexNSG_NM.cpp b/core/src/index/knowhere/knowhere/index/vector_offset_index/IndexNSG_NM.cpp index ad446fbe..496048d2 100644 --- a/core/src/index/knowhere/knowhere/index/vector_offset_index/IndexNSG_NM.cpp +++ b/core/src/index/knowhere/knowhere/index/vector_offset_index/IndexNSG_NM.cpp @@ -14,9 +14,9 @@ #include "knowhere/common/Exception.h" #include "knowhere/common/Timer.h" +#include "knowhere/index/IndexType.h" #include "knowhere/index/vector_index/IndexIDMAP.h" #include "knowhere/index/vector_index/IndexIVF.h" -#include "knowhere/index/vector_index/IndexType.h" #include "knowhere/index/vector_index/adapter/VectorAdapter.h" #include "knowhere/index/vector_index/impl/nsg/NSGIO.h" #include "knowhere/index/vector_offset_index/IndexNSG_NM.h" diff --git a/core/src/index/knowhere/knowhere/index/vector_offset_index/OffsetBaseIndex.cpp b/core/src/index/knowhere/knowhere/index/vector_offset_index/OffsetBaseIndex.cpp index 6becbba0..186eac4e 100644 --- a/core/src/index/knowhere/knowhere/index/vector_offset_index/OffsetBaseIndex.cpp +++ b/core/src/index/knowhere/knowhere/index/vector_offset_index/OffsetBaseIndex.cpp @@ -13,7 +13,7 @@ #include #include "knowhere/common/Exception.h" -#include "knowhere/index/vector_index/IndexType.h" +#include "knowhere/index/IndexType.h" #include "knowhere/index/vector_index/helpers/FaissIO.h" #include "knowhere/index/vector_offset_index/OffsetBaseIndex.h" diff --git a/core/src/index/knowhere/knowhere/index/vector_offset_index/OffsetBaseIndex.h b/core/src/index/knowhere/knowhere/index/vector_offset_index/OffsetBaseIndex.h index 19908ce3..029d8f9f 100644 --- a/core/src/index/knowhere/knowhere/index/vector_offset_index/OffsetBaseIndex.h +++ b/core/src/index/knowhere/knowhere/index/vector_offset_index/OffsetBaseIndex.h @@ -17,7 +17,7 @@ #include #include "knowhere/common/BinarySet.h" -#include "knowhere/index/vector_index/IndexType.h" +#include "knowhere/index/IndexType.h" namespace milvus { namespace knowhere { diff --git a/core/src/index/unittest/CMakeLists.txt b/core/src/index/unittest/CMakeLists.txt index 419b5516..e5e1cad6 100644 --- a/core/src/index/unittest/CMakeLists.txt +++ b/core/src/index/unittest/CMakeLists.txt @@ -31,7 +31,7 @@ set(util_srcs ${INDEX_SOURCE_DIR}/knowhere/knowhere/index/vector_index/adapter/VectorAdapter.cpp ${INDEX_SOURCE_DIR}/knowhere/knowhere/index/vector_index/helpers/FaissIO.cpp ${INDEX_SOURCE_DIR}/knowhere/knowhere/index/vector_index/helpers/IndexParameter.cpp - ${INDEX_SOURCE_DIR}/knowhere/knowhere/index/vector_index/IndexType.cpp + ${INDEX_SOURCE_DIR}/knowhere/knowhere/index/IndexType.cpp ${INDEX_SOURCE_DIR}/knowhere/knowhere/common/Exception.cpp ${INDEX_SOURCE_DIR}/knowhere/knowhere/common/Log.cpp ${INDEX_SOURCE_DIR}/knowhere/knowhere/common/Timer.cpp diff --git a/core/src/index/unittest/Helper.h b/core/src/index/unittest/Helper.h index f352b90e..8a9c8311 100644 --- a/core/src/index/unittest/Helper.h +++ b/core/src/index/unittest/Helper.h @@ -12,11 +12,11 @@ #include #include +#include "knowhere/index/IndexType.h" #include "knowhere/index/vector_index/IndexIVF.h" #include "knowhere/index/vector_index/IndexIVFPQ.h" #include "knowhere/index/vector_index/IndexIVFSQ.h" #include "knowhere/index/vector_index/IndexIVFSQNR.h" -#include "knowhere/index/vector_index/IndexType.h" #include "knowhere/index/vector_index/helpers/IndexParameter.h" #include "knowhere/index/vector_offset_index/IndexIVF_NM.h" diff --git a/core/src/index/unittest/test_customized_index.cpp b/core/src/index/unittest/test_customized_index.cpp index 03c55d45..0c877f06 100644 --- a/core/src/index/unittest/test_customized_index.cpp +++ b/core/src/index/unittest/test_customized_index.cpp @@ -15,7 +15,7 @@ #include #include "knowhere/common/Timer.h" -#include "knowhere/index/vector_index/IndexType.h" +#include "knowhere/index/IndexType.h" #include "unittest/Helper.h" #include "unittest/utils.h" diff --git a/core/src/index/unittest/test_gpuresource.cpp b/core/src/index/unittest/test_gpuresource.cpp index e70404e1..2c7a30a5 100644 --- a/core/src/index/unittest/test_gpuresource.cpp +++ b/core/src/index/unittest/test_gpuresource.cpp @@ -20,10 +20,10 @@ #include "knowhere/common/Exception.h" #include "knowhere/common/Timer.h" +#include "knowhere/index/IndexType.h" #include "knowhere/index/vector_index/IndexIVF.h" #include "knowhere/index/vector_index/IndexIVFPQ.h" #include "knowhere/index/vector_index/IndexIVFSQ.h" -#include "knowhere/index/vector_index/IndexType.h" #include "knowhere/index/vector_index/gpu/IndexGPUIVF.h" #include "knowhere/index/vector_index/gpu/IndexGPUIVFPQ.h" #include "knowhere/index/vector_index/gpu/IndexGPUIVFSQ.h" diff --git a/core/src/index/unittest/test_idmap.cpp b/core/src/index/unittest/test_idmap.cpp index 2abbd8e2..39a73553 100644 --- a/core/src/index/unittest/test_idmap.cpp +++ b/core/src/index/unittest/test_idmap.cpp @@ -17,8 +17,8 @@ #include #include "knowhere/common/Exception.h" +#include "knowhere/index/IndexType.h" #include "knowhere/index/vector_index/IndexIDMAP.h" -#include "knowhere/index/vector_index/IndexType.h" #ifdef MILVUS_GPU_VERSION #include #include "knowhere/index/vector_index/gpu/IndexGPUIDMAP.h" diff --git a/core/src/index/unittest/test_ivf.cpp b/core/src/index/unittest/test_ivf.cpp index 0e22836d..20d5d8c6 100644 --- a/core/src/index/unittest/test_ivf.cpp +++ b/core/src/index/unittest/test_ivf.cpp @@ -22,11 +22,11 @@ #include "knowhere/common/Exception.h" #include "knowhere/common/Timer.h" +#include "knowhere/index/IndexType.h" #include "knowhere/index/vector_index/IndexIVF.h" #include "knowhere/index/vector_index/IndexIVFPQ.h" #include "knowhere/index/vector_index/IndexIVFSQ.h" #include "knowhere/index/vector_index/IndexIVFSQNR.h" -#include "knowhere/index/vector_index/IndexType.h" #include "knowhere/index/vector_index/adapter/VectorAdapter.h" #ifdef MILVUS_GPU_VERSION diff --git a/core/src/index/unittest/test_ivf_cpu_nm.cpp b/core/src/index/unittest/test_ivf_cpu_nm.cpp index 61cf7d1a..56a5869a 100644 --- a/core/src/index/unittest/test_ivf_cpu_nm.cpp +++ b/core/src/index/unittest/test_ivf_cpu_nm.cpp @@ -22,7 +22,7 @@ #include "knowhere/common/Exception.h" #include "knowhere/common/Timer.h" -#include "knowhere/index/vector_index/IndexType.h" +#include "knowhere/index/IndexType.h" #include "knowhere/index/vector_index/adapter/VectorAdapter.h" #include "knowhere/index/vector_offset_index/IndexIVF_NM.h" diff --git a/core/src/index/unittest/test_ivf_gpu_nm.cpp b/core/src/index/unittest/test_ivf_gpu_nm.cpp index ec7087a2..7c9c6e14 100644 --- a/core/src/index/unittest/test_ivf_gpu_nm.cpp +++ b/core/src/index/unittest/test_ivf_gpu_nm.cpp @@ -22,7 +22,7 @@ #include "knowhere/common/Exception.h" #include "knowhere/common/Timer.h" -#include "knowhere/index/vector_index/IndexType.h" +#include "knowhere/index/IndexType.h" #include "knowhere/index/vector_index/adapter/VectorAdapter.h" #include "knowhere/index/vector_offset_index/IndexIVF_NM.h" diff --git a/core/src/index/unittest/test_vecindex.cpp b/core/src/index/unittest/test_vecindex.cpp index dc231f64..713e9d79 100644 --- a/core/src/index/unittest/test_vecindex.cpp +++ b/core/src/index/unittest/test_vecindex.cpp @@ -11,7 +11,7 @@ #include -#include "knowhere/index/vector_index/IndexType.h" +#include "knowhere/index/IndexType.h" #include "knowhere/index/vector_index/VecIndex.h" #include "knowhere/index/vector_index/VecIndexFactory.h" #include "knowhere/index/vector_index/helpers/FaissGpuResourceMgr.h" diff --git a/core/src/scheduler/Definition.h b/core/src/scheduler/Definition.h index 10526804..ed5fcb89 100644 --- a/core/src/scheduler/Definition.h +++ b/core/src/scheduler/Definition.h @@ -35,6 +35,7 @@ using ExecutionEnginePtr = engine::ExecutionEnginePtr; using EngineFactory = engine::EngineFactory; using EngineType = engine::EngineType; using MetricType = engine::MetricType; +using DataType = engine::meta::hybrid::DataType; constexpr uint64_t TASK_TABLE_MAX_COUNT = 1ULL << 16ULL; diff --git a/core/src/scheduler/task/SearchTask.cpp b/core/src/scheduler/task/SearchTask.cpp index 78e879cd..031d0224 100644 --- a/core/src/scheduler/task/SearchTask.cpp +++ b/core/src/scheduler/task/SearchTask.cpp @@ -127,11 +127,11 @@ XSearchTask::XSearchTask(const std::shared_ptr& context, Segmen // auto search_job = std::static_pointer_cast(job); // query::GeneralQueryPtr general_query = search_job->general_query(); // if (general_query != nullptr) { - // std::unordered_map types; + // std::unordered_map types; // auto attr_type = search_job->attr_type(); // auto type_it = attr_type.begin(); // for (; type_it != attr_type.end(); type_it++) { - // types.insert(std::make_pair(type_it->first, (engine::DataType)(type_it->second))); + // types.insert(std::make_pair(type_it->first, (DataType)(type_it->second))); // } // index_engine_ = // EngineFactory::Build(file_->dimension_, file_->location_, engine_type, @@ -250,11 +250,11 @@ XSearchTask::Execute() { } Status s; if (general_query != nullptr) { - std::unordered_map types; + std::unordered_map types; auto attr_type = search_job->attr_type(); auto type_it = attr_type.begin(); for (; type_it != attr_type.end(); type_it++) { - types.insert(std::make_pair(type_it->first, (engine::DataType)(type_it->second))); + types.insert(std::make_pair(type_it->first, (DataType)(type_it->second))); } auto query_ptr = search_job->query_ptr(); -- GitLab