* cdbpathtoplan_create_flow */
| 24 | * cdbpathtoplan_create_flow |
| 25 | */ |
| 26 | Flow * |
| 27 | cdbpathtoplan_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 |
no test coverage detected