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

Function set_output_count

src/backend/executor/nodeSetOp.c:149–182  ·  view source on GitHub ↗

* We've completed processing a tuple group. Decide how many copies (if any) * of its representative row to emit, and store the count into numOutput. * This logic is straight from the SQL92 specification. */

Source from the content-addressed store, hash-verified

147 * This logic is straight from the SQL92 specification.
148 */
149static void
150set_output_count(SetOpState *setopstate, SetOpStatePerGroup pergroup)
151{
152 SetOp *plannode = (SetOp *) setopstate->ps.plan;
153
154 switch (plannode->cmd)
155 {
156 case SETOPCMD_INTERSECT:
157 if (pergroup->numLeft > 0 && pergroup->numRight > 0)
158 setopstate->numOutput = 1;
159 else
160 setopstate->numOutput = 0;
161 break;
162 case SETOPCMD_INTERSECT_ALL:
163 setopstate->numOutput =
164 (pergroup->numLeft < pergroup->numRight) ?
165 pergroup->numLeft : pergroup->numRight;
166 break;
167 case SETOPCMD_EXCEPT:
168 if (pergroup->numLeft > 0 && pergroup->numRight == 0)
169 setopstate->numOutput = 1;
170 else
171 setopstate->numOutput = 0;
172 break;
173 case SETOPCMD_EXCEPT_ALL:
174 setopstate->numOutput =
175 (pergroup->numLeft < pergroup->numRight) ?
176 0 : (pergroup->numLeft - pergroup->numRight);
177 break;
178 default:
179 elog(ERROR, "unrecognized set op: %d", (int) plannode->cmd);
180 break;
181 }
182}
183
184
185/* ----------------------------------------------------------------

Callers 2

setop_retrieve_directFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected