perf new expr

This commit is contained in:
wuchenglin
2023-03-21 11:53:09 +08:00
parent 3ef3d851c8
commit ef67d5d75d
2 changed files with 0 additions and 73 deletions

View File

@ -281,20 +281,6 @@ ExecReadyInterpretedExpr(ExprState *state)
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)
{
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_isnull[resultnum] = innerslot->tts_isnull[attnum];
UpdateElogFieldName(state);
EEO_NEXT();
}
@ -799,8 +783,6 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull, ExprDoneCo
resultslot->tts_values[resultnum] = outerslot->tts_values[attnum];
resultslot->tts_isnull[resultnum] = outerslot->tts_isnull[attnum];
UpdateElogFieldName(state);
EEO_NEXT();
}
@ -818,8 +800,6 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull, ExprDoneCo
resultslot->tts_values[resultnum] = scanslot->tts_values[attnum];
resultslot->tts_isnull[resultnum] = scanslot->tts_isnull[attnum];
UpdateElogFieldName(state);
EEO_NEXT();
}
@ -831,8 +811,6 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull, ExprDoneCo
resultslot->tts_values[resultnum] = state->resvalue;
resultslot->tts_isnull[resultnum] = state->resnull;
UpdateElogFieldName(state);
EEO_NEXT();
}
@ -848,8 +826,6 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull, ExprDoneCo
else
resultslot->tts_values[resultnum] = state->resvalue;
UpdateElogFieldName(state);
EEO_NEXT();
}

View File

@ -222,8 +222,6 @@ static TupleTableSlot *ExecProjectSRF(ProjectSetState *node)
bool haveDoneSets = false; /* any exhausted set exprs in tlist? */
ExprDoneCond isDone = ExprSingleResult;
int argno;
ListCell *lc = NULL;
char* resname = NULL;
ExecClearTuple(resultSlot);
@ -236,27 +234,15 @@ static TupleTableSlot *ExecProjectSRF(ProjectSetState *node)
*/
node->pending_srf_tuples = false;
if (node->ps.plan->targetlist)
lc = list_head(node->ps.plan->targetlist);
for (argno = 0; argno < node->nelems; argno++) {
Node *elem = node->elems[argno];
ExprDoneCond *itemIsDone = &node->elemdone[argno];
Datum *result = &resultSlot->tts_values[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,
isnull, itemIsDone, &hassrf);
ELOG_FIELD_NAME_END;
switch (*itemIsDone) {
case ExprSingleResult:
hasresult = true;
@ -275,9 +261,6 @@ static TupleTableSlot *ExecProjectSRF(ProjectSetState *node)
Assert(false);
break;
}
lc = lnext(lc);
resname = NULL;
}
/* ProjectSet should not be used if there's no SRFs */
@ -292,9 +275,6 @@ static TupleTableSlot *ExecProjectSRF(ProjectSetState *node)
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
* so that we can deliver a tuple (if possible).
@ -306,24 +286,13 @@ static TupleTableSlot *ExecProjectSRF(ProjectSetState *node)
bool *isnull = &resultSlot->tts_isnull[argno];
if (*itemIsDone != ExprEndResult) {
lc = lnext(lc);
resname = NULL;
continue;
}
if (lc) {
TargetEntry *te = (TargetEntry *)lfirst(lc);
resname = te->resname;
}
ELOG_FIELD_NAME_START(resname);
/*restart the done ones*/
*result = ExecMakeFunctionResultSet((FuncExprState*)elem, econtext,
node->argcontext, isnull, itemIsDone);
ELOG_FIELD_NAME_END;
Assert(hassrf);
if (*itemIsDone != ExprEndResult) {
@ -343,9 +312,6 @@ static TupleTableSlot *ExecProjectSRF(ProjectSetState *node)
isDone = ExprEndResult;
break;
}
lc = lnext(lc);
resname = NULL;
}
/*
@ -358,32 +324,17 @@ static TupleTableSlot *ExecProjectSRF(ProjectSetState *node)
if (isDone == ExprEndResult) {
hasresult = false;
if (node->ps.plan->targetlist)
lc = list_head(node->ps.plan->targetlist);
for (argno = 0; argno < node->nelems; argno++) {
Node *elem = node->elems[argno];
ExprDoneCond *itemIsDone = &node->elemdone[argno];
Datum *result = &resultSlot->tts_values[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) {
*result = ExecMakeFunctionResultSet((FuncExprState*)elem, econtext,
node->argcontext, isnull, itemIsDone);
/* no need for MakeExpandedObjectReadOnly */
}
ELOG_FIELD_NAME_END;
lc = lnext(lc);
resname = NULL;
}
}
}