Skip to content

Commit

Permalink
Address comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
CPWstatic committed Feb 17, 2020
1 parent 5cdb324 commit 641d50c
Show file tree
Hide file tree
Showing 5 changed files with 254 additions and 251 deletions.
49 changes: 30 additions & 19 deletions src/graph/GoExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,9 @@ Status GoExecutor::prepareOverAll() {
}

auto v = edgeStatus.value();
if (direction_ == OverClause::Direction::kForward) {
edgeTypes_.push_back(v);
} else if (direction_ == OverClause::Direction::kBackward) {
v = -v;
edgeTypes_.push_back(v);
} else if (direction_ == OverClause::Direction::kBiDirect) {
edgeTypes_.push_back(v);
v = -v;
edgeTypes_.push_back(v);
auto status = addToEdgeTypes(v);
if (!status.ok()) {
return status;
}

if (!expCtx_->addEdge(e, std::abs(v))) {
Expand Down Expand Up @@ -272,15 +266,9 @@ Status GoExecutor::prepareOver() {
}

auto v = edgeStatus.value();
if (direction_ == OverClause::Direction::kForward) {
edgeTypes_.push_back(v);
} else if (direction_ == OverClause::Direction::kBackward) {
v = -v;
edgeTypes_.push_back(v);
} else if (direction_ == OverClause::Direction::kBiDirect) {
edgeTypes_.push_back(v);
v = -v;
edgeTypes_.push_back(v);
status = addToEdgeTypes(v);
if (!status.ok()) {
return status;
}

if (e->alias() != nullptr) {
Expand All @@ -297,6 +285,29 @@ Status GoExecutor::prepareOver() {
return status;
}

Status GoExecutor::addToEdgeTypes(EdgeType type) {
switch (direction_) {
case OverClause::Direction::kForward: {
edgeTypes_.push_back(type);
break;
}
case OverClause::Direction::kBackward: {
type = -type;
edgeTypes_.push_back(type);
break;
}
case OverClause::Direction::kBiDirect: {
edgeTypes_.push_back(type);
type = -type;
edgeTypes_.push_back(type);
break;
}
default: {
return Status::Error("Unkown direction type: %ld", static_cast<int64_t>(direction_));
}
}
return Status::OK();
}

Status GoExecutor::prepareWhere() {
auto *clause = sentence_->whereClause();
Expand Down Expand Up @@ -459,7 +470,7 @@ void GoExecutor::stepOut() {
filterPushdown = whereWrapper_->filterPushdown_;
}
VLOG(1) << "edge type size: " << edgeTypes_.size()
<< " return cols: " << returns.size();
<< " return cols: " << returns.size();
auto future = ectx()->getStorageClient()->getNeighbors(spaceId,
starts_,
edgeTypes_,
Expand Down
2 changes: 2 additions & 0 deletions src/graph/GoExecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ class GoExecutor final : public TraverseExecutor {

Status prepareOverAll();

Status addToEdgeTypes(EdgeType type);

/**
* To check if this is the final step.
*/
Expand Down
Loading

0 comments on commit 641d50c

Please sign in to comment.