Add ProduceRemote and PullRemote operator stubs
Reviewers: florijan, msantl Reviewed By: florijan Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D1124
This commit is contained in:
parent
35197d6c4b
commit
1d6ac3d23d
src/query/plan
tests
@ -186,6 +186,8 @@ class CostEstimator : public HierarchicalLogicalOperatorVisitor {
|
||||
bool Visit(Once &) override { return true; }
|
||||
bool Visit(CreateIndex &) override { return true; }
|
||||
|
||||
// TODO: Cost estimate PullRemote and ProduceRemote?
|
||||
|
||||
auto cost() const { return cost_; }
|
||||
auto cardinality() const { return cardinality_; }
|
||||
|
||||
|
@ -2552,6 +2552,32 @@ void Union::UnionCursor::Reset() {
|
||||
right_cursor_->Reset();
|
||||
}
|
||||
|
||||
ProduceRemote::ProduceRemote(const std::shared_ptr<LogicalOperator> &input,
|
||||
const std::vector<Symbol> &symbols)
|
||||
: input_(input ? input : std::make_shared<Once>()), symbols_(symbols) {}
|
||||
|
||||
ACCEPT_WITH_INPUT(ProduceRemote)
|
||||
|
||||
std::unique_ptr<Cursor> ProduceRemote::MakeCursor(
|
||||
database::GraphDbAccessor &db) const {
|
||||
// TODO: Implement a concrete cursor.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PullRemote::PullRemote(const std::shared_ptr<LogicalOperator> &input,
|
||||
int64_t plan_id, const std::vector<Symbol> &symbols)
|
||||
: input_(input ? input : std::make_shared<Once>()),
|
||||
plan_id_(plan_id),
|
||||
symbols_(symbols) {}
|
||||
|
||||
ACCEPT_WITH_INPUT(PullRemote);
|
||||
|
||||
std::unique_ptr<Cursor> PullRemote::MakeCursor(
|
||||
database::GraphDbAccessor &db) const {
|
||||
// TODO: Implement a concrete cursor.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace query::plan
|
||||
|
||||
BOOST_CLASS_EXPORT(query::plan::Once);
|
||||
@ -2585,3 +2611,5 @@ BOOST_CLASS_EXPORT(query::plan::Unwind);
|
||||
BOOST_CLASS_EXPORT(query::plan::Distinct);
|
||||
BOOST_CLASS_EXPORT(query::plan::CreateIndex);
|
||||
BOOST_CLASS_EXPORT(query::plan::Union);
|
||||
BOOST_CLASS_EXPORT(query::plan::ProduceRemote);
|
||||
BOOST_CLASS_EXPORT(query::plan::PullRemote);
|
||||
|
@ -96,6 +96,8 @@ class Unwind;
|
||||
class Distinct;
|
||||
class CreateIndex;
|
||||
class Union;
|
||||
class ProduceRemote;
|
||||
class PullRemote;
|
||||
|
||||
using LogicalOperatorCompositeVisitor = ::utils::CompositeVisitor<
|
||||
Once, CreateNode, CreateExpand, ScanAll, ScanAllByLabel,
|
||||
@ -104,7 +106,8 @@ using LogicalOperatorCompositeVisitor = ::utils::CompositeVisitor<
|
||||
SetProperties, SetLabels, RemoveProperty, RemoveLabels,
|
||||
ExpandUniquenessFilter<VertexAccessor>,
|
||||
ExpandUniquenessFilter<EdgeAccessor>, Accumulate, AdvanceCommand, Aggregate,
|
||||
Skip, Limit, OrderBy, Merge, Optional, Unwind, Distinct, Union>;
|
||||
Skip, Limit, OrderBy, Merge, Optional, Unwind, Distinct, Union,
|
||||
ProduceRemote, PullRemote>;
|
||||
|
||||
using LogicalOperatorLeafVisitor = ::utils::LeafVisitor<Once, CreateIndex>;
|
||||
|
||||
@ -2216,5 +2219,53 @@ class Union : public LogicalOperator {
|
||||
}
|
||||
};
|
||||
|
||||
class ProduceRemote : public LogicalOperator {
|
||||
public:
|
||||
ProduceRemote(const std::shared_ptr<LogicalOperator> &input,
|
||||
const std::vector<Symbol> &symbols);
|
||||
bool Accept(HierarchicalLogicalOperatorVisitor &visitor) override;
|
||||
std::unique_ptr<Cursor> MakeCursor(
|
||||
database::GraphDbAccessor &db) const override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<LogicalOperator> input_;
|
||||
std::vector<Symbol> symbols_;
|
||||
|
||||
ProduceRemote() {}
|
||||
|
||||
friend class boost::serialization::access;
|
||||
template <class TArchive>
|
||||
void serialize(TArchive &ar, const unsigned int) {
|
||||
ar &boost::serialization::base_object<LogicalOperator>(*this);
|
||||
ar &input_;
|
||||
ar &symbols_;
|
||||
}
|
||||
};
|
||||
|
||||
class PullRemote : public LogicalOperator {
|
||||
public:
|
||||
PullRemote(const std::shared_ptr<LogicalOperator> &input, int64_t plan_id,
|
||||
const std::vector<Symbol> &symbols);
|
||||
bool Accept(HierarchicalLogicalOperatorVisitor &visitor) override;
|
||||
std::unique_ptr<Cursor> MakeCursor(
|
||||
database::GraphDbAccessor &db) const override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<LogicalOperator> input_;
|
||||
int64_t plan_id_ = 0;
|
||||
std::vector<Symbol> symbols_;
|
||||
|
||||
PullRemote() {}
|
||||
|
||||
friend class boost::serialization::access;
|
||||
template <class TArchive>
|
||||
void serialize(TArchive &ar, const unsigned int) {
|
||||
ar &boost::serialization::base_object<LogicalOperator>(*this);
|
||||
ar &input_;
|
||||
ar &plan_id_;
|
||||
ar &symbols_;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace plan
|
||||
} // namespace query
|
||||
|
@ -485,6 +485,9 @@ class PlanPrinter : public query::plan::HierarchicalLogicalOperatorVisitor {
|
||||
WithPrintLn([](auto &out) { out << "* CreateIndex"; });
|
||||
return true;
|
||||
}
|
||||
|
||||
PRE_VISIT(ProduceRemote);
|
||||
PRE_VISIT(PullRemote);
|
||||
#undef PRE_VISIT
|
||||
|
||||
private:
|
||||
|
@ -97,6 +97,9 @@ class PlanChecker : public HierarchicalLogicalOperatorVisitor {
|
||||
CheckOp(op);
|
||||
return true;
|
||||
}
|
||||
|
||||
PRE_VISIT(ProduceRemote);
|
||||
PRE_VISIT(PullRemote);
|
||||
#undef PRE_VISIT
|
||||
|
||||
std::list<BaseOpChecker *> checkers_;
|
||||
|
Loading…
Reference in New Issue
Block a user