diff --git a/src/graph/executor/query/AppendVerticesExecutor.cpp b/src/graph/executor/query/AppendVerticesExecutor.cpp index d4fe327e763..6ac2dc5a318 100644 --- a/src/graph/executor/query/AppendVerticesExecutor.cpp +++ b/src/graph/executor/query/AppendVerticesExecutor.cpp @@ -6,6 +6,8 @@ #include +#include "graph/planner/plan/Query.h" + using nebula::storage::StorageClient; using nebula::storage::StorageRpcResponse; using nebula::storage::cpp2::GetPropResponse; @@ -27,7 +29,8 @@ 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 && + const_cast(av)->noNeedFetchProp()) { return handleNullProp(av); } diff --git a/src/graph/planner/plan/Query.h b/src/graph/planner/plan/Query.h index 2e188c26d6f..11b9fd70c6b 100644 --- a/src/graph/planner/plan/Query.h +++ b/src/graph/planner/plan/Query.h @@ -346,6 +346,27 @@ class GetVertices : public Explore { return props_.get(); } + bool noNeedFetchProp() { + 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; + } + } + // For profiling + props_.reset(); + return true; + } + const std::vector* exprs() const { return exprs_.get(); }