| 2464 | } |
| 2465 | |
| 2466 | void PlanNode::toString( |
| 2467 | std::stringstream& stream, |
| 2468 | bool detailed, |
| 2469 | bool recursive, |
| 2470 | size_t indentationSize, |
| 2471 | bool withId, |
| 2472 | const std::function<void( |
| 2473 | const PlanNodeId& planNodeId, |
| 2474 | const std::string& indentation, |
| 2475 | std::stringstream& stream)>& addContext) const { |
| 2476 | const std::string indentation(indentationSize, ' '); |
| 2477 | |
| 2478 | stream << indentation << "-- " << name(); |
| 2479 | if (withId) { |
| 2480 | stream << "[" << id() << "]"; |
| 2481 | } |
| 2482 | |
| 2483 | if (detailed) { |
| 2484 | stream << "["; |
| 2485 | addDetails(stream); |
| 2486 | stream << "]"; |
| 2487 | stream << " -> "; |
| 2488 | outputType()->printChildren(stream, ", "); |
| 2489 | } |
| 2490 | stream << std::endl; |
| 2491 | |
| 2492 | if (addContext) { |
| 2493 | auto contextIndentation = indentation + " "; |
| 2494 | stream << contextIndentation; |
| 2495 | addContext(id(), contextIndentation, stream); |
| 2496 | stream << std::endl; |
| 2497 | } |
| 2498 | |
| 2499 | if (recursive) { |
| 2500 | for (auto& source : sources()) { |
| 2501 | source->toString( |
| 2502 | stream, detailed, true, indentationSize + 2, withId, addContext); |
| 2503 | } |
| 2504 | } |
| 2505 | } |
| 2506 | |
| 2507 | namespace { |
| 2508 | void collectLeafPlanNodeIds( |