From 0d0b8eeb3f5c24b14fe09f51861ef28321b5b8a0 Mon Sep 17 00:00:00 2001 From: "xj.lin" Date: Mon, 19 Aug 2019 11:11:28 +0800 Subject: [PATCH] MS372 fix unittest Former-commit-id: 78f0c12c86ed19158b982d1f460e4a2497bb0585 --- cpp/src/db/meta/SqliteMetaImpl.cpp | 14 +++++++------- cpp/unittest/server/cache_test.cpp | 8 ++++++++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/cpp/src/db/meta/SqliteMetaImpl.cpp b/cpp/src/db/meta/SqliteMetaImpl.cpp index 9411a5e8..9053139e 100644 --- a/cpp/src/db/meta/SqliteMetaImpl.cpp +++ b/cpp/src/db/meta/SqliteMetaImpl.cpp @@ -606,9 +606,9 @@ Status SqliteMetaImpl::FilesToSearch(const std::string &table_id, &TableFileSchema::engine_type_); auto match_tableid = c(&TableFileSchema::table_id_) == table_id; - auto is_raw = c(&TableFileSchema::file_type_) == (int) TableFileSchema::RAW; - auto is_toindex = c(&TableFileSchema::file_type_) == (int) TableFileSchema::TO_INDEX; - auto is_index = c(&TableFileSchema::file_type_) == (int) TableFileSchema::INDEX; + + std::vector file_type = {(int) TableFileSchema::RAW, (int) TableFileSchema::TO_INDEX, (int) TableFileSchema::INDEX}; + auto match_type = in(&TableFileSchema::file_type_, file_type); TableSchema table_schema; table_schema.table_id_ = table_id; @@ -617,23 +617,23 @@ Status SqliteMetaImpl::FilesToSearch(const std::string &table_id, decltype(ConnectorPtr->select(select_columns)) result; if (partition.empty() && ids.empty()) { - auto filter = where(match_tableid and (is_raw or is_toindex or is_index)); + auto filter = where(match_tableid and match_type); result = ConnectorPtr->select(select_columns, filter); } else if (partition.empty() && !ids.empty()) { auto match_fileid = in(&TableFileSchema::id_, ids); - auto filter = where(match_tableid and match_fileid and (is_raw or is_toindex or is_index)); + auto filter = where(match_tableid and match_fileid and match_type); result = ConnectorPtr->select(select_columns, filter); } else if (!partition.empty() && ids.empty()) { auto match_date = in(&TableFileSchema::date_, partition); - auto filter = where(match_tableid and match_date and (is_raw or is_toindex or is_index)); + auto filter = where(match_tableid and match_date and match_type); result = ConnectorPtr->select(select_columns, filter); } else if (!partition.empty() && !ids.empty()) { auto match_fileid = in(&TableFileSchema::id_, ids); auto match_date = in(&TableFileSchema::date_, partition); - auto filter = where(match_tableid and match_fileid and match_date and (is_raw or is_toindex or is_index)); + auto filter = where(match_tableid and match_fileid and match_date and match_type); result = ConnectorPtr->select(select_columns, filter); } diff --git a/cpp/unittest/server/cache_test.cpp b/cpp/unittest/server/cache_test.cpp index df2a869e..4f1d1db4 100644 --- a/cpp/unittest/server/cache_test.cpp +++ b/cpp/unittest/server/cache_test.cpp @@ -39,6 +39,14 @@ public: } + engine::VecIndexPtr Clone() override { + return zilliz::milvus::engine::VecIndexPtr(); + } + + int64_t GetDeviceId() override { + return 0; + } + engine::IndexType GetType() override { return engine::IndexType::INVALID; } -- GitLab