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

Function ExecInitDynamicSeqScan

src/backend/executor/nodeDynamicSeqscan.c:41–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39static void CleanupOnePartition(DynamicSeqScanState *node);
40
41DynamicSeqScanState *
42ExecInitDynamicSeqScan(DynamicSeqScan *node, EState *estate, int eflags)
43{
44 DynamicSeqScanState *state;
45 Oid reloid;
46 ListCell *lc;
47 int i;
48
49 Assert((eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)) == 0);
50
51 state = makeNode(DynamicSeqScanState);
52 state->eflags = eflags;
53 state->ss.ps.plan = (Plan *) node;
54 state->ss.ps.state = estate;
55 state->ss.ps.ExecProcNode = ExecDynamicSeqScan;
56 state->did_pruning = false;
57 state->scan_state = SCAN_INIT;
58
59 /* Initialize child expressions. This is needed to find subplans. */
60 state->ss.ps.qual =
61 ExecInitQual(node->seqscan.plan.qual, (PlanState *) state);
62
63 Relation scanRel = ExecOpenScanRelation(estate, node->seqscan.scanrelid, eflags);
64 ExecInitScanTupleSlot(estate, &state->ss, RelationGetDescr(scanRel), table_slot_callbacks(scanRel));
65
66 /* Dynamic table/index/bitmap scan can't tell the ops of tupleslot */
67 state->ss.ps.scanopsfixed = false;
68 state->ss.ps.scanopsset = true;
69
70 /* Initialize result tuple type. */
71 ExecInitResultTypeTL(&state->ss.ps);
72 ExecAssignScanProjectionInfo(&state->ss);
73
74 state->ss.ps.resultopsfixed = false;
75 state->ss.ps.resultopsset = true;
76
77 state->nOids = list_length(node->partOids);
78 state->partOids = palloc(sizeof(Oid) * state->nOids);
79 foreach_with_count(lc, node->partOids, i)
80 state->partOids[i] = lfirst_oid(lc);
81 state->whichPart = -1;
82
83 reloid = exec_rt_fetch(node->seqscan.scanrelid, estate)->relid;
84 Assert(OidIsValid(reloid));
85
86 /* lastRelOid is used to remap varattno for heterogeneous partitions */
87 state->lastRelOid = reloid;
88
89 state->scanrelid = node->seqscan.scanrelid;
90
91 state->as_prune_state = NULL;
92
93 /*
94 * This context will be reset per-partition to free up per-partition
95 * qual and targetlist allocations
96 */
97 state->partitionMemoryContext = AllocSetContextCreate(CurrentMemoryContext,
98 "DynamicSeqScanPerPartition",

Callers 1

ExecInitNodeFunction · 0.85

Calls 10

ExecInitQualFunction · 0.85
ExecOpenScanRelationFunction · 0.85
ExecInitScanTupleSlotFunction · 0.85
table_slot_callbacksFunction · 0.85
ExecInitResultTypeTLFunction · 0.85
list_lengthFunction · 0.85
foreach_with_countFunction · 0.85
exec_rt_fetchFunction · 0.85
pallocFunction · 0.50

Tested by

no test coverage detected