Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance the AppendVertices operator to avoid unnecessary rpc overhead #5018

Merged
merged 2 commits into from
Dec 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) {
yixinglu marked this conversation as resolved.
Show resolved Hide resolved
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