Remove pull_local flag from PullRemote

Summary:
The same behaviour can now be achieved by passing a nullptr for input
operator.

Reviewers: florijan, msantl

Reviewed By: msantl

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1195
This commit is contained in:
Teon Banek 2018-02-14 10:33:49 +01:00
parent b1a8e48dc4
commit 0616eb0aa4
2 changed files with 8 additions and 13 deletions

View File

@ -2733,18 +2733,16 @@ std::unique_ptr<Cursor> ProduceRemote::MakeCursor(
}
PullRemote::PullRemote(const std::shared_ptr<LogicalOperator> &input,
int64_t plan_id, const std::vector<Symbol> &symbols,
bool pull_local)
: input_(input ? input : std::make_shared<Once>()),
plan_id_(plan_id),
symbols_(symbols),
pull_local_(pull_local) {}
int64_t plan_id, const std::vector<Symbol> &symbols)
: input_(input), plan_id_(plan_id), symbols_(symbols) {}
ACCEPT_WITH_INPUT(PullRemote);
PullRemote::PullRemoteCursor::PullRemoteCursor(const PullRemote &self,
database::GraphDbAccessor &db)
: self_(self), db_(db), input_cursor_(self.input_->MakeCursor(db)) {
: self_(self),
db_(db),
input_cursor_(self.input_ ? self.input_->MakeCursor(db) : nullptr) {
worker_ids_ = db_.db().remote_pull_clients().GetWorkerIds();
// Remove master from the worker ids list.
worker_ids_.erase(std::find(worker_ids_.begin(), worker_ids_.end(), 0));
@ -2842,7 +2840,7 @@ bool PullRemote::PullRemoteCursor::Pull(Frame &frame, Context &context) {
// If there are no remote results available, pull and return local
// results.
if (self_.pull_local() && input_cursor_->Pull(frame, context)) {
if (input_cursor_ && input_cursor_->Pull(frame, context)) {
return true;
}
}
@ -2850,7 +2848,7 @@ bool PullRemote::PullRemoteCursor::Pull(Frame &frame, Context &context) {
// No more remote results, make sure local results get exhausted.
if (!have_remote_results) {
if (self_.pull_local() && input_cursor_->Pull(frame, context)) {
if (input_cursor_ && input_cursor_->Pull(frame, context)) {
return true;
}
return false;

View File

@ -2297,7 +2297,7 @@ class ProduceRemote : public LogicalOperator {
class PullRemote : public LogicalOperator {
public:
PullRemote(const std::shared_ptr<LogicalOperator> &input, int64_t plan_id,
const std::vector<Symbol> &symbols, bool pull_local = true);
const std::vector<Symbol> &symbols);
bool Accept(HierarchicalLogicalOperatorVisitor &visitor) override;
std::unique_ptr<Cursor> MakeCursor(
database::GraphDbAccessor &db) const override;
@ -2307,13 +2307,11 @@ class PullRemote : public LogicalOperator {
}
const auto &symbols() const { return symbols_; }
auto plan_id() const { return plan_id_; }
auto pull_local() const { return pull_local_; }
private:
std::shared_ptr<LogicalOperator> input_;
int64_t plan_id_ = 0;
std::vector<Symbol> symbols_;
bool pull_local_ = true;
PullRemote() {}
@ -2345,7 +2343,6 @@ class PullRemote : public LogicalOperator {
ar &input_;
ar &plan_id_;
ar &symbols_;
ar &pull_local_;
}
};