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

Function TidNext

src/backend/executor/nodeTidscan.c:311–397  ·  view source on GitHub ↗

---------------------------------------------------------------- * TidNext * * Retrieve a tuple from the TidScan node's currentRelation * using the tids in the TidScanState information. * * ---------------------------------------------------------------- */

Source from the content-addressed store, hash-verified

309 * ----------------------------------------------------------------
310 */
311static TupleTableSlot *
312TidNext(TidScanState *node)
313{
314 EState *estate;
315 ScanDirection direction;
316 Snapshot snapshot;
317 TableScanDesc scan;
318 Relation heapRelation;
319 TupleTableSlot *slot;
320 ItemPointerData *tidList;
321 int numTids;
322 bool bBackward;
323
324 /*
325 * extract necessary information from tid scan node
326 */
327 estate = node->ss.ps.state;
328 direction = estate->es_direction;
329 snapshot = estate->es_snapshot;
330 heapRelation = node->ss.ss_currentRelation;
331 slot = node->ss.ss_ScanTupleSlot;
332
333 /*
334 * First time through, compute the list of TIDs to be visited
335 */
336 if (node->tss_TidList == NULL)
337 TidListEval(node);
338
339 scan = node->ss.ss_currentScanDesc;
340 tidList = node->tss_TidList;
341 numTids = node->tss_NumTids;
342
343 /*
344 * Initialize or advance scan position, depending on direction.
345 */
346 bBackward = ScanDirectionIsBackward(direction);
347 if (bBackward)
348 {
349 if (node->tss_TidPtr < 0)
350 {
351 /* initialize for backward scan */
352 node->tss_TidPtr = numTids - 1;
353 }
354 else
355 node->tss_TidPtr--;
356 }
357 else
358 {
359 if (node->tss_TidPtr < 0)
360 {
361 /* initialize for forward scan */
362 node->tss_TidPtr = 0;
363 }
364 else
365 node->tss_TidPtr++;
366 }
367
368 while (node->tss_TidPtr >= 0 && node->tss_TidPtr < numTids)

Callers

nothing calls this directly

Calls 4

TidListEvalFunction · 0.85
ExecClearTupleFunction · 0.85

Tested by

no test coverage detected