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

Function cdbpathtoplan_create_flow

src/backend/cdb/cdbpathtoplan.c:26–95  ·  view source on GitHub ↗

* cdbpathtoplan_create_flow */

Source from the content-addressed store, hash-verified

24 * cdbpathtoplan_create_flow
25 */
26Flow *
27cdbpathtoplan_create_flow(PlannerInfo *root,
28 CdbPathLocus locus)
29{
30 Flow *flow = NULL;
31
32 /* Distribution */
33 if (CdbPathLocus_IsEntry(locus))
34 {
35 flow = makeFlow(FLOW_SINGLETON, 1);
36 flow->segindex = -1;
37 }
38 else if (CdbPathLocus_IsSingleQE(locus))
39 {
40 flow = makeFlow(FLOW_SINGLETON, locus.numsegments);
41 flow->segindex = 0;
42 }
43 else if (CdbPathLocus_IsGeneral(locus))
44 {
45 if (Gp_role == GP_ROLE_DISPATCH)
46 flow = makeFlow(FLOW_SINGLETON, getgpsegmentCount());
47 else
48 flow = makeFlow(FLOW_SINGLETON, 1); /* dummy flow */
49 flow->segindex = 0;
50 }
51 else if (CdbPathLocus_IsSegmentGeneral(locus))
52 {
53 flow = makeFlow(FLOW_SINGLETON, locus.numsegments);
54 flow->segindex = 0;
55 }
56 else if (CdbPathLocus_IsSegmentGeneralWorkers(locus))
57 {
58 flow = makeFlow(FLOW_SINGLETON, locus.numsegments);
59 flow->segindex = 0;
60 }
61 else if (CdbPathLocus_IsReplicated(locus))
62 {
63 /* CBDB_PARALLEL_FIXME: What if ReplicatedWorkers? */
64 flow = makeFlow(FLOW_REPLICATED, locus.numsegments);
65 }
66 else if (CdbPathLocus_IsHashed(locus) ||
67 CdbPathLocus_IsHashedWorkers(locus) ||
68 CdbPathLocus_IsHashedOJ(locus))
69 {
70 flow = makeFlow(FLOW_PARTITIONED, locus.numsegments);
71
72 /*
73 * hashExpr can be NIL if the rel is partitioned on columns that
74 * aren't projected (i.e. are not present in the result of this Path
75 * operator).
76 */
77 }
78 else if (CdbPathLocus_IsStrewn(locus))
79 flow = makeFlow(FLOW_PARTITIONED, locus.numsegments);
80 else if (CdbPathLocus_IsOuterQuery(locus))
81 {
82 /*
83 * A plan that's attached to the outer query later on will run on

Callers 6

make_subplanFunction · 0.85
create_minmaxagg_planFunction · 0.85
create_motion_planFunction · 0.85
offload_entry_to_qeFunction · 0.85
standard_plannerFunction · 0.85

Calls 2

makeFlowFunction · 0.85
getgpsegmentCountFunction · 0.85

Tested by

no test coverage detected