MCPcopy Create free account
hub / github.com/apache/cloudberry / ExecInitExprRec

Function ExecInitExprRec

src/backend/executor/execExpr.c:911–2513  ·  view source on GitHub ↗

* Append the steps necessary for the evaluation of node to ExprState->steps, * possibly recursing into sub-expressions of node. * * node - expression to evaluate * state - ExprState to whose ->steps to append the necessary operations * resv / resnull - where to store the result of the node into */

Source from the content-addressed store, hash-verified

909 * resv / resnull - where to store the result of the node into
910 */
911static void
912ExecInitExprRec(Expr *node, ExprState *state,
913 Datum *resv, bool *resnull)
914{
915 ExprEvalStep scratch = {0};
916
917 /* Guard against stack overflow due to overly complex expressions */
918 check_stack_depth();
919
920 /* Step's output location is always what the caller gave us */
921 Assert(resv != NULL && resnull != NULL);
922 scratch.resvalue = resv;
923 scratch.resnull = resnull;
924
925 /* cases should be ordered as they are in enum NodeTag */
926 switch (nodeTag(node))
927 {
928 case T_Var:
929 {
930 Var *variable = (Var *) node;
931
932 if (variable->varattno == InvalidAttrNumber)
933 {
934 /* whole-row Var */
935 ExecInitWholeRowVar(&scratch, variable, state);
936 }
937 else if (variable->varattno <= 0)
938 {
939 /* system column */
940 scratch.d.var.attnum = variable->varattno;
941 scratch.d.var.vartype = variable->vartype;
942 switch (variable->varno)
943 {
944 case INNER_VAR:
945 scratch.opcode = EEOP_INNER_SYSVAR;
946 break;
947 case OUTER_VAR:
948 scratch.opcode = EEOP_OUTER_SYSVAR;
949 break;
950
951 /* INDEX_VAR is handled by default case */
952
953 default:
954 scratch.opcode = EEOP_SCAN_SYSVAR;
955 break;
956 }
957 }
958 else
959 {
960 /* regular user column */
961 scratch.d.var.attnum = variable->varattno - 1;
962 scratch.d.var.vartype = variable->vartype;
963 switch (variable->varno)
964 {
965 case INNER_VAR:
966 scratch.opcode = EEOP_INNER_VAR;
967 break;
968 case OUTER_VAR:

Callers 10

ExecInitExprFunction · 0.85
ExecInitExprWithParamsFunction · 0.85
ExecInitQualFunction · 0.85
ExecBuildProjectionInfoFunction · 0.85
ExecInitFuncFunction · 0.85
ExecInitSubscriptingRefFunction · 0.85
ExecInitCoerceToDomainFunction · 0.85
ExecBuildAggTransFunction · 0.85

Calls 15

check_stack_depthFunction · 0.85
ExecInitWholeRowVarFunction · 0.85
ExprEvalPushStepFunction · 0.85
lappendFunction · 0.85
pg_leftmost_one_pos32Function · 0.85
ExecInitExprListFunction · 0.85
ExecInitExprFunction · 0.85
ExecInitSubscriptingRefFunction · 0.85
ExecInitFuncFunction · 0.85
list_lengthFunction · 0.85
pg_proc_aclcheckFunction · 0.85
GetUserIdFunction · 0.85

Tested by

no test coverage detected