| 682 | } |
| 683 | |
| 684 | String PlanPrinter::TextPrinter::printAttributes(PlanNodeBase & plan, const TextPrinterIntent & intent, const StepProfiles & profiles) const |
| 685 | { |
| 686 | size_t step_id = plan.getId(); |
| 687 | if (!profiles.contains(step_id) || profiles.at(step_id)->address_to_attributes.empty()) |
| 688 | return ""; |
| 689 | if (!settings.query_plan_options.indexes && !settings.selected_parts) |
| 690 | return ""; |
| 691 | std::stringstream out; |
| 692 | const auto & address_to_attributes = profiles.at(step_id)->address_to_attributes; |
| 693 | if (plan.getStep()->getType() == IQueryPlanStep::Type::TableScan) |
| 694 | { |
| 695 | String space; |
| 696 | for (const auto & [address, attribute] : address_to_attributes) |
| 697 | { |
| 698 | if (address_to_attributes.size() > 1) |
| 699 | { |
| 700 | out << intent.detailIntent() << address; |
| 701 | space = " "; |
| 702 | } |
| 703 | if (settings.query_plan_options.indexes && attribute.contains("Indexes")) |
| 704 | { |
| 705 | out << intent.detailIntent() << space << "Indexes:"; |
| 706 | auto index_desc = attribute.at("Indexes"); |
| 707 | for (const auto & desc : index_desc->name_and_detail) |
| 708 | out << intent.detailIntent() << space << " " << desc.second; |
| 709 | } |
| 710 | if (settings.selected_parts) |
| 711 | { |
| 712 | if (attribute.contains("SelectParts")) |
| 713 | out << intent.detailIntent() << space << attribute.at("SelectParts")->description; |
| 714 | if (attribute.contains("TableScanDescription")) |
| 715 | out << intent.detailIntent() << space << attribute.at("TableScanDescription")->description; |
| 716 | } |
| 717 | } |
| 718 | return out.str(); |
| 719 | } |
| 720 | return ""; |
| 721 | } |
| 722 | |
| 723 | String PlanPrinter::TextPrinter::prettyNum(size_t num, bool pretty_num) |
| 724 | { |