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

Function reparameterize_path

src/backend/optimizer/util/pathnode.c:6199–6309  ·  view source on GitHub ↗

* reparameterize_path * Attempt to modify a Path to have greater parameterization * * We use this to attempt to bring all child paths of an appendrel to the * same parameterization level, ensuring that they all enforce the same set * of join quals (and thus that that parameterization can be attributed to * an append path built from such paths). Currently, only a few path types * are suppo

Source from the content-addressed store, hash-verified

6197 * as members of an append path.
6198 */
6199Path *
6200reparameterize_path(PlannerInfo *root, Path *path,
6201 Relids required_outer,
6202 double loop_count)
6203{
6204 RelOptInfo *rel = path->parent;
6205
6206 /* Can only increase, not decrease, path's parameterization */
6207 if (!bms_is_subset(PATH_REQ_OUTER(path), required_outer))
6208 return NULL;
6209 switch (path->pathtype)
6210 {
6211 case T_SeqScan:
6212 return create_seqscan_path(root, rel, required_outer, 0);
6213 case T_SampleScan:
6214 return (Path *) create_samplescan_path(root, rel, required_outer);
6215 case T_IndexScan:
6216 case T_IndexOnlyScan:
6217 {
6218 IndexPath *ipath = (IndexPath *) path;
6219 IndexPath *newpath = makeNode(IndexPath);
6220
6221 /*
6222 * We can't use create_index_path directly, and would not want
6223 * to because it would re-compute the indexqual conditions
6224 * which is wasted effort. Instead we hack things a bit:
6225 * flat-copy the path node, revise its param_info, and redo
6226 * the cost estimate.
6227 */
6228 memcpy(newpath, ipath, sizeof(IndexPath));
6229 newpath->path.param_info =
6230 get_baserel_parampathinfo(root, rel, required_outer);
6231 cost_index(newpath, root, loop_count, false);
6232 return (Path *) newpath;
6233 }
6234 case T_BitmapHeapScan:
6235 {
6236 BitmapHeapPath *bpath = (BitmapHeapPath *) path;
6237
6238 return (Path *) create_bitmap_heap_path(root,
6239 rel,
6240 bpath->bitmapqual,
6241 required_outer,
6242 loop_count, 0);
6243 }
6244 case T_SubqueryScan:
6245 {
6246 SubqueryScanPath *spath = (SubqueryScanPath *) path;
6247
6248 return (Path *) create_subqueryscan_path(root,
6249 rel,
6250 spath->subpath,
6251 spath->path.pathkeys,
6252 spath->path.locus,
6253 required_outer);
6254 }
6255 case T_Result:
6256 /* Supported only for RTE_RESULT scan paths */

Callers 1

Calls 12

bms_is_subsetFunction · 0.85
create_seqscan_pathFunction · 0.85
create_samplescan_pathFunction · 0.85
cost_indexFunction · 0.85
create_bitmap_heap_pathFunction · 0.85
create_subqueryscan_pathFunction · 0.85
create_resultscan_pathFunction · 0.85
lappendFunction · 0.85
create_append_pathFunction · 0.85
create_memoize_pathFunction · 0.85
foreachFunction · 0.50

Tested by

no test coverage detected