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

Function ExecEvalWholeRowVar

src/backend/executor/execExprInterp.c:4172–4397  ·  view source on GitHub ↗

* Evaluate a wholerow Var expression. * * Returns a Datum whose value is the value of a whole-row range variable * with respect to given expression context. */

Source from the content-addressed store, hash-verified

4170 * with respect to given expression context.
4171 */
4172void
4173ExecEvalWholeRowVar(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
4174{
4175 Var *variable = op->d.wholerow.var;
4176 TupleTableSlot *slot;
4177 TupleDesc output_tupdesc;
4178 MemoryContext oldcontext;
4179 HeapTupleHeader dtuple;
4180 HeapTuple tuple;
4181
4182 /* This was checked by ExecInitExpr */
4183 Assert(variable->varattno == InvalidAttrNumber);
4184
4185 /* Get the input slot we want */
4186 switch (variable->varno)
4187 {
4188 case INNER_VAR:
4189 /* get the tuple from the inner node */
4190 slot = econtext->ecxt_innertuple;
4191 break;
4192
4193 case OUTER_VAR:
4194 /* get the tuple from the outer node */
4195 slot = econtext->ecxt_outertuple;
4196 break;
4197
4198 /* INDEX_VAR is handled by default case */
4199
4200 default:
4201 /* get the tuple from the relation being scanned */
4202 slot = econtext->ecxt_scantuple;
4203 break;
4204 }
4205
4206 /* Apply the junkfilter if any */
4207 if (op->d.wholerow.junkFilter != NULL)
4208 slot = ExecFilterJunk(op->d.wholerow.junkFilter, slot);
4209
4210 /*
4211 * If first time through, obtain tuple descriptor and check compatibility.
4212 *
4213 * XXX: It'd be great if this could be moved to the expression
4214 * initialization phase, but due to using slots that's currently not
4215 * feasible.
4216 */
4217 if (op->d.wholerow.first)
4218 {
4219 /* optimistically assume we don't need slow path */
4220 op->d.wholerow.slow = false;
4221
4222 /*
4223 * If the Var identifies a named composite type, we must check that
4224 * the actual tuple type is compatible with it.
4225 */
4226 if (variable->vartype != RECORDOID)
4227 {
4228 TupleDesc var_tupdesc;
4229 TupleDesc slot_tupdesc;

Callers 1

ExecInterpExprFunction · 0.85

Calls 14

ExecFilterJunkFunction · 0.85
format_type_beFunction · 0.85
MemoryContextSwitchToFunction · 0.85
CreateTupleDescCopyFunction · 0.85
exec_rt_fetchFunction · 0.85
ExecTypeSetColNamesFunction · 0.85
BlessTupleDescFunction · 0.85
slot_getallattrsFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected