Skip to content

Commit

Permalink
enhance/appendVerticeExecutor
Browse files Browse the repository at this point in the history
fix
  • Loading branch information
czpmango committed Dec 8, 2022
1 parent 3762db7 commit 61eab64
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/graph/executor/query/AppendVerticesExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#include <iterator>

#include "graph/planner/plan/Query.h"

using nebula::storage::StorageClient;
using nebula::storage::StorageRpcResponse;
using nebula::storage::cpp2::GetPropResponse;
Expand All @@ -27,7 +29,8 @@ StatusOr<DataSet> AppendVerticesExecutor::buildRequestDataSet(const AppendVertic
folly::Future<Status> AppendVerticesExecutor::appendVertices() {
SCOPED_TIMER(&execTime_);
auto *av = asNode<AppendVertices>(node());
if (FLAGS_optimize_appendvertices && av != nullptr && av->props() == nullptr) {
if (FLAGS_optimize_appendvertices && av != nullptr &&
const_cast<AppendVertices *>(av)->noNeedFetchProp()) {
return handleNullProp(av);
}

Expand Down
21 changes: 21 additions & 0 deletions src/graph/planner/plan/Query.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<Expr>* exprs() const {
return exprs_.get();
}
Expand Down

0 comments on commit 61eab64

Please sign in to comment.