| 61 | typedef google::protobuf::Map<string, DmlPartitionStatusPB> PerPartitionStatusPBMap; |
| 62 | |
| 63 | string DmlExecState::OutputPartitionStats(const string& prefix) { |
| 64 | lock_guard<mutex> l(lock_); |
| 65 | const char* indent = " "; |
| 66 | stringstream ss; |
| 67 | ss << prefix; |
| 68 | bool first = true; |
| 69 | for (const PartitionStatusMap::value_type& val: per_partition_status_) { |
| 70 | if (!first) ss << endl; |
| 71 | first = false; |
| 72 | ss << "Partition: "; |
| 73 | const string& partition_key = val.first; |
| 74 | if (partition_key == DataSink::ROOT_PARTITION_KEY) { |
| 75 | ss << "Default" << endl; |
| 76 | } else { |
| 77 | ss << partition_key << endl; |
| 78 | } |
| 79 | if (val.second.has_num_modified_rows()) { |
| 80 | ss << "NumModifiedRows: " << val.second.num_modified_rows() << endl; |
| 81 | } |
| 82 | if (val.second.has_num_deleted_rows()) { |
| 83 | ss << "NumDeletedRows: " << val.second.num_deleted_rows() << endl; |
| 84 | } |
| 85 | |
| 86 | if (!val.second.has_stats()) continue; |
| 87 | const DmlStatsPB& stats = val.second.stats(); |
| 88 | if (stats.has_kudu_stats()) { |
| 89 | ss << "NumRowErrors: " << stats.kudu_stats().num_row_errors() << endl; |
| 90 | } |
| 91 | |
| 92 | ss << indent << "BytesWritten: " |
| 93 | << PrettyPrinter::Print(stats.bytes_written(), TUnit::BYTES); |
| 94 | if (stats.has_parquet_stats()) { |
| 95 | const ParquetDmlStatsPB& parquet_stats = stats.parquet_stats(); |
| 96 | ss << endl << indent << "Per Column Sizes:"; |
| 97 | for (const PerColumnSizePBMap::value_type& i : parquet_stats.per_column_size()) { |
| 98 | ss << endl << indent << indent << i.first << ": " |
| 99 | << PrettyPrinter::Print(i.second, TUnit::BYTES); |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 | return ss.str(); |
| 104 | } |
| 105 | |
| 106 | void DmlExecState::Update(const DmlExecStatusPB& dml_exec_status) { |
| 107 | lock_guard<mutex> l(lock_); |
no test coverage detected