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

Function append_total_cost_compare

src/backend/optimizer/util/pathnode.c:1538–1549  ·  view source on GitHub ↗

* append_total_cost_compare * list_sort comparator for sorting append child paths * by total_cost descending * * For equal total costs, we fall back to comparing startup costs; if those * are equal too, break ties using bms_compare on the paths' relids. * (This is to avoid getting unpredictable results from list_sort.) */

Source from the content-addressed store, hash-verified

1536 * (This is to avoid getting unpredictable results from list_sort.)
1537 */
1538static int
1539append_total_cost_compare(const ListCell *a, const ListCell *b)
1540{
1541 Path *path1 = (Path *) lfirst(a);
1542 Path *path2 = (Path *) lfirst(b);
1543 int cmp;
1544
1545 cmp = compare_path_costs(path1, path2, TOTAL_COST);
1546 if (cmp != 0)
1547 return -cmp;
1548 return bms_compare(path1->parent->relids, path2->parent->relids);
1549}
1550
1551/*
1552 * append_startup_cost_compare

Callers

nothing calls this directly

Calls 2

compare_path_costsFunction · 0.85
bms_compareFunction · 0.85

Tested by

no test coverage detected