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

Function ExecInitGatherMerge

src/backend/executor/nodeGatherMerge.c:71–178  ·  view source on GitHub ↗

---------------------------------------------------------------- * ExecInitGather * ---------------------------------------------------------------- */

Source from the content-addressed store, hash-verified

69 * ----------------------------------------------------------------
70 */
71GatherMergeState *
72ExecInitGatherMerge(GatherMerge *node, EState *estate, int eflags)
73{
74 GatherMergeState *gm_state;
75 Plan *outerNode;
76 TupleDesc tupDesc;
77
78 /* Gather merge node doesn't have innerPlan node. */
79 Assert(innerPlan(node) == NULL);
80
81 /*
82 * create state structure
83 */
84 gm_state = makeNode(GatherMergeState);
85 gm_state->ps.plan = (Plan *) node;
86 gm_state->ps.state = estate;
87 gm_state->ps.ExecProcNode = ExecGatherMerge;
88
89 gm_state->initialized = false;
90 gm_state->gm_initialized = false;
91 gm_state->tuples_needed = -1;
92
93 /*
94 * Miscellaneous initialization
95 *
96 * create expression context for node
97 */
98 ExecAssignExprContext(estate, &gm_state->ps);
99
100 /*
101 * GatherMerge doesn't support checking a qual (it's always more efficient
102 * to do it in the child node).
103 */
104 Assert(!node->plan.qual);
105
106 /*
107 * now initialize outer plan
108 */
109 outerNode = outerPlan(node);
110 outerPlanState(gm_state) = ExecInitNode(outerNode, estate, eflags);
111
112 /*
113 * Leader may access ExecProcNode result directly (if
114 * need_to_scan_locally), or from workers via tuple queue. So we can't
115 * trivially rely on the slot type being fixed for expressions evaluated
116 * within this node.
117 */
118 gm_state->ps.outeropsset = true;
119 gm_state->ps.outeropsfixed = false;
120
121 /*
122 * Store the tuple descriptor into gather merge state, so we can use it
123 * while initializing the gather merge slots.
124 */
125 tupDesc = ExecGetResultType(outerPlanState(gm_state));
126 gm_state->tupDesc = tupDesc;
127
128 /*

Callers 1

ExecInitNodeFunction · 0.85

Calls 8

ExecAssignExprContextFunction · 0.85
ExecInitNodeFunction · 0.85
ExecGetResultTypeFunction · 0.85
ExecInitResultTypeTLFunction · 0.85
gather_merge_setupFunction · 0.85
palloc0Function · 0.50

Tested by

no test coverage detected