1
0
Fork 0

Add show() for ExecutionPlans.

This commit is contained in:
Max Neunhoeffer 2014-08-27 22:10:38 +02:00
parent f279c40262
commit b2d44cd35e
3 changed files with 44 additions and 1 deletions

View File

@ -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
// -----------------------------------------------------------------------------

View 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 . . .
////////////////////////////////////////////////////////////////////////////////

View File

@ -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;