| 4052 | } |
| 4053 | |
| 4054 | void ReadFromMergeTree::describeActions(FormatSettings & format_settings) const |
| 4055 | { |
| 4056 | const auto & result = getAnalysisResult(); |
| 4057 | std::string prefix = format_settings.detail_prefix; |
| 4058 | std::string_view read_type_label = format_settings.pretty ? "Read type: " : "ReadType: "; |
| 4059 | format_settings.out << prefix << read_type_label << readTypeToString(result.read_type) << '\n'; |
| 4060 | |
| 4061 | if (!result.index_stats.empty()) |
| 4062 | { |
| 4063 | std::string_view delimiter = format_settings.pretty ? " | " : "\n"; |
| 4064 | format_settings.out << prefix << "Parts: " << result.index_stats.back().num_parts_after << delimiter; |
| 4065 | format_settings.out << (format_settings.pretty ? "" : prefix) << "Granules: " << result.index_stats.back().num_granules_after << '\n'; |
| 4066 | } |
| 4067 | |
| 4068 | if (output_each_partition_through_separate_port) |
| 4069 | format_settings.out << prefix << "Read each partition through separate port: 1\n"; |
| 4070 | |
| 4071 | if (format_settings.pretty) |
| 4072 | QueryPlanFormat::formatOutputColumns(format_settings.pretty_names, format_settings.out, *this, prefix); |
| 4073 | |
| 4074 | if (query_info.prewhere_info || query_info.row_level_filter) |
| 4075 | { |
| 4076 | if (!format_settings.pretty) |
| 4077 | { |
| 4078 | format_settings.out << prefix << "Prewhere info" << '\n'; |
| 4079 | if (query_info.prewhere_info) |
| 4080 | format_settings.out << prefix << "Need filter: " << query_info.prewhere_info->need_filter << '\n'; |
| 4081 | |
| 4082 | prefix.push_back(format_settings.indent_char); |
| 4083 | prefix.push_back(format_settings.indent_char); |
| 4084 | } |
| 4085 | } |
| 4086 | |
| 4087 | if (query_info.prewhere_info) |
| 4088 | { |
| 4089 | const auto pretty_expression = format_settings.pretty |
| 4090 | ? QueryPlanFormat::formatColumnPretty(query_info.prewhere_info->prewhere_column_name, format_settings.pretty_names) |
| 4091 | : String{}; |
| 4092 | |
| 4093 | if (!format_settings.pretty || !pretty_expression.empty()) |
| 4094 | { |
| 4095 | format_settings.out << prefix << "Prewhere filter" << '\n'; |
| 4096 | format_settings.out << prefix << "Prewhere filter column: " |
| 4097 | << (format_settings.pretty ? pretty_expression : query_info.prewhere_info->prewhere_column_name); |
| 4098 | if (!format_settings.pretty && query_info.prewhere_info->remove_prewhere_column) |
| 4099 | format_settings.out << " (removed)"; |
| 4100 | format_settings.out << '\n'; |
| 4101 | } |
| 4102 | |
| 4103 | if (format_settings.pretty) |
| 4104 | { |
| 4105 | const auto annotation = QueryPlanFormat::getColumnAnnotation(query_info.prewhere_info->prewhere_column_name, format_settings); |
| 4106 | if (!annotation.empty()) |
| 4107 | format_settings.out << prefix << annotation << '\n'; |
| 4108 | } |
| 4109 | |
| 4110 | if (!format_settings.compact) |
| 4111 | { |
nothing calls this directly
no test coverage detected