What would AggrefExprState nodes' args contain?
От | Vaibhav Kaushal |
---|---|
Тема | What would AggrefExprState nodes' args contain? |
Дата | |
Msg-id | BANLkTi=bZ93oj5iq5YS1Qf77cL68mwbmsg@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: What would AggrefExprState nodes' args contain?
|
Список | pgsql-hackers |
Hello all,<br /><br />While examining the executor, I was wondering what the *args part of AggrefExprState nodes contain.I found that the Aggref (Expr)'s args list is a list of TargetEntry nodes. But the state node's args is initializedin ExecInitExpr as:<br /><br />astate->args = (List *) ExecInitExpr((Expr *) aggref->args,<br /> parent);<br /><br />This would mean that the args is actually a ExprStatenode list with one single item (the ExprState node / tree). I believe it potentially contains the execution treeto determine the state / value of the aggref (sub)expression. But then in the ExecEvalAggref function I do not see theargs coming into picture at all! I am also unable to find a call to some function for executing the state node createdin the args list. Also, no value is being extracted from that node! Why is it so? <br /><br />For quick referenceI am adding the function (may be you don't need it but still... its a small one):<br /><br />/* ----------------------------------------------------------------<br/> * ExecEvalAggref<br /> *<br /> * Returnsa Datum whose value is the value of the precomputed<br /> * aggregate found in the given expression context.<br/> * ----------------------------------------------------------------<br /> */<br />static Datum<br /> ExecEvalAggref(AggrefExprState*aggref, ExprContext *econtext,<br /> bool *isNull, ExprDoneCond *isDone)<br/>{<br /> if (isDone)<br /> *isDone = ExprSingleResult;<br /><br /> if (econtext->ecxt_aggvalues== NULL) /* safety check */<br /> elog(ERROR, "no aggregates in this expressioncontext");<br /><br /> *isNull = econtext->ecxt_aggnulls[aggref->aggno];<br /> return econtext->ecxt_aggvalues[aggref->aggno];<br/>}<br /><br /><br />What is the use of args in AggrefExprState node here?Is it there just for some historical reason?<br /><br />Regards,<br />Vaibhav <br />
В списке pgsql-hackers по дате отправления: