From 4655639e370b963c7430b9758a4e3d3ad4a1a4b9 Mon Sep 17 00:00:00 2001 From: "kyle.cao" Date: Wed, 7 Dec 2022 20:16:51 +0800 Subject: [PATCH] enhance/appendVerticeExecutor fix small delete small fix --- .../executor/query/AppendVerticesExecutor.cpp | 2 +- src/graph/planner/plan/Query.h | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/graph/executor/query/AppendVerticesExecutor.cpp b/src/graph/executor/query/AppendVerticesExecutor.cpp index d4fe327e763..08f27898bed 100644 --- a/src/graph/executor/query/AppendVerticesExecutor.cpp +++ b/src/graph/executor/query/AppendVerticesExecutor.cpp @@ -27,7 +27,7 @@ StatusOr AppendVerticesExecutor::buildRequestDataSet(const AppendVertic folly::Future AppendVerticesExecutor::appendVertices() { SCOPED_TIMER(&execTime_); auto *av = asNode(node()); - if (FLAGS_optimize_appendvertices && av != nullptr && av->props() == nullptr) { + if (FLAGS_optimize_appendvertices && av != nullptr && av->noNeedFetchProp()) { return handleNullProp(av); } diff --git a/src/graph/planner/plan/Query.h b/src/graph/planner/plan/Query.h index 2e188c26d6f..9e01c9fca48 100644 --- a/src/graph/planner/plan/Query.h +++ b/src/graph/planner/plan/Query.h @@ -346,6 +346,25 @@ class GetVertices : public Explore { return props_.get(); } + bool noNeedFetchProp() const { + if (props_.get() == nullptr) { + return true; + } + auto& vprops = *props_; + for (const auto& vprop : vprops) { + auto& props = vprop.get_props(); + if (props.size() > 1) { + return false; + } + DCHECK_EQ(props.size(), 1); + auto& prop = props.front(); + if (prop.compare("_tag")) { + return false; + } + } + return true; + } + const std::vector* exprs() const { return exprs_.get(); }