Re: What would AggrefExprState nodes' args contain?
От | Ashutosh Bapat |
---|---|
Тема | Re: What would AggrefExprState nodes' args contain? |
Дата | |
Msg-id | [email protected] обсуждение исходный текст |
Ответ на | What would AggrefExprState nodes' args contain? (Vaibhav Kaushal <[email protected]>) |
Ответы |
Re: What would AggrefExprState nodes' args contain?
|
Список | pgsql-hackers |
The args in AggrefExprState, are used in the functions ExecAgg, ExecInitAgg and their minions to evaluate the aggregates.The ExecEvalAggref() merely retrieves the results of aggregation calculated during ExecAgg.<br /><br /><div class="gmail_quote">On Tue, Apr 26, 2011 at 12:04 PM, Vaibhav Kaushal <span dir="ltr"><<a href="mailto:[email protected]">[email protected]</a>></span>wrote:<br /><blockquote class="gmail_quote"style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"> Helloall,<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 /><font color="#888888">Vaibhav <br /></font></blockquote></div><br/><br clear="all" /><br />-- <br />Best Wishes,<br />Ashutosh Bapat<br />EntepriseDB Corporation<br/>The Enterprise Postgres Company<br /><br />
В списке pgsql-hackers по дате отправления: