提交 d7a26c76 编写于 作者: D Daniel Gustafsson

Remove dead code from the executor

The functions GetPartitionTargetlist() and UpdateGenericExprState()
are not called from anywhere so remove.
上级 3032650c
......@@ -824,100 +824,6 @@ ExecAssignProjectionInfo(PlanState *planstate,
inputDesc);
}
/*
* Constructs a new targetlist list that maps to a tuple descriptor.
*/
List *
GetPartitionTargetlist(TupleDesc partDescr, List *targetlist)
{
Assert(NIL != targetlist);
Assert(partDescr);
List *partitionTargetlist = NIL;
AttrMap *attrmap = NULL;
TupleDesc targetDescr = ExecTypeFromTL(targetlist, false);
map_part_attrs_from_targetdesc(targetDescr, partDescr, &attrmap);
ListCell *entry = NULL;
int pos = 1;
foreach(entry, targetlist)
{
TargetEntry *te = (TargetEntry *) lfirst(entry);
/* Obtain corresponding attribute number in the part (this will be the resno). */
int partAtt = (int)attrMap(attrmap, pos);
/* A system attribute should be added to the target list with its original
* attribute number.
*/
if (te->resorigcol < 0)
{
/* te->resorigcol should be equivalent to ((Var *)te->expr)->varattno.
* te->resorigcol is used for simplicity.
*/
Assert(((Var *)te->expr)->varattno == te->resorigcol);
/* Validate interval for system-defined attributes. */
Assert(te->resorigcol > FirstLowInvalidHeapAttributeNumber &&
te->resorigcol <= SelfItemPointerAttributeNumber);
partAtt = te->resorigcol;
}
TargetEntry *newTe = flatCopyTargetEntry(te);
/* Parts are not explicitly specified in the range table. Therefore, the original RTE index is kept. */
Index rteIdx = ((Var *)te->expr)->varno;
/* Variable expression required by the Target Entry. */
Var *var = makeVar(rteIdx,
partAtt,
targetDescr->attrs[pos-1]->atttypid,
targetDescr->attrs[pos-1]->atttypmod,
0 /* resjunk */);
/* Modify resno in the new TargetEntry */
newTe->resno = partAtt;
newTe->expr = (Expr *) var;
partitionTargetlist = lappend(partitionTargetlist, newTe);
pos++;
}
Assert(attrmap);
pfree(attrmap);
Assert(partitionTargetlist);
return partitionTargetlist;
}
/*
* Replace all attribute numbers to the corresponding mapped value (resno)
* in GenericExprState list with the attribute numbers in the target list.
*/
void
UpdateGenericExprState(List *teTargetlist, List *geTargetlist)
{
Assert(list_length(teTargetlist) ==
list_length(geTargetlist));
ListCell *ge = NULL;
ListCell *te = NULL;
forboth(te, teTargetlist, ge, geTargetlist)
{
GenericExprState *gstate = (GenericExprState *)ge->data.ptr_value;
TargetEntry *tle = (TargetEntry *)te->data.ptr_value;
Var *variable = (Var *) gstate->arg->expr;
variable->varattno = tle->resno;
}
}
/* ----------------
* ExecFreeExprContext
*
......
......@@ -432,8 +432,6 @@ extern ExprContext *CreateStandaloneExprContext(void);
extern void FreeExprContext(ExprContext *econtext);
extern void ReScanExprContext(ExprContext *econtext);
extern void ResetExprContext(ExprContext *econtext);
extern List *GetPartitionTargetlist(TupleDesc partDescr, List *targetlist);
extern void UpdateGenericExprState(List *teTargetlist, List *geTargetlist);
extern ExprContext *MakePerTupleExprContext(EState *estate);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册