mirror of https://github.com/citusdata/citus.git
Refactor ScanStateGetExecutorState into its own function.
parent
0b01c59fa6
commit
85325e0098
|
@ -308,7 +308,7 @@ static void
|
|||
CitusReScan(CustomScanState *node)
|
||||
{
|
||||
CitusScanState *scanState = (CitusScanState *) node;
|
||||
EState *executorState = scanState->customScanState.ss.ps.state;
|
||||
EState *executorState = ScanStateGetExecutorState(scanState);
|
||||
ParamListInfo paramListInfo = executorState->es_param_list_info;
|
||||
|
||||
if (paramListInfo != NULL)
|
||||
|
@ -324,8 +324,19 @@ CitusReScan(CustomScanState *node)
|
|||
* ScanStateGetTupleDescriptor returns the tuple descriptor for the given
|
||||
* scan state.
|
||||
*/
|
||||
extern TupleDesc
|
||||
TupleDesc
|
||||
ScanStateGetTupleDescriptor(CitusScanState *scanState)
|
||||
{
|
||||
return scanState->customScanState.ss.ps.ps_ResultTupleSlot->tts_tupleDescriptor;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ScanStateGetExecutorState returns the executor state for the given scan
|
||||
* state.
|
||||
*/
|
||||
EState *
|
||||
ScanStateGetExecutorState(CitusScanState *scanState)
|
||||
{
|
||||
return scanState->customScanState.ss.ps.state;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ CoordinatorInsertSelectExecScan(CustomScanState *node)
|
|||
|
||||
if (!scanState->finishedRemoteScan)
|
||||
{
|
||||
EState *executorState = scanState->customScanState.ss.ps.state;
|
||||
EState *executorState = ScanStateGetExecutorState(scanState);
|
||||
DistributedPlan *distributedPlan = scanState->distributedPlan;
|
||||
Query *selectQuery = distributedPlan->insertSelectSubquery;
|
||||
List *insertTargetList = distributedPlan->insertTargetList;
|
||||
|
|
|
@ -237,6 +237,7 @@ ReturnTupleFromTuplestore(CitusScanState *scanState)
|
|||
{
|
||||
Tuplestorestate *tupleStore = scanState->tuplestorestate;
|
||||
TupleTableSlot *resultSlot = NULL;
|
||||
EState *executorState = NULL;
|
||||
ScanDirection scanDirection = NoMovementScanDirection;
|
||||
bool forwardScanDirection = true;
|
||||
|
||||
|
@ -245,7 +246,8 @@ ReturnTupleFromTuplestore(CitusScanState *scanState)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
scanDirection = scanState->customScanState.ss.ps.state->es_direction;
|
||||
executorState = ScanStateGetExecutorState(scanState);
|
||||
scanDirection = executorState->es_direction;
|
||||
Assert(ScanDirectionIsValid(scanDirection));
|
||||
|
||||
if (ScanDirectionIsBackward(scanDirection))
|
||||
|
|
|
@ -734,7 +734,7 @@ RouterSequentialModifyExecScan(CustomScanState *node)
|
|||
List *taskList = workerJob->taskList;
|
||||
ListCell *taskCell = NULL;
|
||||
bool multipleTasks = list_length(taskList) > 1;
|
||||
EState *executorState = scanState->customScanState.ss.ps.state;
|
||||
EState *executorState = ScanStateGetExecutorState(scanState);
|
||||
bool taskListRequires2PC = TaskListRequires2PC(taskList);
|
||||
bool alwaysThrowErrorOnFailure = false;
|
||||
CmdType operation = scanState->distributedPlan->operation;
|
||||
|
@ -905,8 +905,8 @@ RouterSelectExecScan(CustomScanState *node)
|
|||
static void
|
||||
ExecuteSingleSelectTask(CitusScanState *scanState, Task *task)
|
||||
{
|
||||
ParamListInfo paramListInfo =
|
||||
scanState->customScanState.ss.ps.state->es_param_list_info;
|
||||
EState *executorState = ScanStateGetExecutorState(scanState);
|
||||
ParamListInfo paramListInfo = executorState->es_param_list_info;
|
||||
List *taskPlacementList = task->taskPlacementList;
|
||||
ListCell *taskPlacementCell = NULL;
|
||||
char *queryString = task->queryString;
|
||||
|
@ -1104,7 +1104,7 @@ ExecuteSingleModifyTask(CitusScanState *scanState, Task *task, CmdType operation
|
|||
|
||||
if (scanState)
|
||||
{
|
||||
executorState = scanState->customScanState.ss.ps.state;
|
||||
executorState = ScanStateGetExecutorState(scanState);
|
||||
paramListInfo = executorState->es_param_list_info;
|
||||
}
|
||||
|
||||
|
@ -1350,7 +1350,7 @@ void
|
|||
ExecuteMultipleTasks(CitusScanState *scanState, List *taskList,
|
||||
bool isModificationQuery, bool expectResults)
|
||||
{
|
||||
EState *executorState = scanState->customScanState.ss.ps.state;
|
||||
EState *executorState = ScanStateGetExecutorState(scanState);
|
||||
ParamListInfo paramListInfo = executorState->es_param_list_info;
|
||||
int64 affectedTupleCount = -1;
|
||||
|
||||
|
|
|
@ -38,5 +38,6 @@ extern void RegisterCitusCustomScanMethods(void);
|
|||
extern void CitusExplainScan(CustomScanState *node, List *ancestors, struct
|
||||
ExplainState *es);
|
||||
extern TupleDesc ScanStateGetTupleDescriptor(CitusScanState *scanState);
|
||||
extern EState * ScanStateGetExecutorState(CitusScanState *scanState);
|
||||
|
||||
#endif /* CITUS_CUSTOM_SCAN_H */
|
||||
|
|
Loading…
Reference in New Issue