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

Function create_scatter_path

src/backend/optimizer/plan/planner.c:5614–5659  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5612}
5613
5614static Path *
5615create_scatter_path(PlannerInfo *root, List *scatterClause, Path *path)
5616{
5617 CdbPathLocus locus;
5618
5619 /* Deal with the special case of SCATTER RANDOMLY */
5620 if (list_length(scatterClause) == 1 && linitial(scatterClause) == NULL)
5621 {
5622 CdbPathLocus_MakeStrewn(&locus, getgpsegmentCount(), path->parallel_workers);
5623 }
5624 else
5625 {
5626 List *opfamilies;
5627 List *sortrefs;
5628 ListCell *lc;
5629
5630 opfamilies = NIL;
5631 sortrefs = NIL;
5632 foreach(lc, scatterClause)
5633 {
5634 Node *expr = lfirst(lc);
5635 Oid opfamily;
5636
5637 opfamily = cdb_default_distribution_opfamily_for_type(exprType(expr));
5638 opfamilies = lappend_oid(opfamilies, opfamily);
5639 sortrefs = lappend_int(sortrefs, 0);
5640 }
5641
5642 locus = cdbpathlocus_from_exprs(root,
5643 path->parent,
5644 scatterClause,
5645 opfamilies, sortrefs, getgpsegmentCount(), path->locus.parallel_workers);
5646 }
5647
5648 /*
5649 * Repartition the subquery plan based on our distribution
5650 * requirements
5651 */
5652 path = cdbpath_create_motion_path(root,
5653 path,
5654 NIL,
5655 false,
5656 locus);
5657
5658 return path;
5659}
5660
5661/*
5662 * Function: deconstruct_expr_walker

Callers 1

grouping_plannerFunction · 0.85

Calls 9

list_lengthFunction · 0.85
getgpsegmentCountFunction · 0.85
exprTypeFunction · 0.85
lappend_oidFunction · 0.85
lappend_intFunction · 0.85
cdbpathlocus_from_exprsFunction · 0.85
foreachFunction · 0.50

Tested by

no test coverage detected