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

Function ExecPartitionSelector

src/backend/executor/nodePartitionSelector.c:118–159  ·  view source on GitHub ↗

---------------------------------------------------------------- * ExecPartitionSelector(node) * * Pass-through rows, but for each row, compute which partitions * on other side of a join above can contain rows that match * the join quals. * ---------------------------------------------------------------- */

Source from the content-addressed store, hash-verified

116 * ----------------------------------------------------------------
117 */
118static TupleTableSlot *
119ExecPartitionSelector(PlanState *pstate)
120{
121 PartitionSelectorState *node = (PartitionSelectorState *) pstate;
122 PartitionSelector *ps = (PartitionSelector *) node->ps.plan;
123 EState *estate = node->ps.state;
124 ExprContext *econtext = node->ps.ps_ExprContext;
125 PlanState *outerPlan = outerPlanState(node);
126 TupleTableSlot *inputSlot;
127
128 /* get tuple from child */
129 Assert(outerPlan);
130 inputSlot = ExecProcNode(outerPlan);
131
132 if (TupIsNull(inputSlot))
133 {
134 /*
135 * No more tuples from outerPlan. The set of surviving partitions
136 * is now complete. Make the result available to the Append node
137 * by storing it in the special executor Param.
138 */
139 ParamExecData *param;
140
141 param = &(estate->es_param_exec_vals[ps->paramid]);
142 Assert(param->execPlan == NULL);
143 Assert(!param->isnull);
144 param->value = PointerGetDatum(node);
145
146 return NULL;
147 }
148
149 /*
150 * Run the partition pruning logic with this tuple, and accumulate
151 * the partitions matching this tuple to the result.
152 */
153 ResetExprContext(econtext);
154 econtext->ecxt_outertuple = inputSlot;
155 node->part_prune_result = ExecAddMatchingSubPlans(node->prune_state,
156 node->part_prune_result);
157
158 return inputSlot;
159}
160
161/* ----------------------------------------------------------------
162 * ExecReScanPartitionSelector(node)

Callers

nothing calls this directly

Calls 2

ExecProcNodeFunction · 0.85
ExecAddMatchingSubPlansFunction · 0.85

Tested by

no test coverage detected