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

Function ExecFindMatchingSubPlans

src/backend/executor/execPartition.c:2245–2345  ·  view source on GitHub ↗

* ExecFindMatchingSubPlans * Determine which subplans match the pruning steps detailed in * 'prunestate' for the current comparison expression values. * * Here we assume we may evaluate PARAM_EXEC Params. * * GPDB: 'join_prune_paramids' can contain a list of PARAM_EXEC Param IDs * containing results that were computed earlier by PartitionSelector * nodes. */

Source from the content-addressed store, hash-verified

2243 * nodes.
2244 */
2245Bitmapset *
2246ExecFindMatchingSubPlans(PartitionPruneState *prunestate,
2247 EState *estate,
2248 int nplans, List *join_prune_paramids)
2249{
2250 Bitmapset *result = NULL;
2251 MemoryContext oldcontext;
2252 int i;
2253 Bitmapset *join_selected = NULL;
2254
2255 if (join_prune_paramids)
2256 {
2257 ListCell *lc;
2258
2259 join_selected = bms_add_range(join_selected, 0, nplans - 1);
2260
2261 foreach (lc, join_prune_paramids)
2262 {
2263 int paramid = lfirst_int(lc);
2264 ParamExecData *param;
2265 PartitionSelectorState *psstate;
2266
2267 param = &(estate->es_param_exec_vals[paramid]);
2268 Assert(param->execPlan == NULL);
2269 Assert(!param->isnull);
2270 psstate = (PartitionSelectorState *) DatumGetPointer(param->value);
2271
2272 if (psstate == NULL)
2273 {
2274 /*
2275 * The planner should have ensured that the Partition Selector
2276 * is fully executed before the Append.
2277 */
2278 elog(WARNING, "partition selector was not fully executed");
2279 }
2280 else
2281 {
2282 Assert(IsA(psstate, PartitionSelectorState));
2283
2284 join_selected = bms_intersect(join_selected,
2285 psstate->part_prune_result);
2286 }
2287 }
2288
2289
2290 if (!prunestate)
2291 {
2292 /* rely entirely on partition selectors */
2293 return join_selected;
2294 }
2295 }
2296
2297 /*
2298 * If !do_exec_prune, we've got problems because
2299 * ExecFindInitialMatchingSubPlans will not have bothered to update
2300 * prunestate for whatever pruning it did.
2301 */
2302 Assert(prunestate->do_exec_prune);

Callers 11

ExecDynamicSeqScanFunction · 0.85
ExecDynamicIndexScanFunction · 0.85
ExecMergeAppendFunction · 0.85
ExecDynamicForeignScanFunction · 0.85
ExecAppendAsyncBeginFunction · 0.85
ExecAddMatchingSubPlansFunction · 0.85
ExecDynamicIndexOnlyScanFunction · 0.85

Calls 8

bms_add_rangeFunction · 0.85
bms_intersectFunction · 0.85
MemoryContextSwitchToFunction · 0.85
bms_add_membersFunction · 0.85
bms_copyFunction · 0.85
MemoryContextResetFunction · 0.85
foreachFunction · 0.50

Tested by

no test coverage detected