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

Function CreateExecutorState

src/backend/executor/execUtils.c:123–219  ·  view source on GitHub ↗

---------------- * CreateExecutorState * * Create and initialize an EState node, which is the root of * working storage for an entire Executor invocation. * * Principally, this creates the per-query memory context that will be * used to hold all working data that lives till the end of the query. * Note that the per-query context will become a child of the caller's * CurrentMemoryContex

Source from the content-addressed store, hash-verified

121 * ----------------
122 */
123EState *
124CreateExecutorState(void)
125{
126 EState *estate;
127 MemoryContext qcontext;
128 MemoryContext oldcontext;
129
130 /*
131 * Create the per-query context for this Executor run.
132 */
133 qcontext = AllocSetContextCreate(CurrentMemoryContext,
134 "ExecutorState",
135 ALLOCSET_DEFAULT_SIZES);
136 MemoryContextDeclareAccountingRoot(qcontext);
137
138 /*
139 * Make the EState node within the per-query context. This way, we don't
140 * need a separate pfree() operation for it at shutdown.
141 */
142 oldcontext = MemoryContextSwitchTo(qcontext);
143
144 estate = makeNode(EState);
145
146 /*
147 * Initialize all fields of the Executor State structure
148 */
149 estate->es_direction = ForwardScanDirection;
150 estate->es_snapshot = InvalidSnapshot; /* caller must initialize this */
151 estate->es_crosscheck_snapshot = InvalidSnapshot; /* no crosscheck */
152 estate->es_range_table = NIL;
153 estate->es_range_table_size = 0;
154 estate->es_relations = NULL;
155 estate->es_rowmarks = NULL;
156 estate->es_plannedstmt = NULL;
157
158 estate->es_junkFilter = NULL;
159
160 estate->es_output_cid = (CommandId) 0;
161
162 estate->es_result_relations = NULL;
163 estate->es_opened_result_relations = NIL;
164 estate->es_tuple_routing_result_relations = NIL;
165 estate->es_trig_target_relations = NIL;
166
167 estate->es_param_list_info = NULL;
168 estate->es_param_exec_vals = NULL;
169
170 estate->es_queryEnv = NULL;
171
172 estate->es_query_cxt = qcontext;
173
174 estate->es_tupleTable = NIL;
175
176 estate->es_processed = 0;
177
178 estate->es_top_eflags = 0;
179 estate->es_instrument = 0;
180 estate->es_finished = false;

Callers 15

BeginMethod · 0.85
IndexBuildRangeScanMethod · 0.85
plpgsql_create_econtextFunction · 0.85
plpgsql_inline_handlerFunction · 0.85
compute_expr_statsFunction · 0.85
make_build_dataFunction · 0.85
tuplesort_begin_clusterFunction · 0.85
compute_index_statsFunction · 0.85
unique_key_recheckFunction · 0.85
afterTriggerInvokeEventsFunction · 0.85
validateDomainConstraintFunction · 0.85
CopyFromDirectoryTableFunction · 0.85

Calls 2

MemoryContextSwitchToFunction · 0.85

Tested by 2

operator_predicate_proofFunction · 0.68