Github user wengyanqing commented on a diff in the pull request:
https://github.com/apache/incubator-hawq/pull/1349#discussion_r177941676
--- 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 --
The logic of case T_TableScanState in VExecEndNode is not the same as
VExecInitNode, what's the difference ?
---