Skip to content

Commit

Permalink
delete pathbaseexecutor
Browse files Browse the repository at this point in the history
  • Loading branch information
nevermore3 committed Mar 21, 2023
1 parent cd67eae commit 7dc2b72
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 282 deletions.
1 change: 0 additions & 1 deletion src/graph/executor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ nebula_add_library(
executor_obj OBJECT
Executor.cpp
StorageAccessExecutor.cpp
PathBaseExecutor.cpp
logic/LoopExecutor.cpp
logic/PassThroughExecutor.cpp
logic/StartExecutor.cpp
Expand Down
207 changes: 0 additions & 207 deletions src/graph/executor/PathBaseExecutor.cpp

This file was deleted.

68 changes: 0 additions & 68 deletions src/graph/executor/PathBaseExecutor.h

This file was deleted.

82 changes: 82 additions & 0 deletions src/graph/executor/StorageAccessExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@

#include "graph/context/Iterator.h"
#include "graph/context/QueryExpressionContext.h"
#include "graph/service/GraphFlags.h"
#include "graph/util/SchemaUtil.h"
#include "graph/util/Utils.h"
#include "interface/gen-cpp2/meta_types.h"

using apache::thrift::optional_field_ref;
using nebula::storage::StorageClient;

namespace nebula {
namespace graph {
Expand Down Expand Up @@ -148,5 +150,85 @@ StatusOr<std::vector<Value>> StorageAccessExecutor::buildRequestListByVidType(It
return internal::buildRequestList<std::string>(space, exprCtx, iter, expr, dedup, isCypher);
}

bool StorageAccessExecutor::hasSameEdge(const std::vector<Value> &edgeList, const Edge &edge) {
for (auto &leftEdge : edgeList) {
if (!leftEdge.isEdge()) {
continue;
}
if (edge.keyEqual(leftEdge.getEdge())) {
return true;
}
}
return false;
}

folly::Future<std::vector<Value>> StorageAccessExecutor::getProps(
const std::vector<Value> &vids, const std::vector<VertexProp> *vertexPropPtr) {
nebula::DataSet vertices({kVid});
vertices.rows.reserve(vids.size());
for (auto &vid : vids) {
vertices.emplace_back(Row({vid}));
}
StorageClient *storageClient = qctx_->getStorageClient();
StorageClient::CommonRequestParam param(qctx_->rctx()->session()->space().id,
qctx_->rctx()->session()->id(),
qctx_->plan()->id(),
qctx_->plan()->isProfileEnabled());
return DCHECK_NOTNULL(storageClient)
->getProps(
param, std::move(vertices), vertexPropPtr, nullptr, nullptr, false, {}, -1, nullptr)
.via(runner())
.thenValue([this](PropRpcResponse &&resp) {
addStats(resp);
return handlePropResp(std::move(resp));
});
}

std::vector<Value> StorageAccessExecutor::handlePropResp(PropRpcResponse &&resps) {
std::vector<Value> vertices;
auto result = handleCompleteness(resps, FLAGS_accept_partial_success);
if (!result.ok()) {
LOG(WARNING) << "GetProp partial fail";
return vertices;
}
nebula::DataSet v;
for (auto &resp : resps.responses()) {
if (resp.props_ref().has_value()) {
if (UNLIKELY(!v.append(std::move(*resp.props_ref())))) {
// it's impossible according to the interface
LOG(WARNING) << "Heterogeneous props dataset";
}
} else {
LOG(WARNING) << "GetProp partial success";
}
}
auto val = std::make_shared<Value>(std::move(v));
auto iter = std::make_unique<PropIter>(val);
vertices.reserve(iter->size());
for (; iter->valid(); iter->next()) {
vertices.emplace_back(iter->getVertex());
}
return vertices;
}

void StorageAccessExecutor::addGetNeighborStats(RpcResponse &resp, size_t stepNum, bool reverse) {
folly::dynamic stats = folly::dynamic::array();
auto &hostLatency = resp.hostLatency();
for (size_t i = 0; i < hostLatency.size(); ++i) {
size_t size = 0u;
auto &result = resp.responses()[i];
if (result.vertices_ref().has_value()) {
size = (*result.vertices_ref()).size();
}
auto info = util::collectRespProfileData(result.result, hostLatency[i], size);
stats.push_back(std::move(info));
}

auto key = folly::sformat("{}step[{}]", reverse ? "reverse " : "", stepNum);
statsLock_.lock();
otherStats_.emplace(key, folly::toPrettyJson(stats));
statsLock_.unlock();
}

} // namespace graph
} // namespace nebula
Loading

0 comments on commit 7dc2b72

Please sign in to comment.