Pretty print edge_types for Expand operators
Reviewers: mtomic, llugovic Reviewed By: mtomic Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D1791
This commit is contained in:
parent
0488bdae52
commit
a6b296c73c
@ -6,7 +6,12 @@ bool DistributedPlanPrinter::PreVisit(query::plan::DistributedExpand &op) {
|
||||
WithPrintLn([&](auto &out) {
|
||||
out << "* DistributedExpand (" << op.input_symbol_.name() << ")"
|
||||
<< (op.common_.direction == query::EdgeAtom::Direction::IN ? "<-" : "-")
|
||||
<< "[" << op.common_.edge_symbol.name() << "]"
|
||||
<< "[" << op.common_.edge_symbol.name();
|
||||
utils::PrintIterable(out, op.common_.edge_types, "|",
|
||||
[this](auto &stream, const auto &edge_type) {
|
||||
stream << ":" << dba_->EdgeTypeName(edge_type);
|
||||
});
|
||||
out << "]"
|
||||
<< (op.common_.direction == query::EdgeAtom::Direction::OUT ? "->"
|
||||
: "-")
|
||||
<< "(" << op.common_.node_symbol.name() << ")";
|
||||
@ -18,7 +23,12 @@ bool DistributedPlanPrinter::PreVisit(query::plan::DistributedExpandBfs &op) {
|
||||
WithPrintLn([&](auto &out) {
|
||||
out << "* DistributedExpandBfs (" << op.input_symbol_.name() << ")"
|
||||
<< (op.common_.direction == query::EdgeAtom::Direction::IN ? "<-" : "-")
|
||||
<< "[" << op.common_.edge_symbol.name() << "]"
|
||||
<< "[" << op.common_.edge_symbol.name();
|
||||
utils::PrintIterable(out, op.common_.edge_types, "|",
|
||||
[this](auto &stream, const auto &edge_type) {
|
||||
stream << ":" << dba_->EdgeTypeName(edge_type);
|
||||
});
|
||||
out << "]"
|
||||
<< (op.common_.direction == query::EdgeAtom::Direction::OUT ? "->"
|
||||
: "-")
|
||||
<< "(" << op.common_.node_symbol.name() << ")";
|
||||
@ -62,7 +72,21 @@ bool DistributedPlanPrinter::PreVisit(query::plan::PullRemoteOrderBy &op) {
|
||||
}
|
||||
|
||||
PRE_VISIT(DistributedCreateNode);
|
||||
PRE_VISIT(DistributedCreateExpand);
|
||||
|
||||
bool DistributedPlanPrinter::PreVisit(DistributedCreateExpand &op) {
|
||||
WithPrintLn([&](auto &out) {
|
||||
out << "* DistributedCreateExpand (" << op.input_symbol_.name() << ")"
|
||||
<< (op.edge_info_.direction == query::EdgeAtom::Direction::IN ? "<-"
|
||||
: "-")
|
||||
<< "[" << op.edge_info_.symbol.name() << ":"
|
||||
<< dba_->EdgeTypeName(op.edge_info_.edge_type) << "]"
|
||||
<< (op.edge_info_.direction == query::EdgeAtom::Direction::OUT ? "->"
|
||||
: "-")
|
||||
<< "(" << op.node_info_.symbol.name() << ")";
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
#undef PRE_VISIT
|
||||
|
||||
|
@ -15,7 +15,21 @@ PlanPrinter::PlanPrinter(const database::GraphDbAccessor *dba,
|
||||
}
|
||||
|
||||
PRE_VISIT(CreateNode);
|
||||
PRE_VISIT(CreateExpand);
|
||||
|
||||
bool PlanPrinter::PreVisit(CreateExpand &op) {
|
||||
WithPrintLn([&](auto &out) {
|
||||
out << "* CreateExpand (" << op.input_symbol_.name() << ")"
|
||||
<< (op.edge_info_.direction == query::EdgeAtom::Direction::IN ? "<-"
|
||||
: "-")
|
||||
<< "[" << op.edge_info_.symbol.name() << ":"
|
||||
<< dba_->EdgeTypeName(op.edge_info_.edge_type) << "]"
|
||||
<< (op.edge_info_.direction == query::EdgeAtom::Direction::OUT ? "->"
|
||||
: "-")
|
||||
<< "(" << op.node_info_.symbol.name() << ")";
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
PRE_VISIT(Delete);
|
||||
|
||||
bool PlanPrinter::PreVisit(query::plan::ScanAll &op) {
|
||||
@ -60,7 +74,12 @@ bool PlanPrinter::PreVisit(query::plan::Expand &op) {
|
||||
*out_ << "* Expand (" << op.input_symbol_.name() << ")"
|
||||
<< (op.common_.direction == query::EdgeAtom::Direction::IN ? "<-"
|
||||
: "-")
|
||||
<< "[" << op.common_.edge_symbol.name() << "]"
|
||||
<< "[" << op.common_.edge_symbol.name();
|
||||
utils::PrintIterable(*out_, op.common_.edge_types, "|",
|
||||
[this](auto &stream, const auto &edge_type) {
|
||||
stream << ":" << dba_->EdgeTypeName(edge_type);
|
||||
});
|
||||
*out_ << "]"
|
||||
<< (op.common_.direction == query::EdgeAtom::Direction::OUT ? "->"
|
||||
: "-")
|
||||
<< "(" << op.common_.node_symbol.name() << ")";
|
||||
@ -73,7 +92,12 @@ bool PlanPrinter::PreVisit(query::plan::ExpandVariable &op) {
|
||||
*out_ << "* ExpandVariable (" << op.input_symbol_.name() << ")"
|
||||
<< (op.common_.direction == query::EdgeAtom::Direction::IN ? "<-"
|
||||
: "-")
|
||||
<< "[" << op.common_.edge_symbol.name() << "]"
|
||||
<< "[" << op.common_.edge_symbol.name();
|
||||
utils::PrintIterable(*out_, op.common_.edge_types, "|",
|
||||
[this](auto &stream, const auto &edge_type) {
|
||||
stream << ":" << dba_->EdgeTypeName(edge_type);
|
||||
});
|
||||
*out_ << "]"
|
||||
<< (op.common_.direction == query::EdgeAtom::Direction::OUT ? "->"
|
||||
: "-")
|
||||
<< "(" << op.common_.node_symbol.name() << ")";
|
||||
|
@ -93,8 +93,6 @@ class PlanPrinter : public virtual HierarchicalLogicalOperatorVisitor {
|
||||
void Branch(LogicalOperator &op, const std::string &branch_name = "");
|
||||
|
||||
int64_t depth_{0};
|
||||
|
||||
private:
|
||||
const database::GraphDbAccessor *dba_{nullptr};
|
||||
std::ostream *out_{nullptr};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user