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

Function accumulate_append_subpath

src/backend/optimizer/path/allpaths.c:2341–2378  ·  view source on GitHub ↗

* accumulate_append_subpath * Add a subpath to the list being built for an Append or MergeAppend. * * It's possible that the child is itself an Append or MergeAppend path, in * which case we can "cut out the middleman" and just add its child paths to * our own list. (We don't try to do this earlier because we need to apply * both levels of transformation to the quals.) * * Note that if w

Source from the content-addressed store, hash-verified

2339 * paths).
2340 */
2341static void
2342accumulate_append_subpath(Path *path, List **subpaths, List **special_subpaths)
2343{
2344 if (IsA(path, AppendPath))
2345 {
2346 AppendPath *apath = (AppendPath *) path;
2347
2348 if (!apath->path.parallel_aware || apath->first_partial_path == 0)
2349 {
2350 *subpaths = list_concat(*subpaths, apath->subpaths);
2351 return;
2352 }
2353 else if (special_subpaths != NULL)
2354 {
2355 List *new_special_subpaths;
2356
2357 /* Split Parallel Append into partial and non-partial subpaths */
2358 *subpaths = list_concat(*subpaths,
2359 list_copy_tail(apath->subpaths,
2360 apath->first_partial_path));
2361 new_special_subpaths =
2362 list_truncate(list_copy(apath->subpaths),
2363 apath->first_partial_path);
2364 *special_subpaths = list_concat(*special_subpaths,
2365 new_special_subpaths);
2366 return;
2367 }
2368 }
2369 else if (IsA(path, MergeAppendPath))
2370 {
2371 MergeAppendPath *mpath = (MergeAppendPath *) path;
2372
2373 *subpaths = list_concat(*subpaths, mpath->subpaths);
2374 return;
2375 }
2376
2377 *subpaths = lappend(*subpaths, path);
2378}
2379
2380/*
2381 * get_singleton_append_subpath

Callers 2

add_paths_to_append_relFunction · 0.85

Calls 5

list_concatFunction · 0.85
list_copy_tailFunction · 0.85
list_truncateFunction · 0.85
list_copyFunction · 0.85
lappendFunction · 0.85

Tested by

no test coverage detected