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

Function ExecResult

src/backend/executor/nodeResult.c:76–171  ·  view source on GitHub ↗

---------------------------------------------------------------- * ExecResult(node) * * returns the tuples from the outer plan which satisfy the * qualification clause. Since result nodes with right * subtrees are never planned, we ignore the right subtree * entirely (for now).. -cim 10/7/89 * * The qualification containing only constant clauses are * checked first before any proc

Source from the content-addressed store, hash-verified

74 * ----------------------------------------------------------------
75 */
76static TupleTableSlot *
77ExecResult(PlanState *pstate)
78{
79 ResultState *node = castNode(ResultState, pstate);
80 TupleTableSlot *outerTupleSlot;
81 PlanState *outerPlan;
82 ExprContext *econtext;
83
84 CHECK_FOR_INTERRUPTS();
85
86 econtext = node->ps.ps_ExprContext;
87
88 /*
89 * check constant qualifications like (2 > 1), if not already done
90 */
91 if (node->rs_checkqual)
92 {
93 bool qualResult = ExecQual(node->resconstantqual, econtext);
94
95 node->rs_checkqual = false;
96 if (!qualResult)
97 {
98 node->rs_done = true;
99 return NULL;
100 }
101 }
102
103 /*
104 * Reset per-tuple memory context to free any expression evaluation
105 * storage allocated in the previous tuple cycle.
106 */
107 ResetExprContext(econtext);
108
109 /*
110 * if rs_done is true then it means that we were asked to return a
111 * constant tuple and we already did the last time ExecResult() was
112 * called, OR that we failed the constant qual check. Either way, now we
113 * are through.
114 */
115 while (!node->rs_done)
116 {
117 outerPlan = outerPlanState(node);
118
119 if (outerPlan != NULL)
120 {
121 /*
122 * retrieve tuples from the outer plan until there are no more.
123 */
124 outerTupleSlot = ExecProcNode(outerPlan);
125
126 if (TupIsNull(outerTupleSlot))
127 return NULL;
128
129 /*
130 * prepare to compute projection expressions, which will expect to
131 * access the input tuples as varno OUTER.
132 */
133 econtext->ecxt_outertuple = outerTupleSlot;

Callers

nothing calls this directly

Calls 5

ExecQualFunction · 0.85
ExecProcNodeFunction · 0.85
ExecQualAndResetFunction · 0.85
ExecProjectFunction · 0.85
TupleMatchesHashFilterFunction · 0.85

Tested by

no test coverage detected