perf new expr
This commit is contained in:
@ -281,20 +281,6 @@ ExecReadyInterpretedExpr(ExprState *state)
|
|||||||
state->evalfunc = ExecInterpExpr;
|
state->evalfunc = ExecInterpExpr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
|
||||||
UpdateElogFieldName(ExprState *state)
|
|
||||||
{
|
|
||||||
if (state->expr) {
|
|
||||||
ListCell *lc = lnext(state->current_targetentry);
|
|
||||||
if (lc == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
TargetEntry *te = (TargetEntry*)lfirst(lc);
|
|
||||||
state->current_targetentry = lc;
|
|
||||||
ELOG_FIELD_NAME_UPDATE(te->resname);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool IsTableOfFunc(Oid funcOid)
|
static bool IsTableOfFunc(Oid funcOid)
|
||||||
{
|
{
|
||||||
const Oid array_function_start_oid = 7881;
|
const Oid array_function_start_oid = 7881;
|
||||||
@ -780,8 +766,6 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull, ExprDoneCo
|
|||||||
resultslot->tts_values[resultnum] = innerslot->tts_values[attnum];
|
resultslot->tts_values[resultnum] = innerslot->tts_values[attnum];
|
||||||
resultslot->tts_isnull[resultnum] = innerslot->tts_isnull[attnum];
|
resultslot->tts_isnull[resultnum] = innerslot->tts_isnull[attnum];
|
||||||
|
|
||||||
UpdateElogFieldName(state);
|
|
||||||
|
|
||||||
EEO_NEXT();
|
EEO_NEXT();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -799,8 +783,6 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull, ExprDoneCo
|
|||||||
resultslot->tts_values[resultnum] = outerslot->tts_values[attnum];
|
resultslot->tts_values[resultnum] = outerslot->tts_values[attnum];
|
||||||
resultslot->tts_isnull[resultnum] = outerslot->tts_isnull[attnum];
|
resultslot->tts_isnull[resultnum] = outerslot->tts_isnull[attnum];
|
||||||
|
|
||||||
UpdateElogFieldName(state);
|
|
||||||
|
|
||||||
EEO_NEXT();
|
EEO_NEXT();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -818,8 +800,6 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull, ExprDoneCo
|
|||||||
resultslot->tts_values[resultnum] = scanslot->tts_values[attnum];
|
resultslot->tts_values[resultnum] = scanslot->tts_values[attnum];
|
||||||
resultslot->tts_isnull[resultnum] = scanslot->tts_isnull[attnum];
|
resultslot->tts_isnull[resultnum] = scanslot->tts_isnull[attnum];
|
||||||
|
|
||||||
UpdateElogFieldName(state);
|
|
||||||
|
|
||||||
EEO_NEXT();
|
EEO_NEXT();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -831,8 +811,6 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull, ExprDoneCo
|
|||||||
resultslot->tts_values[resultnum] = state->resvalue;
|
resultslot->tts_values[resultnum] = state->resvalue;
|
||||||
resultslot->tts_isnull[resultnum] = state->resnull;
|
resultslot->tts_isnull[resultnum] = state->resnull;
|
||||||
|
|
||||||
UpdateElogFieldName(state);
|
|
||||||
|
|
||||||
EEO_NEXT();
|
EEO_NEXT();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -848,8 +826,6 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull, ExprDoneCo
|
|||||||
else
|
else
|
||||||
resultslot->tts_values[resultnum] = state->resvalue;
|
resultslot->tts_values[resultnum] = state->resvalue;
|
||||||
|
|
||||||
UpdateElogFieldName(state);
|
|
||||||
|
|
||||||
EEO_NEXT();
|
EEO_NEXT();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,8 +222,6 @@ static TupleTableSlot *ExecProjectSRF(ProjectSetState *node)
|
|||||||
bool haveDoneSets = false; /* any exhausted set exprs in tlist? */
|
bool haveDoneSets = false; /* any exhausted set exprs in tlist? */
|
||||||
ExprDoneCond isDone = ExprSingleResult;
|
ExprDoneCond isDone = ExprSingleResult;
|
||||||
int argno;
|
int argno;
|
||||||
ListCell *lc = NULL;
|
|
||||||
char* resname = NULL;
|
|
||||||
|
|
||||||
ExecClearTuple(resultSlot);
|
ExecClearTuple(resultSlot);
|
||||||
|
|
||||||
@ -236,27 +234,15 @@ static TupleTableSlot *ExecProjectSRF(ProjectSetState *node)
|
|||||||
*/
|
*/
|
||||||
node->pending_srf_tuples = false;
|
node->pending_srf_tuples = false;
|
||||||
|
|
||||||
if (node->ps.plan->targetlist)
|
|
||||||
lc = list_head(node->ps.plan->targetlist);
|
|
||||||
|
|
||||||
for (argno = 0; argno < node->nelems; argno++) {
|
for (argno = 0; argno < node->nelems; argno++) {
|
||||||
Node *elem = node->elems[argno];
|
Node *elem = node->elems[argno];
|
||||||
ExprDoneCond *itemIsDone = &node->elemdone[argno];
|
ExprDoneCond *itemIsDone = &node->elemdone[argno];
|
||||||
Datum *result = &resultSlot->tts_values[argno];
|
Datum *result = &resultSlot->tts_values[argno];
|
||||||
bool *isnull = &resultSlot->tts_isnull[argno];
|
bool *isnull = &resultSlot->tts_isnull[argno];
|
||||||
|
|
||||||
if (lc) {
|
|
||||||
TargetEntry *te = (TargetEntry *)lfirst(lc);
|
|
||||||
resname = te->resname;
|
|
||||||
}
|
|
||||||
|
|
||||||
ELOG_FIELD_NAME_START(resname);
|
|
||||||
|
|
||||||
*result = execMakeExprResult(elem, econtext, node->argcontext,
|
*result = execMakeExprResult(elem, econtext, node->argcontext,
|
||||||
isnull, itemIsDone, &hassrf);
|
isnull, itemIsDone, &hassrf);
|
||||||
|
|
||||||
ELOG_FIELD_NAME_END;
|
|
||||||
|
|
||||||
switch (*itemIsDone) {
|
switch (*itemIsDone) {
|
||||||
case ExprSingleResult:
|
case ExprSingleResult:
|
||||||
hasresult = true;
|
hasresult = true;
|
||||||
@ -275,9 +261,6 @@ static TupleTableSlot *ExecProjectSRF(ProjectSetState *node)
|
|||||||
Assert(false);
|
Assert(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
lc = lnext(lc);
|
|
||||||
resname = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ProjectSet should not be used if there's no SRFs */
|
/* ProjectSet should not be used if there's no SRFs */
|
||||||
@ -292,9 +275,6 @@ static TupleTableSlot *ExecProjectSRF(ProjectSetState *node)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node->ps.plan->targetlist)
|
|
||||||
lc = list_head(node->ps.plan->targetlist);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We have some done and some undone sets. Restart the done ones
|
* We have some done and some undone sets. Restart the done ones
|
||||||
* so that we can deliver a tuple (if possible).
|
* so that we can deliver a tuple (if possible).
|
||||||
@ -306,24 +286,13 @@ static TupleTableSlot *ExecProjectSRF(ProjectSetState *node)
|
|||||||
bool *isnull = &resultSlot->tts_isnull[argno];
|
bool *isnull = &resultSlot->tts_isnull[argno];
|
||||||
|
|
||||||
if (*itemIsDone != ExprEndResult) {
|
if (*itemIsDone != ExprEndResult) {
|
||||||
lc = lnext(lc);
|
|
||||||
resname = NULL;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lc) {
|
|
||||||
TargetEntry *te = (TargetEntry *)lfirst(lc);
|
|
||||||
resname = te->resname;
|
|
||||||
}
|
|
||||||
|
|
||||||
ELOG_FIELD_NAME_START(resname);
|
|
||||||
|
|
||||||
/*restart the done ones*/
|
/*restart the done ones*/
|
||||||
*result = ExecMakeFunctionResultSet((FuncExprState*)elem, econtext,
|
*result = ExecMakeFunctionResultSet((FuncExprState*)elem, econtext,
|
||||||
node->argcontext, isnull, itemIsDone);
|
node->argcontext, isnull, itemIsDone);
|
||||||
|
|
||||||
ELOG_FIELD_NAME_END;
|
|
||||||
|
|
||||||
Assert(hassrf);
|
Assert(hassrf);
|
||||||
|
|
||||||
if (*itemIsDone != ExprEndResult) {
|
if (*itemIsDone != ExprEndResult) {
|
||||||
@ -343,9 +312,6 @@ static TupleTableSlot *ExecProjectSRF(ProjectSetState *node)
|
|||||||
isDone = ExprEndResult;
|
isDone = ExprEndResult;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
lc = lnext(lc);
|
|
||||||
resname = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -358,32 +324,17 @@ static TupleTableSlot *ExecProjectSRF(ProjectSetState *node)
|
|||||||
if (isDone == ExprEndResult) {
|
if (isDone == ExprEndResult) {
|
||||||
hasresult = false;
|
hasresult = false;
|
||||||
|
|
||||||
if (node->ps.plan->targetlist)
|
|
||||||
lc = list_head(node->ps.plan->targetlist);
|
|
||||||
|
|
||||||
for (argno = 0; argno < node->nelems; argno++) {
|
for (argno = 0; argno < node->nelems; argno++) {
|
||||||
Node *elem = node->elems[argno];
|
Node *elem = node->elems[argno];
|
||||||
ExprDoneCond *itemIsDone = &node->elemdone[argno];
|
ExprDoneCond *itemIsDone = &node->elemdone[argno];
|
||||||
Datum *result = &resultSlot->tts_values[argno];
|
Datum *result = &resultSlot->tts_values[argno];
|
||||||
bool *isnull = &resultSlot->tts_isnull[argno];
|
bool *isnull = &resultSlot->tts_isnull[argno];
|
||||||
|
|
||||||
if (lc) {
|
|
||||||
TargetEntry *te = (TargetEntry *)lfirst(lc);
|
|
||||||
resname = te->resname;
|
|
||||||
}
|
|
||||||
|
|
||||||
ELOG_FIELD_NAME_START(resname);
|
|
||||||
|
|
||||||
while (*itemIsDone == ExprMultipleResult) {
|
while (*itemIsDone == ExprMultipleResult) {
|
||||||
*result = ExecMakeFunctionResultSet((FuncExprState*)elem, econtext,
|
*result = ExecMakeFunctionResultSet((FuncExprState*)elem, econtext,
|
||||||
node->argcontext, isnull, itemIsDone);
|
node->argcontext, isnull, itemIsDone);
|
||||||
/* no need for MakeExpandedObjectReadOnly */
|
/* no need for MakeExpandedObjectReadOnly */
|
||||||
}
|
}
|
||||||
|
|
||||||
ELOG_FIELD_NAME_END;
|
|
||||||
|
|
||||||
lc = lnext(lc);
|
|
||||||
resname = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user