From af1d13573cad05e1ae6d30e64187e2ad646c6a91 Mon Sep 17 00:00:00 2001 From: bright-starry-sky <56461666+bright-starry-sky@users.noreply.github.com> Date: Mon, 6 Sep 2021 20:32:38 +0800 Subject: [PATCH] lookup limit --- src/clients/storage/GraphStorageClient.cpp | 10 +- src/interface/storage.thrift | 5 +- src/storage/exec/IndexEdgeNode.h | 11 +- src/storage/exec/IndexScanNode.h | 10 +- src/storage/exec/IndexVertexNode.h | 11 +- src/storage/index/LookupBaseProcessor-inl.h | 34 +-- src/storage/index/LookupBaseProcessor.h | 1 + src/storage/test/DeleteTagsTest.cpp | 5 +- src/storage/test/IndexWithTTLTest.cpp | 29 ++- src/storage/test/LookupIndexTest.cpp | 229 ++++++++++++-------- 10 files changed, 215 insertions(+), 130 deletions(-) diff --git a/src/clients/storage/GraphStorageClient.cpp b/src/clients/storage/GraphStorageClient.cpp index 62c2419c72c..f91d747936a 100644 --- a/src/clients/storage/GraphStorageClient.cpp +++ b/src/clients/storage/GraphStorageClient.cpp @@ -451,11 +451,18 @@ folly::SemiFuture> GraphStorageClient: int32_t tagOrEdge, const std::vector& returnCols, folly::EventBase* evb) { + // TODO(sky) : instead of isEdge and tagOrEdge to nebula::cpp2::SchemaID for graph layer. auto status = getHostParts(space); if (!status.ok()) { return folly::makeFuture>( std::runtime_error(status.status().toString())); } + nebula::cpp2::SchemaID schemaId; + if (isEdge) { + schemaId.set_edge_type(tagOrEdge); + } else { + schemaId.set_tag_id(tagOrEdge); + } auto& clusters = status.value(); std::unordered_map requests; @@ -468,8 +475,7 @@ folly::SemiFuture> GraphStorageClient: cpp2::IndexSpec spec; spec.set_contexts(contexts); - spec.set_is_edge(isEdge); - spec.set_tag_or_edge_id(tagOrEdge); + spec.set_schema_id(schemaId); req.set_indices(spec); } diff --git a/src/interface/storage.thrift b/src/interface/storage.thrift index 7e70531f369..020311b0b75 100644 --- a/src/interface/storage.thrift +++ b/src/interface/storage.thrift @@ -509,8 +509,7 @@ struct IndexQueryContext { struct IndexSpec { // In order to union multiple indices, multiple index hints are allowed 1: required list contexts, - 2: required bool is_edge, - 3: required i32 tag_or_edge_id, + 2: common.SchemaID schema_id, } @@ -521,6 +520,8 @@ struct LookupIndexRequest { // The list of property names. Should not be empty. // Support kVid and kTag for vertex, kSrc, kType, kRank and kDst for edge. 4: optional list return_columns, + // max row count of each partition in this response, 0 means no limit. + 5: i64 limit = 0, } diff --git a/src/storage/exec/IndexEdgeNode.h b/src/storage/exec/IndexEdgeNode.h index 7759388da1d..82c8e6616e1 100644 --- a/src/storage/exec/IndexEdgeNode.h +++ b/src/storage/exec/IndexEdgeNode.h @@ -21,11 +21,13 @@ class IndexEdgeNode final : public RelNode { IndexEdgeNode(RuntimeContext* context, IndexScanNode* indexScanNode, const std::vector>& schemas, - const std::string& schemaName) + const std::string& schemaName, + int64_t limit = 0) : context_(context), indexScanNode_(indexScanNode), schemas_(schemas), - schemaName_(schemaName) {} + schemaName_(schemaName), + limit_(limit) {} nebula::cpp2::ErrorCode execute(PartitionID partId) override { auto ret = RelNode::execute(partId); @@ -38,6 +40,7 @@ class IndexEdgeNode final : public RelNode { data_.clear(); std::vector edges; auto* iter = static_cast(indexScanNode_->iterator()); + int64_t count = 0; while (iter && iter->valid()) { if (!iter->val().empty() && ttlProp.first) { auto v = IndexKeyUtils::parseIndexTTL(iter->val()); @@ -54,6 +57,9 @@ class IndexEdgeNode final : public RelNode { edge.set_dst(iter->dstId()); edges.emplace_back(std::move(edge)); iter->next(); + if (limit_ > 0 && ++count == limit_) { + break; + } } for (const auto& edge : edges) { auto key = NebulaKeyUtils::edgeKey(context_->vIdLen(), @@ -88,6 +94,7 @@ class IndexEdgeNode final : public RelNode { IndexScanNode* indexScanNode_; const std::vector>& schemas_; const std::string& schemaName_; + int64_t limit_; std::vector data_; }; diff --git a/src/storage/exec/IndexScanNode.h b/src/storage/exec/IndexScanNode.h index c6baacb9fd5..ba6d247201d 100644 --- a/src/storage/exec/IndexScanNode.h +++ b/src/storage/exec/IndexScanNode.h @@ -20,8 +20,9 @@ class IndexScanNode : public RelNode { IndexScanNode(RuntimeContext* context, IndexID indexId, - std::vector columnHints) - : context_(context), indexId_(indexId), columnHints_(std::move(columnHints)) { + std::vector columnHints, + int64_t limit = 0) + : context_(context), indexId_(indexId), columnHints_(std::move(columnHints)), limit_(limit) { /** * columnHints's elements are {scanType = PREFIX|RANGE; beginStr; endStr}, * {scanType = PREFIX|RANGE; beginStr; @@ -70,6 +71,7 @@ class IndexScanNode : public RelNode { auto* sh = context_->isEdge() ? context_->edgeSchema_ : context_->tagSchema_; auto ttlProp = CommonUtils::ttlProps(sh); data_.clear(); + int64_t count = 0; while (!!iter_ && iter_->valid()) { if (!iter_->val().empty() && ttlProp.first) { auto v = IndexKeyUtils::parseIndexTTL(iter_->val()); @@ -81,6 +83,9 @@ class IndexScanNode : public RelNode { } data_.emplace_back(iter_->key(), ""); iter_->next(); + if (limit_ > 0 && ++count == limit_) { + break; + } } return std::move(data_); } @@ -168,6 +173,7 @@ class IndexScanNode : public RelNode { std::unique_ptr iter_; std::pair scanPair_; std::vector columnHints_; + int64_t limit_; std::vector data_; }; diff --git a/src/storage/exec/IndexVertexNode.h b/src/storage/exec/IndexVertexNode.h index a44b4def21b..54f9de9d6a8 100644 --- a/src/storage/exec/IndexVertexNode.h +++ b/src/storage/exec/IndexVertexNode.h @@ -21,11 +21,13 @@ class IndexVertexNode final : public RelNode { IndexVertexNode(RuntimeContext* context, IndexScanNode* indexScanNode, const std::vector>& schemas, - const std::string& schemaName) + const std::string& schemaName, + int64_t limit = 0) : context_(context), indexScanNode_(indexScanNode), schemas_(schemas), - schemaName_(schemaName) {} + schemaName_(schemaName), + limit_(limit) {} nebula::cpp2::ErrorCode execute(PartitionID partId) override { auto ret = RelNode::execute(partId); @@ -38,6 +40,7 @@ class IndexVertexNode final : public RelNode { data_.clear(); std::vector vids; auto* iter = static_cast(indexScanNode_->iterator()); + int64_t count = 0; while (iter && iter->valid()) { if (!iter->val().empty() && ttlProp.first) { auto v = IndexKeyUtils::parseIndexTTL(iter->val()); @@ -49,6 +52,9 @@ class IndexVertexNode final : public RelNode { } vids.emplace_back(iter->vId()); iter->next(); + if (limit_ > 0 && ++count == limit_) { + break; + } } for (const auto& vId : vids) { VLOG(1) << "partId " << partId << ", vId " << vId << ", tagId " << context_->tagId_; @@ -79,6 +85,7 @@ class IndexVertexNode final : public RelNode { IndexScanNode* indexScanNode_; const std::vector>& schemas_; const std::string& schemaName_; + int64_t limit_; std::vector data_; }; diff --git a/src/storage/index/LookupBaseProcessor-inl.h b/src/storage/index/LookupBaseProcessor-inl.h index 069bd9bd52e..9af8cd3bcce 100644 --- a/src/storage/index/LookupBaseProcessor-inl.h +++ b/src/storage/index/LookupBaseProcessor-inl.h @@ -22,10 +22,11 @@ nebula::cpp2::ErrorCode LookupBaseProcessor::requestCheck( this->planContext_ = std::make_unique(this->env_, spaceId_, this->spaceVidLen_, this->isIntId_); const auto& indices = req.get_indices(); - this->planContext_->isEdge_ = indices.get_is_edge(); + const auto& schemaId = indices.get_schema_id(); + this->planContext_->isEdge_ = schemaId.getType() == nebula::cpp2::SchemaID::Type::edge_type; this->context_ = std::make_unique(this->planContext_.get()); if (context_->isEdge()) { - context_->edgeType_ = indices.get_tag_or_edge_id(); + context_->edgeType_ = schemaId.get_edge_type(); auto edgeName = this->env_->schemaMan_->toEdgeName(spaceId_, context_->edgeType_); if (!edgeName.ok()) { return nebula::cpp2::ErrorCode::E_EDGE_NOT_FOUND; @@ -41,7 +42,7 @@ nebula::cpp2::ErrorCode LookupBaseProcessor::requestCheck( schemas_ = std::move(allEdges).value()[context_->edgeType_]; context_->edgeSchema_ = schemas_.back().get(); } else { - context_->tagId_ = indices.get_tag_or_edge_id(); + context_->tagId_ = schemaId.get_tag_id(); auto tagName = this->env_->schemaMan_->toTagName(spaceId_, context_->tagId_); if (!tagName.ok()) { return nebula::cpp2::ErrorCode::E_TAG_NOT_FOUND; @@ -76,6 +77,9 @@ nebula::cpp2::ErrorCode LookupBaseProcessor::requestCheck( } } + // limit + limit_ = req.get_limit(); + return nebula::cpp2::ErrorCode::SUCCEEDED; } @@ -276,8 +280,8 @@ std::unique_ptr> LookupBaseProcessor::buildP const std::vector& fields) { auto indexId = ctx.get_index_id(); auto colHints = ctx.get_column_hints(); - auto indexScan = - std::make_unique>(context_.get(), indexId, std::move(colHints)); + auto indexScan = std::make_unique>( + context_.get(), indexId, std::move(colHints), limit_); auto output = std::make_unique>( result, context_.get(), indexScan.get(), hasNullableCol, fields); @@ -310,11 +314,11 @@ std::unique_ptr> LookupBaseProcessor::buildP auto indexId = ctx.get_index_id(); auto colHints = ctx.get_column_hints(); - auto indexScan = - std::make_unique>(context_.get(), indexId, std::move(colHints)); + auto indexScan = std::make_unique>( + context_.get(), indexId, std::move(colHints), limit_); if (context_->isEdge()) { auto edge = std::make_unique>( - context_.get(), indexScan.get(), schemas_, context_->edgeName_); + context_.get(), indexScan.get(), schemas_, context_->edgeName_, limit_); edge->addDependency(indexScan.get()); auto output = std::make_unique>(result, context_.get(), edge.get()); output->addDependency(edge.get()); @@ -323,7 +327,7 @@ std::unique_ptr> LookupBaseProcessor::buildP return output; } else { auto vertex = std::make_unique>( - context_.get(), indexScan.get(), schemas_, context_->tagName_); + context_.get(), indexScan.get(), schemas_, context_->tagName_, limit_); vertex->addDependency(indexScan.get()); auto output = std::make_unique>(result, context_.get(), vertex.get()); output->addDependency(vertex.get()); @@ -361,8 +365,8 @@ std::unique_ptr> LookupBaseProcessor::buildP auto indexId = ctx.get_index_id(); auto colHints = ctx.get_column_hints(); - auto indexScan = - std::make_unique>(context_.get(), indexId, std::move(colHints)); + auto indexScan = std::make_unique>( + context_.get(), indexId, std::move(colHints), limit_); auto filter = std::make_unique>(indexScan.get(), exprCtx, exp, context_->isEdge()); @@ -412,11 +416,11 @@ LookupBaseProcessor::buildPlanWithDataAndFilter(nebula::DataSet* resu auto indexId = ctx.get_index_id(); auto colHints = ctx.get_column_hints(); - auto indexScan = - std::make_unique>(context_.get(), indexId, std::move(colHints)); + auto indexScan = std::make_unique>( + context_.get(), indexId, std::move(colHints), limit_); if (context_->isEdge()) { auto edge = std::make_unique>( - context_.get(), indexScan.get(), schemas_, context_->edgeName_); + context_.get(), indexScan.get(), schemas_, context_->edgeName_, limit_); edge->addDependency(indexScan.get()); auto filter = std::make_unique>(edge.get(), exprCtx, exp); filter->addDependency(edge.get()); @@ -429,7 +433,7 @@ LookupBaseProcessor::buildPlanWithDataAndFilter(nebula::DataSet* resu return output; } else { auto vertex = std::make_unique>( - context_.get(), indexScan.get(), schemas_, context_->tagName_); + context_.get(), indexScan.get(), schemas_, context_->tagName_, limit_); vertex->addDependency(indexScan.get()); auto filter = std::make_unique>(vertex.get(), exprCtx, exp); filter->addDependency(vertex.get()); diff --git a/src/storage/index/LookupBaseProcessor.h b/src/storage/index/LookupBaseProcessor.h index 967b4752d7c..a170af6d106 100644 --- a/src/storage/index/LookupBaseProcessor.h +++ b/src/storage/index/LookupBaseProcessor.h @@ -81,6 +81,7 @@ class LookupBaseProcessor : public BaseProcessor { // Save schemas when column is out of index, need to read from data std::vector> schemas_; std::vector deDupColPos_; + int64_t limit_ = 0; }; } // namespace storage diff --git a/src/storage/test/DeleteTagsTest.cpp b/src/storage/test/DeleteTagsTest.cpp index e6544c15016..abd9e7889bd 100644 --- a/src/storage/test/DeleteTagsTest.cpp +++ b/src/storage/test/DeleteTagsTest.cpp @@ -58,8 +58,9 @@ cpp2::LookupIndexRequest buildLookupRequest(int32_t totalParts, std::string play cpp2::LookupIndexRequest req; nebula::storage::cpp2::IndexSpec indices; req.set_space_id(1); - indices.set_tag_or_edge_id(1); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(1); + indices.set_schema_id(schemaId); std::vector parts; for (PartitionID partId = 1; partId <= totalParts; partId++) { parts.emplace_back(partId); diff --git a/src/storage/test/IndexWithTTLTest.cpp b/src/storage/test/IndexWithTTLTest.cpp index babd7157074..b6df7192e08 100644 --- a/src/storage/test/IndexWithTTLTest.cpp +++ b/src/storage/test/IndexWithTTLTest.cpp @@ -441,7 +441,7 @@ TEST(IndexWithTTLTest, RebuildTagIndexWithTTL) { // Wait for the task finished do { - usleep(500); + sleep(1); } while (!manager_->isFinished(context.jobId_, context.taskId_)); manager_->shutdown(); @@ -510,7 +510,7 @@ TEST(IndexWithTTLTest, RebuildEdgeIndexWithTTL) { // Wait for the task finished do { - usleep(500); + sleep(1); } while (!manager_->isFinished(context.jobId_, context.taskId_)); manager_->shutdown(); @@ -581,7 +581,7 @@ TEST(IndexWithTTLTest, RebuildTagIndexWithTTLExpired) { // Wait for the task finished do { - usleep(500); + sleep(1); } while (!manager_->isFinished(context.jobId_, context.taskId_)); manager_->shutdown(); @@ -652,7 +652,7 @@ TEST(IndexWithTTLTest, RebuildEdgeIndexWithTTLExpired) { // Wait for the task finished do { - usleep(500); + sleep(1); } while (!manager_->isFinished(context.jobId_, context.taskId_)); manager_->shutdown(); @@ -686,8 +686,9 @@ TEST(IndexWithTTLTest, LookupTagIndexWithTTL) { cpp2::LookupIndexRequest req; nebula::storage::cpp2::IndexSpec indices; req.set_space_id(1); - indices.set_tag_or_edge_id(2021001); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(2021001); + indices.set_schema_id(schemaId); std::vector parts; for (int32_t p = 1; p <= 6; p++) { parts.emplace_back(p); @@ -729,8 +730,10 @@ TEST(IndexWithTTLTest, LookupEdgeIndexWithTTL) { cpp2::LookupIndexRequest req; nebula::storage::cpp2::IndexSpec indices; req.set_space_id(1); - indices.set_tag_or_edge_id(2021001); - indices.set_is_edge(true); + nebula::cpp2::SchemaID schemaId; + schemaId.set_edge_type(2021001); + indices.set_schema_id(schemaId); + std::vector parts; for (int32_t p = 1; p <= 6; p++) { parts.emplace_back(p); @@ -774,8 +777,9 @@ TEST(IndexWithTTLTest, LookupTagIndexWithTTLExpired) { cpp2::LookupIndexRequest req; nebula::storage::cpp2::IndexSpec indices; req.set_space_id(1); - indices.set_tag_or_edge_id(2021001); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(2021001); + indices.set_schema_id(schemaId); std::vector parts; for (int32_t p = 1; p <= 6; p++) { parts.emplace_back(p); @@ -819,8 +823,9 @@ TEST(IndexWithTTLTest, LookupEdgeIndexWithTTLExpired) { cpp2::LookupIndexRequest req; nebula::storage::cpp2::IndexSpec indices; req.set_space_id(1); - indices.set_tag_or_edge_id(2021001); - indices.set_is_edge(true); + nebula::cpp2::SchemaID schemaId; + schemaId.set_edge_type(2021001); + indices.set_schema_id(schemaId); std::vector parts; for (int32_t p = 1; p <= 6; p++) { parts.emplace_back(p); diff --git a/src/storage/test/LookupIndexTest.cpp b/src/storage/test/LookupIndexTest.cpp index 4354be9bf91..c9d35dc892e 100644 --- a/src/storage/test/LookupIndexTest.cpp +++ b/src/storage/test/LookupIndexTest.cpp @@ -130,7 +130,9 @@ TEST_P(LookupIndexTest, LookupIndexTestV1) { cpp2::LookupIndexRequest req; nebula::storage::cpp2::IndexSpec indices; req.set_space_id(1); - indices.set_tag_or_edge_id(3); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(3); + indices.set_schema_id(schemaId); std::vector parts; for (int32_t p = 1; p <= totalParts; p++) { parts.emplace_back(p); @@ -220,8 +222,9 @@ TEST_P(LookupIndexTest, SimpleTagIndexTest) { cpp2::LookupIndexRequest req; nebula::storage::cpp2::IndexSpec indices; req.set_space_id(spaceId); - indices.set_tag_or_edge_id(1); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(1); + indices.set_schema_id(schemaId); std::vector parts; for (int32_t p = 1; p <= totalParts; p++) { parts.emplace_back(p); @@ -287,8 +290,9 @@ TEST_P(LookupIndexTest, SimpleTagIndexTest) { cpp2::LookupIndexRequest req; nebula::storage::cpp2::IndexSpec indices; req.set_space_id(spaceId); - indices.set_tag_or_edge_id(1); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(1); + indices.set_schema_id(schemaId); std::vector parts; for (int32_t p = 1; p <= totalParts; p++) { parts.emplace_back(p); @@ -389,8 +393,9 @@ TEST_P(LookupIndexTest, SimpleEdgeIndexTest) { cpp2::LookupIndexRequest req; nebula::storage::cpp2::IndexSpec indices; req.set_space_id(spaceId); - indices.set_tag_or_edge_id(102); - indices.set_is_edge(true); + nebula::cpp2::SchemaID schemaId; + schemaId.set_edge_type(102); + indices.set_schema_id(schemaId); std::vector parts; for (int32_t p = 1; p <= totalParts; p++) { parts.emplace_back(p); @@ -473,8 +478,9 @@ TEST_P(LookupIndexTest, SimpleEdgeIndexTest) { cpp2::LookupIndexRequest req; nebula::storage::cpp2::IndexSpec indices; req.set_space_id(spaceId); - indices.set_tag_or_edge_id(102); - indices.set_is_edge(true); + nebula::cpp2::SchemaID schemaId; + schemaId.set_edge_type(102); + indices.set_schema_id(schemaId); std::vector parts; for (int32_t p = 1; p <= totalParts; p++) { parts.emplace_back(p); @@ -605,8 +611,9 @@ TEST_P(LookupIndexTest, TagIndexFilterTest) { cpp2::LookupIndexRequest req; nebula::storage::cpp2::IndexSpec indices; req.set_space_id(spaceId); - indices.set_tag_or_edge_id(1); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(1); + indices.set_schema_id(schemaId); std::vector parts; for (int32_t p = 1; p <= totalParts; p++) { parts.emplace_back(p); @@ -680,8 +687,9 @@ TEST_P(LookupIndexTest, TagIndexFilterTest) { cpp2::LookupIndexRequest req; nebula::storage::cpp2::IndexSpec indices; req.set_space_id(spaceId); - indices.set_tag_or_edge_id(1); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(1); + indices.set_schema_id(schemaId); std::vector parts; for (int32_t p = 1; p <= totalParts; p++) { parts.emplace_back(p); @@ -762,8 +770,9 @@ TEST_P(LookupIndexTest, EdgeIndexFilterTest) { cpp2::LookupIndexRequest req; nebula::storage::cpp2::IndexSpec indices; req.set_space_id(spaceId); - indices.set_tag_or_edge_id(102); - indices.set_is_edge(true); + nebula::cpp2::SchemaID schemaId; + schemaId.set_edge_type(102); + indices.set_schema_id(schemaId); std::vector parts; for (int32_t p = 1; p <= totalParts; p++) { parts.emplace_back(p); @@ -855,8 +864,9 @@ TEST_P(LookupIndexTest, EdgeIndexFilterTest) { cpp2::LookupIndexRequest req; nebula::storage::cpp2::IndexSpec indices; req.set_space_id(spaceId); - indices.set_tag_or_edge_id(102); - indices.set_is_edge(true); + nebula::cpp2::SchemaID schemaId; + schemaId.set_edge_type(102); + indices.set_schema_id(schemaId); std::vector parts; for (int32_t p = 1; p <= totalParts; p++) { parts.emplace_back(p); @@ -941,8 +951,9 @@ TEST_P(LookupIndexTest, TagIndexWithDataTest) { cpp2::LookupIndexRequest req; nebula::storage::cpp2::IndexSpec indices; req.set_space_id(spaceId); - indices.set_tag_or_edge_id(1); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(1); + indices.set_schema_id(schemaId); std::vector parts; for (int32_t p = 1; p <= totalParts; p++) { parts.emplace_back(p); @@ -1027,8 +1038,9 @@ TEST_P(LookupIndexTest, EdgeIndexWithDataTest) { cpp2::LookupIndexRequest req; nebula::storage::cpp2::IndexSpec indices; req.set_space_id(spaceId); - indices.set_tag_or_edge_id(102); - indices.set_is_edge(true); + nebula::cpp2::SchemaID schemaId; + schemaId.set_edge_type(102); + indices.set_schema_id(schemaId); std::vector parts; for (int32_t p = 1; p <= totalParts; p++) { parts.emplace_back(p); @@ -1125,8 +1137,9 @@ TEST_P(LookupIndexTest, TagWithPropStatsVerticesIndexTest) { cpp2::LookupIndexRequest req; nebula::storage::cpp2::IndexSpec indices; req.set_space_id(spaceId); - indices.set_tag_or_edge_id(1); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(1); + indices.set_schema_id(schemaId); std::vector parts; for (int32_t p = 1; p <= totalParts; p++) { parts.emplace_back(p); @@ -1197,8 +1210,9 @@ TEST_P(LookupIndexTest, TagWithoutPropStatsVerticesIndexTest) { cpp2::LookupIndexRequest req; nebula::storage::cpp2::IndexSpec indices; req.set_space_id(spaceId); - indices.set_tag_or_edge_id(1); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(1); + indices.set_schema_id(schemaId); std::vector parts; for (int32_t p = 1; p <= totalParts; p++) { parts.emplace_back(p); @@ -1270,8 +1284,9 @@ TEST_P(LookupIndexTest, EdgeWithPropStatsVerticesIndexTest) { cpp2::LookupIndexRequest req; nebula::storage::cpp2::IndexSpec indices; req.set_space_id(spaceId); - indices.set_tag_or_edge_id(101); - indices.set_is_edge(true); + nebula::cpp2::SchemaID schemaId; + schemaId.set_edge_type(101); + indices.set_schema_id(schemaId); std::vector parts; for (int32_t p = 1; p <= totalParts; p++) { parts.emplace_back(p); @@ -1352,8 +1367,9 @@ TEST_P(LookupIndexTest, EdgeWithoutPropStatsVerticesIndexTest) { cpp2::LookupIndexRequest req; nebula::storage::cpp2::IndexSpec indices; req.set_space_id(spaceId); - indices.set_tag_or_edge_id(101); - indices.set_is_edge(true); + nebula::cpp2::SchemaID schemaId; + schemaId.set_edge_type(101); + indices.set_schema_id(schemaId); std::vector parts; for (int32_t p = 1; p <= totalParts; p++) { parts.emplace_back(p); @@ -1580,8 +1596,9 @@ TEST_P(LookupIndexTest, NullableInIndexAndFilterTest) { context.set_column_hints({columnHint}); cpp2::IndexSpec indices; - indices.set_tag_or_edge_id(111); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(111); + indices.set_schema_id(schemaId); indices.set_contexts({context}); req.set_indices(std::move(indices)); @@ -1606,8 +1623,9 @@ TEST_P(LookupIndexTest, NullableInIndexAndFilterTest) { context.set_column_hints({columnHint}); cpp2::IndexSpec indices; - indices.set_tag_or_edge_id(111); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(111); + indices.set_schema_id(schemaId); indices.set_contexts({context}); req.set_indices(std::move(indices)); @@ -1644,8 +1662,9 @@ TEST_P(LookupIndexTest, NullableInIndexAndFilterTest) { context.set_column_hints(std::move(columnHints)); cpp2::IndexSpec indices; - indices.set_tag_or_edge_id(111); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(111); + indices.set_schema_id(schemaId); indices.set_contexts({context}); req.set_indices(std::move(indices)); @@ -1672,8 +1691,9 @@ TEST_P(LookupIndexTest, NullableInIndexAndFilterTest) { context.set_column_hints({columnHint}); cpp2::IndexSpec indices; - indices.set_tag_or_edge_id(111); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(111); + indices.set_schema_id(schemaId); indices.set_contexts({context}); req.set_indices(std::move(indices)); @@ -1700,8 +1720,9 @@ TEST_P(LookupIndexTest, NullableInIndexAndFilterTest) { context.set_column_hints({columnHint}); cpp2::IndexSpec indices; - indices.set_tag_or_edge_id(111); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(111); + indices.set_schema_id(schemaId); indices.set_contexts({context}); req.set_indices(std::move(indices)); @@ -1730,8 +1751,9 @@ TEST_P(LookupIndexTest, NullableInIndexAndFilterTest) { context.set_column_hints({columnHint}); cpp2::IndexSpec indices; - indices.set_tag_or_edge_id(111); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(111); + indices.set_schema_id(schemaId); indices.set_contexts({context}); req.set_indices(std::move(indices)); @@ -1776,8 +1798,9 @@ TEST_P(LookupIndexTest, NullableInIndexAndFilterTest) { context.set_column_hints(columnHints); cpp2::IndexSpec indices; - indices.set_tag_or_edge_id(111); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(111); + indices.set_schema_id(schemaId); indices.set_contexts({context}); req.set_indices(std::move(indices)); @@ -1821,8 +1844,9 @@ TEST_P(LookupIndexTest, NullableInIndexAndFilterTest) { context.set_column_hints(columnHints); cpp2::IndexSpec indices; - indices.set_tag_or_edge_id(111); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(111); + indices.set_schema_id(schemaId); indices.set_contexts({context}); req.set_indices(std::move(indices)); @@ -1869,9 +1893,10 @@ TEST_P(LookupIndexTest, NullableInIndexAndFilterTest) { context.set_index_id(222); context.set_column_hints(columnHints); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(111); cpp2::IndexSpec indices; - indices.set_tag_or_edge_id(111); - indices.set_is_edge(false); + indices.set_schema_id(schemaId); indices.set_contexts({context}); req.set_indices(std::move(indices)); @@ -2084,8 +2109,9 @@ TEST_P(LookupIndexTest, NullablePropertyTest) { context.set_column_hints(std::move(columnHints)); cpp2::IndexSpec indices; - indices.set_tag_or_edge_id(111); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(111); + indices.set_schema_id(schemaId); indices.set_contexts({context}); req.set_indices(std::move(indices)); @@ -2111,8 +2137,9 @@ TEST_P(LookupIndexTest, NullablePropertyTest) { context.set_column_hints(std::move(columnHints)); cpp2::IndexSpec indices; - indices.set_tag_or_edge_id(111); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(111); + indices.set_schema_id(schemaId); indices.set_contexts({context}); req.set_indices(std::move(indices)); @@ -2138,8 +2165,9 @@ TEST_P(LookupIndexTest, NullablePropertyTest) { context.set_column_hints(std::move(columnHints)); cpp2::IndexSpec indices; - indices.set_tag_or_edge_id(111); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(111); + indices.set_schema_id(schemaId); indices.set_contexts({context}); req.set_indices(std::move(indices)); @@ -2165,8 +2193,9 @@ TEST_P(LookupIndexTest, NullablePropertyTest) { context.set_column_hints(std::move(columnHints)); cpp2::IndexSpec indices; - indices.set_tag_or_edge_id(111); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(111); + indices.set_schema_id(schemaId); indices.set_contexts({context}); req.set_indices(std::move(indices)); @@ -2192,8 +2221,9 @@ TEST_P(LookupIndexTest, NullablePropertyTest) { context.set_column_hints(std::move(columnHints)); cpp2::IndexSpec indices; - indices.set_tag_or_edge_id(111); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(111); + indices.set_schema_id(schemaId); indices.set_contexts({context}); req.set_indices(std::move(indices)); @@ -2219,8 +2249,9 @@ TEST_P(LookupIndexTest, NullablePropertyTest) { context.set_column_hints(std::move(columnHints)); cpp2::IndexSpec indices; - indices.set_tag_or_edge_id(111); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(111); + indices.set_schema_id(schemaId); indices.set_contexts({context}); req.set_indices(std::move(indices)); @@ -2250,8 +2281,9 @@ TEST_P(LookupIndexTest, NullablePropertyTest) { context.set_column_hints(std::move(columnHints)); cpp2::IndexSpec indices; - indices.set_tag_or_edge_id(111); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(111); + indices.set_schema_id(schemaId); indices.set_contexts({context}); req.set_indices(std::move(indices)); @@ -2281,8 +2313,9 @@ TEST_P(LookupIndexTest, NullablePropertyTest) { context.set_column_hints(std::move(columnHints)); cpp2::IndexSpec indices; - indices.set_tag_or_edge_id(111); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(111); + indices.set_schema_id(schemaId); indices.set_contexts({context}); req.set_indices(std::move(indices)); @@ -2310,8 +2343,9 @@ TEST_P(LookupIndexTest, NullablePropertyTest) { context.set_column_hints(std::move(columnHints)); cpp2::IndexSpec indices; - indices.set_tag_or_edge_id(111); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(111); + indices.set_schema_id(schemaId); indices.set_contexts({context}); req.set_indices(std::move(indices)); @@ -2339,8 +2373,9 @@ TEST_P(LookupIndexTest, NullablePropertyTest) { context.set_column_hints(std::move(columnHints)); cpp2::IndexSpec indices; - indices.set_tag_or_edge_id(111); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(111); + indices.set_schema_id(schemaId); indices.set_contexts({context}); req.set_indices(std::move(indices)); @@ -2372,8 +2407,9 @@ TEST_P(LookupIndexTest, NullablePropertyTest) { context.set_column_hints(std::move(columnHints)); cpp2::IndexSpec indices; - indices.set_tag_or_edge_id(111); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(111); + indices.set_schema_id(schemaId); indices.set_contexts({context}); req.set_indices(std::move(indices)); @@ -2402,8 +2438,9 @@ TEST_P(LookupIndexTest, NullablePropertyTest) { context.set_column_hints(std::move(columnHints)); cpp2::IndexSpec indices; - indices.set_tag_or_edge_id(111); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(111); + indices.set_schema_id(schemaId); indices.set_contexts({context}); req.set_indices(std::move(indices)); @@ -2428,8 +2465,9 @@ TEST_P(LookupIndexTest, NullablePropertyTest) { context.set_column_hints(std::move(columnHints)); cpp2::IndexSpec indices; - indices.set_tag_or_edge_id(111); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(111); + indices.set_schema_id(schemaId); indices.set_contexts({context}); req.set_indices(std::move(indices)); @@ -2457,8 +2495,9 @@ TEST_P(LookupIndexTest, NullablePropertyTest) { context.set_column_hints(std::move(columnHints)); cpp2::IndexSpec indices; - indices.set_tag_or_edge_id(111); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(111); + indices.set_schema_id(schemaId); indices.set_contexts({context}); req.set_indices(std::move(indices)); @@ -2489,8 +2528,9 @@ TEST_P(LookupIndexTest, NullablePropertyTest) { context.set_column_hints(std::move(columnHints)); cpp2::IndexSpec indices; - indices.set_tag_or_edge_id(111); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(111); + indices.set_schema_id(schemaId); indices.set_contexts({context}); req.set_indices(std::move(indices)); @@ -2523,8 +2563,9 @@ TEST_P(LookupIndexTest, NullablePropertyTest) { context.set_column_hints(std::move(columnHints)); cpp2::IndexSpec indices; - indices.set_tag_or_edge_id(111); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(111); + indices.set_schema_id(schemaId); indices.set_contexts({context}); req.set_indices(std::move(indices)); @@ -2553,8 +2594,9 @@ TEST_P(LookupIndexTest, NullablePropertyTest) { context.set_column_hints(std::move(columnHints)); cpp2::IndexSpec indices; - indices.set_tag_or_edge_id(111); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(111); + indices.set_schema_id(schemaId); indices.set_contexts({context}); req.set_indices(std::move(indices)); @@ -2585,8 +2627,9 @@ TEST_P(LookupIndexTest, NullablePropertyTest) { context.set_column_hints(std::move(columnHints)); cpp2::IndexSpec indices; - indices.set_tag_or_edge_id(111); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(111); + indices.set_schema_id(schemaId); indices.set_contexts({context}); req.set_indices(std::move(indices)); @@ -2619,8 +2662,9 @@ TEST_P(LookupIndexTest, NullablePropertyTest) { context.set_column_hints(std::move(columnHints)); cpp2::IndexSpec indices; - indices.set_tag_or_edge_id(111); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(111); + indices.set_schema_id(schemaId); indices.set_contexts({context}); req.set_indices(std::move(indices)); @@ -2646,8 +2690,9 @@ TEST_P(LookupIndexTest, NullablePropertyTest) { context.set_column_hints(std::move(columnHints)); cpp2::IndexSpec indices; - indices.set_tag_or_edge_id(111); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(111); + indices.set_schema_id(schemaId); indices.set_contexts({context}); req.set_indices(std::move(indices)); @@ -2698,8 +2743,9 @@ TEST_P(LookupIndexTest, DeDupTagIndexTest) { cpp2::LookupIndexRequest req; nebula::storage::cpp2::IndexSpec indices; req.set_space_id(spaceId); - indices.set_tag_or_edge_id(1); - indices.set_is_edge(false); + nebula::cpp2::SchemaID schemaId; + schemaId.set_tag_id(1); + indices.set_schema_id(schemaId); std::vector parts; for (int32_t p = 1; p <= totalParts; p++) { parts.emplace_back(p); @@ -2795,8 +2841,9 @@ TEST_P(LookupIndexTest, DedupEdgeIndexTest) { cpp2::LookupIndexRequest req; nebula::storage::cpp2::IndexSpec indices; req.set_space_id(spaceId); - indices.set_tag_or_edge_id(102); - indices.set_is_edge(true); + nebula::cpp2::SchemaID schemaId; + schemaId.set_edge_type(102); + indices.set_schema_id(schemaId); std::vector parts; for (int32_t p = 1; p <= totalParts; p++) { parts.emplace_back(p);