| 5612 | } |
| 5613 | |
| 5614 | static Path * |
| 5615 | create_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 |
no test coverage detected