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

Function build_simple_rel

src/backend/optimizer/util/relnode.c:213–414  ·  view source on GitHub ↗

* build_simple_rel * Construct a new RelOptInfo for a base relation or 'other' relation. */

Source from the content-addressed store, hash-verified

211 * Construct a new RelOptInfo for a base relation or 'other' relation.
212 */
213RelOptInfo *
214build_simple_rel(PlannerInfo *root, int relid, RelOptInfo *parent)
215{
216 RelOptInfo *rel;
217 RangeTblEntry *rte;
218
219 /* Rel should not exist already */
220 Assert(relid > 0 && relid < root->simple_rel_array_size);
221 if (root->simple_rel_array[relid] != NULL)
222 elog(ERROR, "rel %d already exists", relid);
223
224 /* Fetch RTE for relation */
225 rte = root->simple_rte_array[relid];
226 Assert(rte != NULL);
227
228 rel = makeNode(RelOptInfo);
229 rel->reloptkind = parent ? RELOPT_OTHER_MEMBER_REL : RELOPT_BASEREL;
230 rel->relids = bms_make_singleton(relid);
231 rel->rows = 0;
232 /* cheap startup cost is interesting iff not all tuples to be retrieved */
233 rel->consider_startup = (root->tuple_fraction > 0);
234 rel->consider_param_startup = false; /* might get changed later */
235 rel->consider_parallel = false; /* might get changed later */
236 rel->reltarget = create_empty_pathtarget();
237 rel->pathlist = NIL;
238 rel->ppilist = NIL;
239 rel->partial_pathlist = NIL;
240 rel->cheapest_startup_path = NULL;
241 rel->cheapest_total_path = NULL;
242 rel->cheapest_unique_path = NULL;
243 rel->cheapest_parameterized_paths = NIL;
244 rel->relid = relid;
245 rel->rtekind = rte->rtekind;
246 /* min_attr, max_attr, attr_needed, attr_widths are set below */
247 rel->lateral_vars = NIL;
248 rel->indexlist = NIL;
249 rel->statlist = NIL;
250 rel->pages = 0;
251 rel->tuples = 0;
252 rel->allvisfrac = 0;
253 rel->eclass_indexes = NULL;
254 rel->subroot = NULL;
255 rel->subplan_params = NIL;
256 rel->rel_parallel_workers = -1; /* set up in get_relation_info */
257 rel->amflags = 0;
258 rel->serverid = InvalidOid;
259 rel->segSeverids = NIL;
260 rel->userid = rte->checkAsUser;
261 rel->useridiscurrent = false;
262 rel->exec_location = FTEXECLOCATION_NOT_DEFINED;
263 rel->fdwroutine = NULL;
264 rel->fdw_private = NULL;
265 rel->unique_for_rels = NIL;
266 rel->non_unique_for_rels = NIL;
267 rel->baserestrictinfo = NIL;
268 rel->baserestrictcost.startup = 0;
269 rel->baserestrictcost.per_tuple = 0;
270 rel->baserestrict_min_security = UINT_MAX;

Callers 9

BuildForeignScanFunction · 0.85
query_plannerFunction · 0.85
add_base_rels_to_queryFunction · 0.85
plan_cluster_use_sortFunction · 0.85
recurse_set_operationsFunction · 0.85
expand_inherited_rtentryFunction · 0.85

Calls 12

bms_make_singletonFunction · 0.85
create_empty_pathtargetFunction · 0.85
bms_copyFunction · 0.85
get_relation_infoFunction · 0.85
GpPolicyFetchFunction · 0.85
getgpsegmentCountFunction · 0.85
GpPolicyIsReplicatedFunction · 0.85
list_lengthFunction · 0.85
apply_child_basequalsFunction · 0.85
mark_dummy_relFunction · 0.85
palloc0Function · 0.50

Tested by

no test coverage detected