forked from huawei/openGauss-server
Merge pull request '表达式计算函数注释' (#14) from Rorre/openGauss-server:master into master
This commit is contained in:
commit
defd901624
|
|
@ -1901,6 +1901,13 @@ static void set_result_for_plpgsql_language_function_with_outparam(FuncExprState
|
||||||
* @bool has_cursor_return - need store out-args cursor info.
|
* @bool has_cursor_return - need store out-args cursor info.
|
||||||
* @bool has_refcursor - need store in-args cursor info.
|
* @bool has_refcursor - need store in-args cursor info.
|
||||||
* @bool isSetReturnFunc - indicate function returns a set.
|
* @bool isSetReturnFunc - indicate function returns a set.
|
||||||
|
*The execution process of the ExecMakeFunctionResult function is as follows.
|
||||||
|
* (1) Check whether funcResultStore exists, if so, get the result and return it
|
||||||
|
(2) The calculated parameter values are stored in fcinfo.
|
||||||
|
(3) Pass the parameter into the expression function to calculate the expression,
|
||||||
|
first determine whether the parameter args exists null, and then determine the return mode of the function that returns the set,
|
||||||
|
SFRM_ValuePerCall mode is to return a value each time the call, The SFRM_Materialize schema is the result set instantiated in Tuplestore.
|
||||||
|
(4) Calculate and return results according to different modes.
|
||||||
*/
|
*/
|
||||||
template <bool has_refcursor, bool has_cursor_return, bool isSetReturnFunc>
|
template <bool has_refcursor, bool has_cursor_return, bool isSetReturnFunc>
|
||||||
static Datum ExecMakeFunctionResult(FuncExprState* fcache, ExprContext* econtext, bool* isNull, ExprDoneCond* isDone)
|
static Datum ExecMakeFunctionResult(FuncExprState* fcache, ExprContext* econtext, bool* isNull, ExprDoneCond* isDone)
|
||||||
|
|
@ -3082,6 +3089,10 @@ no_function_result:
|
||||||
/* ----------------------------------------------------------------
|
/* ----------------------------------------------------------------
|
||||||
* ExecEvalFunc
|
* ExecEvalFunc
|
||||||
* ----------------------------------------------------------------
|
* ----------------------------------------------------------------
|
||||||
|
*The execution process of the ExecEvalFunc function is as follows.
|
||||||
|
(1) Initialize the FuncExprState node by init_fcache function, including initialization parameters, memory management, etc.
|
||||||
|
(2) Judge whether the returned result is of set type according to the data in the FuncExprState function,
|
||||||
|
and call the corresponding function to calculate the result.
|
||||||
*/
|
*/
|
||||||
static Datum ExecEvalFunc(FuncExprState* fcache, ExprContext* econtext, bool* isNull, ExprDoneCond* isDone)
|
static Datum ExecEvalFunc(FuncExprState* fcache, ExprContext* econtext, bool* isNull, ExprDoneCond* isDone)
|
||||||
{
|
{
|
||||||
|
|
@ -3526,6 +3537,10 @@ static Datum ExecEvalNot(BoolExprState* notclause, ExprContext* econtext, bool*
|
||||||
/* ----------------------------------------------------------------
|
/* ----------------------------------------------------------------
|
||||||
* ExecEvalOr
|
* ExecEvalOr
|
||||||
* ----------------------------------------------------------------
|
* ----------------------------------------------------------------
|
||||||
|
*The main execution process of ExecEvalOr function is as follows.
|
||||||
|
(1) Traverse child expression clauses.
|
||||||
|
(2) Use the function ExecEvalExpr to call the expression calculation function in clause and calculate the result.
|
||||||
|
(3) To judge the results, if there is a result in the or expression that meets the conditions, it will jump out of the loop and return directly.
|
||||||
*/
|
*/
|
||||||
static Datum ExecEvalOr(BoolExprState* orExpr, ExprContext* econtext, bool* isNull, ExprDoneCond* isDone)
|
static Datum ExecEvalOr(BoolExprState* orExpr, ExprContext* econtext, bool* isNull, ExprDoneCond* isDone)
|
||||||
{
|
{
|
||||||
|
|
@ -5164,6 +5179,11 @@ Datum ExecEvalExprSwitchContext(ExprState* expression, ExprContext* econtext, bo
|
||||||
* 'parent' may be NULL if we are preparing an expression that is not
|
* 'parent' may be NULL if we are preparing an expression that is not
|
||||||
* associated with a plan tree. (If so, it can't have aggs or subplans.)
|
* associated with a plan tree. (If so, it can't have aggs or subplans.)
|
||||||
* This case should usually come through ExecPrepareExpr, not directly here.
|
* This case should usually come through ExecPrepareExpr, not directly here.
|
||||||
|
*The execution process of the ExecInitExpr function is as follows.
|
||||||
|
(1) Determine whether the input node is empty. If it is empty,return NULL directly, indicating that there is no restriction for expression.
|
||||||
|
(2) According to the type of node input,Initialize variable evalfunc which is the execution function corresponding to node,
|
||||||
|
If the node has parameters or expressions, the function ExecInitExpr will be recursively called and ExprState tree will be generated.
|
||||||
|
(3) Return ExprState tree, and execute the expression recursively according to ExprState tree.
|
||||||
*/
|
*/
|
||||||
ExprState* ExecInitExpr(Expr* node, PlanState* parent)
|
ExprState* ExecInitExpr(Expr* node, PlanState* parent)
|
||||||
{
|
{
|
||||||
|
|
@ -6123,6 +6143,10 @@ Datum fetch_lob_value_from_tuple(varatt_lob_pointer* lob_pointer, Oid update_oid
|
||||||
* of *isDone = ExprMultipleResult signifies a set element, and a return
|
* of *isDone = ExprMultipleResult signifies a set element, and a return
|
||||||
* of *isDone = ExprEndResult signifies end of the set of tuple.
|
* of *isDone = ExprEndResult signifies end of the set of tuple.
|
||||||
* We assume that *isDone has been initialized to ExprSingleResult by caller.
|
* We assume that *isDone has been initialized to ExprSingleResult by caller.
|
||||||
|
* The execution process of the ExecTargetList function is as follows.
|
||||||
|
(1) Iterate over the expressions in targetlist.
|
||||||
|
(2) Calculation of expression results.
|
||||||
|
(3) Judge the itemIsDone[resind] parameter in the results and generate the final tuple.
|
||||||
*/
|
*/
|
||||||
static bool ExecTargetList(List* targetlist, ExprContext* econtext, Datum* values, bool* isnull,
|
static bool ExecTargetList(List* targetlist, ExprContext* econtext, Datum* values, bool* isnull,
|
||||||
ExprDoneCond* itemIsDone, ExprDoneCond* isDone)
|
ExprDoneCond* itemIsDone, ExprDoneCond* isDone)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue