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

Function tuplestore_alloc_read_pointer

src/backend/utils/sort/tuplestore.c:447–474  ·  view source on GitHub ↗

* tuplestore_alloc_read_pointer - allocate another read pointer. * * Returns the pointer's index. * * The new pointer initially copies the position of read pointer 0. * It can have its own eflags, but if any data has been inserted into * the tuplestore, these eflags must not represent an increase in * requirements. */

Source from the content-addressed store, hash-verified

445 * requirements.
446 */
447int
448tuplestore_alloc_read_pointer(Tuplestorestate *state, int eflags)
449{
450 /* Check for possible increase of requirements */
451 if (state->status != TSS_INMEM || state->memtupcount != 0)
452 {
453 if ((state->eflags | eflags) != state->eflags)
454 elog(ERROR, "too late to require new tuplestore eflags");
455 }
456
457 /* Make room for another read pointer if needed */
458 if (state->readptrcount >= state->readptrsize)
459 {
460 int newcnt = state->readptrsize * 2;
461
462 state->readptrs = (TSReadPointer *)
463 repalloc(state->readptrs, newcnt * sizeof(TSReadPointer));
464 state->readptrsize = newcnt;
465 }
466
467 /* And set it up */
468 state->readptrs[state->readptrcount] = state->readptrs[0];
469 state->readptrs[state->readptrcount].eflags = eflags;
470
471 state->eflags |= eflags;
472
473 return state->readptrcount++;
474}
475
476/*
477 * tuplestore_clear

Callers 7

init_tuplestore_stateFunction · 0.85
ExecInitWorkTableScanFunction · 0.85
begin_partitionFunction · 0.85
ExecInitCteScanFunction · 0.85
ExecMaterialFunction · 0.85
ExecRecursiveUnionFunction · 0.85

Calls 1

repallocFunction · 0.50

Tested by

no test coverage detected