diff --git a/src/query/plan/distributed_pretty_print.cpp b/src/query/plan/distributed_pretty_print.cpp index 3e5208ee5..a0464853e 100644 --- a/src/query/plan/distributed_pretty_print.cpp +++ b/src/query/plan/distributed_pretty_print.cpp @@ -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 diff --git a/src/query/plan/pretty_print.cpp b/src/query/plan/pretty_print.cpp index 6a7be00db..edecec3f3 100644 --- a/src/query/plan/pretty_print.cpp +++ b/src/query/plan/pretty_print.cpp @@ -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() << ")"; diff --git a/src/query/plan/pretty_print.hpp b/src/query/plan/pretty_print.hpp index a422c0bd7..a3ad6c349 100644 --- a/src/query/plan/pretty_print.hpp +++ b/src/query/plan/pretty_print.hpp @@ -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}; };