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..9511bd5eac7 100644 --- a/src/graph/planner/plan/Query.h +++ b/src/graph/planner/plan/Query.h @@ -346,6 +346,28 @@ 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; + } + if (props.empty()) { + continue; + } + 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(); }