Github user weinan003 commented on a diff in the pull request:
https://github.com/apache/incubator-hawq/pull/1349#discussion_r177948142
--- Diff: contrib/vexecutor/vexecutor.c ---
@@ -96,20 +140,70 @@ static PlanState* VExecInitNode(PlanState *node,EState
*eState,int eflags)
((VectorizedState*)(subState->vectorized))->parent = node;
}
- //***TODO:process the vectorized execution operators here
+ if(Gp_role != GP_ROLE_DISPATCH)
+ {
+ switch (nodeTag(node) )
+ {
+ case T_AppendOnlyScan:
+ case T_ParquetScan:
+ case T_TableScanState:
+ START_MEMORY_ACCOUNT(curMemoryAccount);
+ {
+ TupleDesc td = ((TableScanState
*)node)->ss.ss_ScanTupleSlot->tts_tupleDescriptor;
+ ((TableScanState
*)node)->ss.ss_ScanTupleSlot->PRIVATE_tb =
PointerGetDatum(tbGenerate(td->natts,BATCHSIZE));
+
node->ps_ResultTupleSlot->PRIVATE_tb =
PointerGetDatum(tbGenerate(td->natts,BATCHSIZE));
+ /* if V->N */
+
backportTupleDescriptor(node,node->ps_ResultTupleSlot->tts_tupleDescriptor);
+ }
+ END_MEMORY_ACCOUNT();
+ break;
+ default:
+ ((VectorizedState
*)node->vectorized)->vectorized = false;
+ break;
+ }
+ }
- elog(DEBUG3, "PG VEXEC INIT NODE");
return node;
}
static TupleTableSlot* VExecProcNode(PlanState *node)
{
- return NULL;
+ TupleTableSlot* result = NULL;
+ switch(nodeTag(node))
+ {
+ case T_ParquetScanState:
+ case T_AppendOnlyScanState:
+ case T_TableScanState:
+ result = ExecTableVScan((TableScanState*)node);
+ break;
+ default:
+ break;
+ }
+ return result;
}
static bool VExecEndNode(PlanState *node)
{
+ if(Gp_role == GP_ROLE_DISPATCH)
+ return false;
+
elog(DEBUG3, "PG VEXEC END NODE");
- return false;
+ bool ret = false;
+ switch (nodeTag(node))
+ {
+ case T_AppendOnlyScanState:
+ case T_ParquetScanState:
+ tbDestroy((TupleBatch *)
(&node->ps_ResultTupleSlot->PRIVATE_tb));
+ tbDestroy((TupleBatch *) (&((TableScanState *)
node)->ss.ss_ScanTupleSlot->PRIVATE_tb));
+ ret = true;
+ break;
+ case T_TableScanState:
--- End diff --
In Init process, we prefer to replace some metadata after normal init
process done, because both normal and vectorized init process most part are
same. In the End step, in the current, I think there is no more we need to do.
Tuplebatch buffer which is reusable buffer can be recycled by memory context,
others data destruct in the normal source release function.
---