* create_sort_path * Creates a pathnode that represents performing an explicit sort. * * 'rel' is the parent relation associated with the result * 'subpath' is the path representing the source of data * 'pathkeys' represents the desired sort order * 'limit_tuples' is the estimated bound on the number of output tuples, * or -1 if no LIMIT or couldn't estimate */
| 4880 | * or -1 if no LIMIT or couldn't estimate |
| 4881 | */ |
| 4882 | SortPath * |
| 4883 | create_sort_path(PlannerInfo *root, |
| 4884 | RelOptInfo *rel, |
| 4885 | Path *subpath, |
| 4886 | List *pathkeys, |
| 4887 | double limit_tuples) |
| 4888 | { |
| 4889 | SortPath *pathnode = makeNode(SortPath); |
| 4890 | |
| 4891 | Assert(pathkeys != NIL); |
| 4892 | |
| 4893 | pathnode->path.pathtype = T_Sort; |
| 4894 | pathnode->path.parent = rel; |
| 4895 | /* Sort doesn't project, so use source path's pathtarget */ |
| 4896 | pathnode->path.pathtarget = subpath->pathtarget; |
| 4897 | /* For now, assume we are above any joins, so no parameterization */ |
| 4898 | pathnode->path.param_info = NULL; |
| 4899 | pathnode->path.parallel_aware = false; |
| 4900 | pathnode->path.parallel_safe = rel->consider_parallel && |
| 4901 | subpath->parallel_safe; |
| 4902 | pathnode->path.parallel_workers = subpath->parallel_workers; |
| 4903 | pathnode->path.pathkeys = pathkeys; |
| 4904 | pathnode->path.locus = subpath->locus; |
| 4905 | pathnode->path.motionHazard = subpath->motionHazard; |
| 4906 | pathnode->path.barrierHazard = subpath->barrierHazard; |
| 4907 | |
| 4908 | pathnode->subpath = subpath; |
| 4909 | |
| 4910 | cost_sort(&pathnode->path, root, pathkeys, |
| 4911 | subpath->total_cost, |
| 4912 | subpath->rows, |
| 4913 | subpath->pathtarget->width, |
| 4914 | 0.0, /* XXX comparison_cost shouldn't be 0? */ |
| 4915 | work_mem, limit_tuples); |
| 4916 | |
| 4917 | return pathnode; |
| 4918 | } |
| 4919 | |
| 4920 | #ifdef NOT_USED /* Group nodes are not used in GPDB */ |
| 4921 | /* |
no test coverage detected