----------------- * ExecInitTupleSplit * * Creates the run-time information for the tuple split node produced by the * planner and initializes its outer subtree * ----------------- */
| 27 | * ----------------- |
| 28 | */ |
| 29 | TupleSplitState * |
| 30 | ExecInitTupleSplit(TupleSplit *node, EState *estate, int eflags) |
| 31 | { |
| 32 | TupleSplitState *tup_spl_state; |
| 33 | Plan *outerPlan; |
| 34 | |
| 35 | /* check for unsupported flags */ |
| 36 | Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK))); |
| 37 | |
| 38 | tup_spl_state = makeNode(TupleSplitState); |
| 39 | tup_spl_state->ss.ps.plan = (Plan *) node; |
| 40 | tup_spl_state->ss.ps.state = estate; |
| 41 | tup_spl_state->ss.ps.ExecProcNode = ExecTupleSplit; |
| 42 | |
| 43 | ExecAssignExprContext(estate, &tup_spl_state->ss.ps); |
| 44 | |
| 45 | if (estate->es_instrument && (estate->es_instrument & INSTRUMENT_CDB)) |
| 46 | { |
| 47 | tup_spl_state->ss.ps.cdbexplainbuf = makeStringInfo(); |
| 48 | tup_spl_state->ss.ps.cdbexplainfun = NULL; |
| 49 | } |
| 50 | |
| 51 | /* |
| 52 | * initialize child nodes |
| 53 | */ |
| 54 | outerPlan = outerPlan(node); |
| 55 | outerPlanState(tup_spl_state) = ExecInitNode(outerPlan, estate, eflags); |
| 56 | |
| 57 | /* |
| 58 | * initialize source tuple type. |
| 59 | */ |
| 60 | tup_spl_state->ss.ps.outerops = |
| 61 | ExecGetResultSlotOps(outerPlanState(&tup_spl_state->ss), |
| 62 | &tup_spl_state->ss.ps.outeropsfixed); |
| 63 | tup_spl_state->ss.ps.outeropsset = true; |
| 64 | |
| 65 | ExecCreateScanSlotFromOuterPlan(estate, &tup_spl_state->ss, |
| 66 | tup_spl_state->ss.ps.outerops); |
| 67 | |
| 68 | /* initialize result type, slot and projection. */ |
| 69 | ExecInitResultTupleSlotTL(&tup_spl_state->ss.ps, &TTSOpsVirtual); |
| 70 | ExecAssignProjectionInfo(&tup_spl_state->ss.ps, NULL); |
| 71 | |
| 72 | /* |
| 73 | * initialize input tuple isnull buffer |
| 74 | */ |
| 75 | tup_spl_state->isnull_orig = (bool *) palloc0(sizeof(bool) * list_length(outerPlan(node)->targetlist)); |
| 76 | |
| 77 | /* create bitmap set for each dqa expr to store its input tuple attribute number */ |
| 78 | AttrNumber maxAttrNum = 0; |
| 79 | tup_spl_state->numDisDQAs = list_length(node->dqa_expr_lst); |
| 80 | tup_spl_state->dqa_split_bms = palloc0(sizeof(Bitmapset *) * tup_spl_state->numDisDQAs); |
| 81 | tup_spl_state->agg_filter_array = palloc0(sizeof(ExprState *) * tup_spl_state->numDisDQAs); |
| 82 | tup_spl_state->dqa_id_array = palloc0( sizeof(int) * tup_spl_state->numDisDQAs); |
| 83 | |
| 84 | int i = 0; |
| 85 | ListCell *lc; |
| 86 | foreach(lc, node->dqa_expr_lst) |
no test coverage detected