mirror of https://gitee.com/bigwinds/arangodb
Add show() for ExecutionPlans.
This commit is contained in:
parent
f279c40262
commit
b2d44cd35e
|
@ -1198,6 +1198,38 @@ ExecutionNode* ExecutionPlan::fromJson (Ast* ast,
|
|||
return ret;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief show an overview over the plan
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct Shower : public WalkerWorker<ExecutionNode> {
|
||||
int indent;
|
||||
Shower () : indent(0) {
|
||||
}
|
||||
~Shower () {}
|
||||
|
||||
bool enterSubquery (ExecutionNode* super, ExecutionNode* sub) {
|
||||
indent++;
|
||||
return true;
|
||||
}
|
||||
|
||||
void leaveSubquery (ExecutionNode* super, ExecutionNode* sub) {
|
||||
indent--;
|
||||
}
|
||||
|
||||
void after (ExecutionNode* en) {
|
||||
for (int i = 0; i < indent; i++) {
|
||||
std::cout << ' ';
|
||||
}
|
||||
std::cout << en->getTypeString() << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
void ExecutionPlan::show () {
|
||||
Shower shower;
|
||||
_root->walk(&shower);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- END-OF-FILE
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
@ -129,6 +129,12 @@ namespace triagens {
|
|||
return _root->getCost();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief show an overview over the plan
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void show ();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief get the node where variable with id <id> is introduced . . .
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -95,7 +95,12 @@ int Optimizer::createPlans (ExecutionPlan* plan) {
|
|||
}
|
||||
}
|
||||
|
||||
std::cout << "Have " << _plans.size() << " plans." << std::endl;
|
||||
std::cout << "Have " << _plans.size() << " plans:" << std::endl;
|
||||
|
||||
for (auto p : _plans.list) {
|
||||
p->show();
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue