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:
parent
b1a8e48dc4
commit
0616eb0aa4
@ -2733,18 +2733,16 @@ std::unique_ptr<Cursor> ProduceRemote::MakeCursor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
PullRemote::PullRemote(const std::shared_ptr<LogicalOperator> &input,
|
PullRemote::PullRemote(const std::shared_ptr<LogicalOperator> &input,
|
||||||
int64_t plan_id, const std::vector<Symbol> &symbols,
|
int64_t plan_id, const std::vector<Symbol> &symbols)
|
||||||
bool pull_local)
|
: input_(input), plan_id_(plan_id), symbols_(symbols) {}
|
||||||
: input_(input ? input : std::make_shared<Once>()),
|
|
||||||
plan_id_(plan_id),
|
|
||||||
symbols_(symbols),
|
|
||||||
pull_local_(pull_local) {}
|
|
||||||
|
|
||||||
ACCEPT_WITH_INPUT(PullRemote);
|
ACCEPT_WITH_INPUT(PullRemote);
|
||||||
|
|
||||||
PullRemote::PullRemoteCursor::PullRemoteCursor(const PullRemote &self,
|
PullRemote::PullRemoteCursor::PullRemoteCursor(const PullRemote &self,
|
||||||
database::GraphDbAccessor &db)
|
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();
|
worker_ids_ = db_.db().remote_pull_clients().GetWorkerIds();
|
||||||
// Remove master from the worker ids list.
|
// Remove master from the worker ids list.
|
||||||
worker_ids_.erase(std::find(worker_ids_.begin(), worker_ids_.end(), 0));
|
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
|
// If there are no remote results available, pull and return local
|
||||||
// results.
|
// results.
|
||||||
if (self_.pull_local() && input_cursor_->Pull(frame, context)) {
|
if (input_cursor_ && input_cursor_->Pull(frame, context)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2850,7 +2848,7 @@ bool PullRemote::PullRemoteCursor::Pull(Frame &frame, Context &context) {
|
|||||||
|
|
||||||
// No more remote results, make sure local results get exhausted.
|
// No more remote results, make sure local results get exhausted.
|
||||||
if (!have_remote_results) {
|
if (!have_remote_results) {
|
||||||
if (self_.pull_local() && input_cursor_->Pull(frame, context)) {
|
if (input_cursor_ && input_cursor_->Pull(frame, context)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -2297,7 +2297,7 @@ class ProduceRemote : public LogicalOperator {
|
|||||||
class PullRemote : public LogicalOperator {
|
class PullRemote : public LogicalOperator {
|
||||||
public:
|
public:
|
||||||
PullRemote(const std::shared_ptr<LogicalOperator> &input, int64_t plan_id,
|
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;
|
bool Accept(HierarchicalLogicalOperatorVisitor &visitor) override;
|
||||||
std::unique_ptr<Cursor> MakeCursor(
|
std::unique_ptr<Cursor> MakeCursor(
|
||||||
database::GraphDbAccessor &db) const override;
|
database::GraphDbAccessor &db) const override;
|
||||||
@ -2307,13 +2307,11 @@ class PullRemote : public LogicalOperator {
|
|||||||
}
|
}
|
||||||
const auto &symbols() const { return symbols_; }
|
const auto &symbols() const { return symbols_; }
|
||||||
auto plan_id() const { return plan_id_; }
|
auto plan_id() const { return plan_id_; }
|
||||||
auto pull_local() const { return pull_local_; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<LogicalOperator> input_;
|
std::shared_ptr<LogicalOperator> input_;
|
||||||
int64_t plan_id_ = 0;
|
int64_t plan_id_ = 0;
|
||||||
std::vector<Symbol> symbols_;
|
std::vector<Symbol> symbols_;
|
||||||
bool pull_local_ = true;
|
|
||||||
|
|
||||||
PullRemote() {}
|
PullRemote() {}
|
||||||
|
|
||||||
@ -2345,7 +2343,6 @@ class PullRemote : public LogicalOperator {
|
|||||||
ar &input_;
|
ar &input_;
|
||||||
ar &plan_id_;
|
ar &plan_id_;
|
||||||
ar &symbols_;
|
ar &symbols_;
|
||||||
ar &pull_local_;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user