Skip to content

Commit

Permalink
Enhance the AppendVertices operator to avoid unnecessary rpc overhead (
Browse files Browse the repository at this point in the history
…#5018)

* enhance/appendVerticeExecutor

fix

small delete

small fix

* small fix
  • Loading branch information
czpmango authored Dec 8, 2022
1 parent 3762db7 commit 42f5de3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/graph/executor/query/AppendVerticesExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ 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 && av->noNeedFetchProp()) {
return handleNullProp(av);
}

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

0 comments on commit 42f5de3

Please sign in to comment.