Helper for PlanToJson(), processes a single list of plan nodes which are the DFS-flattened representation of a single plan fragment. Called recursively, the iterator parameter is updated in place so that when a recursive call returns, the caller is pointing at the next of its children.
| 1181 | // iterator parameter is updated in place so that when a recursive call returns, the |
| 1182 | // caller is pointing at the next of its children. |
| 1183 | void PlanToJsonHelper(const map<TPlanNodeId, TPlanNodeExecSummary>& summaries, |
| 1184 | vector<TPlanNode>::const_iterator* it, rapidjson::Document* document, Value* value) { |
| 1185 | Value children(kArrayType); |
| 1186 | Value label((*it)->label, document->GetAllocator()); |
| 1187 | value->AddMember("label", label, document->GetAllocator()); |
| 1188 | // Node "details" may contain exprs which should be redacted. |
| 1189 | Value label_detail(RedactCopy((*it)->label_detail), document->GetAllocator()); |
| 1190 | value->AddMember("label_detail", label_detail, document->GetAllocator()); |
| 1191 | |
| 1192 | TPlanNodeId id = (*it)->node_id; |
| 1193 | map<TPlanNodeId, TPlanNodeExecSummary>::const_iterator summary_it = summaries.find(id); |
| 1194 | if (summary_it != summaries.end()) { |
| 1195 | ExecStatsToJsonHelper(summary_it->second, document, value); |
| 1196 | } |
| 1197 | |
| 1198 | int num_children = (*it)->num_children; |
| 1199 | for (int i = 0; i < num_children; ++i) { |
| 1200 | ++(*it); |
| 1201 | Value container(kObjectType); |
| 1202 | PlanToJsonHelper(summaries, it, document, &container); |
| 1203 | children.PushBack(container, document->GetAllocator()); |
| 1204 | } |
| 1205 | value->AddMember("children", children, document->GetAllocator()); |
| 1206 | } |
| 1207 | |
| 1208 | // Helper for PlanToJson(), called only when the plan fragment's root data sink must be |
| 1209 | // one of the following types: |
no test coverage detected