执行器优化,改为函数指针的方式,不访问全局数组

This commit is contained in:
wanghao19920907
2023-01-16 01:30:10 -08:00
parent eee21b1180
commit cbb5b4fe37
77 changed files with 378 additions and 515 deletions

View File

@ -29,6 +29,8 @@
#include "executor/node/nodeTrainModel.h"
#include "db4ai/db4ai_api.h"
static TupleTableSlot* ExecTrainModel(PlanState* state);
static bool ExecFetchTrainModel(void *callback_data, ModelTuple * tuple)
{
TrainModelState *pstate = (TrainModelState*)callback_data;
@ -92,6 +94,7 @@ TrainModelState* ExecInitTrainModel(TrainModel* pnode, EState* estate, int eflag
pstate->config = pnode;
pstate->algorithm = palgo;
pstate->finished = 0;
pstate->ss.ps.ExecProcNode = ExecTrainModel;
// Tuple table initialization
ExecInitScanTupleSlot(estate, &pstate->ss);
@ -140,8 +143,9 @@ TrainModelState* ExecInitTrainModel(TrainModel* pnode, EState* estate, int eflag
return pstate;
}
TupleTableSlot* ExecTrainModel(TrainModelState* pstate)
static TupleTableSlot* ExecTrainModel(PlanState* state)
{
TrainModelState* pstate = castNode(TrainModelState, state);
// check if already finished
if (pstate->finished == pstate->config->configurations)
return NULL;