MCPcopy Create free account
hub / github.com/apache/cloudberry / ExplainPropertyList

Function ExplainPropertyList

src/backend/commands/explain.c:5367–5431  ·  view source on GitHub ↗

* Explain a property, such as sort keys or targets, that takes the form of * a list of unlabeled items. "data" is a list of C strings. */

Source from the content-addressed store, hash-verified

5365 * a list of unlabeled items. "data" is a list of C strings.
5366 */
5367void
5368ExplainPropertyList(const char *qlabel, List *data, ExplainState *es)
5369{
5370 ListCell *lc;
5371 bool first = true;
5372
5373 switch (es->format)
5374 {
5375 case EXPLAIN_FORMAT_TEXT:
5376 ExplainIndentText(es);
5377 appendStringInfo(es->str, "%s: ", qlabel);
5378 foreach(lc, data)
5379 {
5380 if (!first)
5381 appendStringInfoString(es->str, ", ");
5382 appendStringInfoString(es->str, (const char *) lfirst(lc));
5383 first = false;
5384 }
5385 appendStringInfoChar(es->str, '\n');
5386 break;
5387
5388 case EXPLAIN_FORMAT_XML:
5389 ExplainXMLTag(qlabel, X_OPENING, es);
5390 foreach(lc, data)
5391 {
5392 char *str;
5393
5394 appendStringInfoSpaces(es->str, es->indent * 2 + 2);
5395 appendStringInfoString(es->str, "<Item>");
5396 str = escape_xml((const char *) lfirst(lc));
5397 appendStringInfoString(es->str, str);
5398 pfree(str);
5399 appendStringInfoString(es->str, "</Item>\n");
5400 }
5401 ExplainXMLTag(qlabel, X_CLOSING, es);
5402 break;
5403
5404 case EXPLAIN_FORMAT_JSON:
5405 ExplainJSONLineEnding(es);
5406 appendStringInfoSpaces(es->str, es->indent * 2);
5407 escape_json(es->str, qlabel);
5408 appendStringInfoString(es->str, ": [");
5409 foreach(lc, data)
5410 {
5411 if (!first)
5412 appendStringInfoString(es->str, ", ");
5413 escape_json(es->str, (const char *) lfirst(lc));
5414 first = false;
5415 }
5416 appendStringInfoChar(es->str, ']');
5417 break;
5418
5419 case EXPLAIN_FORMAT_YAML:
5420 ExplainYAMLLineStarting(es);
5421 appendStringInfo(es->str, "%s: ", qlabel);
5422 foreach(lc, data)
5423 {
5424 appendStringInfoChar(es->str, '\n');

Callers 10

show_plan_tlistFunction · 0.85
show_tuple_split_keysFunction · 0.85
show_sort_group_keysFunction · 0.85
show_tablesampleFunction · 0.85
show_eval_paramsFunction · 0.85
show_join_pruning_infoFunction · 0.85
show_modifytable_infoFunction · 0.85
show_motion_keysFunction · 0.85

Calls 13

ExplainIndentTextFunction · 0.85
appendStringInfoFunction · 0.85
appendStringInfoStringFunction · 0.85
appendStringInfoCharFunction · 0.85
ExplainXMLTagFunction · 0.85
appendStringInfoSpacesFunction · 0.85
escape_xmlFunction · 0.85
ExplainJSONLineEndingFunction · 0.85
escape_jsonFunction · 0.85
ExplainYAMLLineStartingFunction · 0.85
escape_yamlFunction · 0.85
foreachFunction · 0.50

Tested by

no test coverage detected