PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
nodeMergejoin.h File Reference
#include "nodes/execnodes.h"
Include dependency graph for nodeMergejoin.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

MergeJoinStateExecInitMergeJoin (MergeJoin *node, EState *estate, int eflags)
 
TupleTableSlotExecMergeJoin (MergeJoinState *node)
 
void ExecEndMergeJoin (MergeJoinState *node)
 
void ExecReScanMergeJoin (MergeJoinState *node)
 

Function Documentation

void ExecEndMergeJoin ( MergeJoinState node)

Definition at line 1605 of file nodeMergejoin.c.

References ExecClearTuple(), ExecEndNode(), ExecFreeExprContext(), innerPlanState, MergeJoinState::js, MJ1_printf, MergeJoinState::mj_MarkedTupleSlot, outerPlanState, JoinState::ps, and PlanState::ps_ResultTupleSlot.

Referenced by ExecEndNode().

1606 {
1607  MJ1_printf("ExecEndMergeJoin: %s\n",
1608  "ending node processing");
1609 
1610  /*
1611  * Free the exprcontext
1612  */
1613  ExecFreeExprContext(&node->js.ps);
1614 
1615  /*
1616  * clean out the tuple table
1617  */
1620 
1621  /*
1622  * shut down the subplans
1623  */
1624  ExecEndNode(innerPlanState(node));
1625  ExecEndNode(outerPlanState(node));
1626 
1627  MJ1_printf("ExecEndMergeJoin: %s\n",
1628  "node processing ended");
1629 }
#define MJ1_printf(s, p)
Definition: execdebug.h:140
PlanState ps
Definition: execnodes.h:1678
void ExecEndNode(PlanState *node)
Definition: execProcnode.c:624
TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
Definition: execTuples.c:439
TupleTableSlot * mj_MarkedTupleSlot
Definition: execnodes.h:1737
void ExecFreeExprContext(PlanState *planstate)
Definition: execUtils.c:685
TupleTableSlot * ps_ResultTupleSlot
Definition: execnodes.h:1077
#define outerPlanState(node)
Definition: execnodes.h:1090
JoinState js
Definition: execnodes.h:1725
#define innerPlanState(node)
Definition: execnodes.h:1089
MergeJoinState* ExecInitMergeJoin ( MergeJoin node,
EState estate,
int  eflags 
)

Definition at line 1423 of file nodeMergejoin.c.

References Assert, check_constant_qual(), CreateExprContext(), elog, ereport, errcode(), errmsg(), ERROR, EXEC_FLAG_BACKWARD, EXEC_FLAG_MARK, EXEC_FLAG_REWIND, EXEC_MJ_INITIALIZE_OUTER, ExecAssignExprContext(), ExecAssignProjectionInfo(), ExecAssignResultTypeFromTL(), ExecGetResultType(), ExecInitExpr(), ExecInitExtraTupleSlot(), ExecInitNode(), ExecInitNullTupleSlot(), ExecInitResultTupleSlot(), ExecSetSlotDescriptor(), innerPlan, innerPlanState, IsA, MergeJoin::join, JOIN_ANTI, JOIN_FULL, JOIN_INNER, JOIN_LEFT, JOIN_RIGHT, JOIN_SEMI, Join::joinqual, JoinState::joinqual, Join::jointype, JoinState::jointype, MergeJoinState::js, list_length(), makeNode, MergeJoin::mergeclauses, MergeJoin::mergeCollations, MergeJoin::mergeFamilies, MergeJoin::mergeNullsFirst, MergeJoin::mergeStrategies, MJ1_printf, MergeJoinState::mj_Clauses, MergeJoinState::mj_ConstFalseJoin, MergeJoinState::mj_ExtraMarks, MergeJoinState::mj_FillInner, MergeJoinState::mj_FillOuter, MergeJoinState::mj_InnerEContext, MergeJoinState::mj_InnerTupleSlot, MergeJoinState::mj_JoinState, MergeJoinState::mj_MarkedTupleSlot, MergeJoinState::mj_MatchedInner, MergeJoinState::mj_MatchedOuter, MergeJoinState::mj_NullInnerTupleSlot, MergeJoinState::mj_NullOuterTupleSlot, MergeJoinState::mj_NumClauses, MergeJoinState::mj_OuterEContext, MergeJoinState::mj_OuterTupleSlot, MJExamineQuals(), NULL, outerPlan, outerPlanState, Join::plan, PlanState::plan, JoinState::ps, Plan::qual, PlanState::qual, PlanState::state, Plan::targetlist, and PlanState::targetlist.

Referenced by ExecInitNode().

1424 {
1425  MergeJoinState *mergestate;
1426 
1427  /* check for unsupported flags */
1428  Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
1429 
1430  MJ1_printf("ExecInitMergeJoin: %s\n",
1431  "initializing node");
1432 
1433  /*
1434  * create state structure
1435  */
1436  mergestate = makeNode(MergeJoinState);
1437  mergestate->js.ps.plan = (Plan *) node;
1438  mergestate->js.ps.state = estate;
1439 
1440  /*
1441  * Miscellaneous initialization
1442  *
1443  * create expression context for node
1444  */
1445  ExecAssignExprContext(estate, &mergestate->js.ps);
1446 
1447  /*
1448  * we need two additional econtexts in which we can compute the join
1449  * expressions from the left and right input tuples. The node's regular
1450  * econtext won't do because it gets reset too often.
1451  */
1452  mergestate->mj_OuterEContext = CreateExprContext(estate);
1453  mergestate->mj_InnerEContext = CreateExprContext(estate);
1454 
1455  /*
1456  * initialize child expressions
1457  */
1458  mergestate->js.ps.targetlist = (List *)
1459  ExecInitExpr((Expr *) node->join.plan.targetlist,
1460  (PlanState *) mergestate);
1461  mergestate->js.ps.qual = (List *)
1462  ExecInitExpr((Expr *) node->join.plan.qual,
1463  (PlanState *) mergestate);
1464  mergestate->js.jointype = node->join.jointype;
1465  mergestate->js.joinqual = (List *)
1466  ExecInitExpr((Expr *) node->join.joinqual,
1467  (PlanState *) mergestate);
1468  mergestate->mj_ConstFalseJoin = false;
1469  /* mergeclauses are handled below */
1470 
1471  /*
1472  * initialize child nodes
1473  *
1474  * inner child must support MARK/RESTORE.
1475  */
1476  outerPlanState(mergestate) = ExecInitNode(outerPlan(node), estate, eflags);
1477  innerPlanState(mergestate) = ExecInitNode(innerPlan(node), estate,
1478  eflags | EXEC_FLAG_MARK);
1479 
1480  /*
1481  * For certain types of inner child nodes, it is advantageous to issue
1482  * MARK every time we advance past an inner tuple we will never return to.
1483  * For other types, MARK on a tuple we cannot return to is a waste of
1484  * cycles. Detect which case applies and set mj_ExtraMarks if we want to
1485  * issue "unnecessary" MARK calls.
1486  *
1487  * Currently, only Material wants the extra MARKs, and it will be helpful
1488  * only if eflags doesn't specify REWIND.
1489  */
1490  if (IsA(innerPlan(node), Material) &&
1491  (eflags & EXEC_FLAG_REWIND) == 0)
1492  mergestate->mj_ExtraMarks = true;
1493  else
1494  mergestate->mj_ExtraMarks = false;
1495 
1496  /*
1497  * tuple table initialization
1498  */
1499  ExecInitResultTupleSlot(estate, &mergestate->js.ps);
1500 
1501  mergestate->mj_MarkedTupleSlot = ExecInitExtraTupleSlot(estate);
1503  ExecGetResultType(innerPlanState(mergestate)));
1504 
1505  switch (node->join.jointype)
1506  {
1507  case JOIN_INNER:
1508  case JOIN_SEMI:
1509  mergestate->mj_FillOuter = false;
1510  mergestate->mj_FillInner = false;
1511  break;
1512  case JOIN_LEFT:
1513  case JOIN_ANTI:
1514  mergestate->mj_FillOuter = true;
1515  mergestate->mj_FillInner = false;
1516  mergestate->mj_NullInnerTupleSlot =
1517  ExecInitNullTupleSlot(estate,
1518  ExecGetResultType(innerPlanState(mergestate)));
1519  break;
1520  case JOIN_RIGHT:
1521  mergestate->mj_FillOuter = false;
1522  mergestate->mj_FillInner = true;
1523  mergestate->mj_NullOuterTupleSlot =
1524  ExecInitNullTupleSlot(estate,
1525  ExecGetResultType(outerPlanState(mergestate)));
1526 
1527  /*
1528  * Can't handle right or full join with non-constant extra
1529  * joinclauses. This should have been caught by planner.
1530  */
1531  if (!check_constant_qual(node->join.joinqual,
1532  &mergestate->mj_ConstFalseJoin))
1533  ereport(ERROR,
1534  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1535  errmsg("RIGHT JOIN is only supported with merge-joinable join conditions")));
1536  break;
1537  case JOIN_FULL:
1538  mergestate->mj_FillOuter = true;
1539  mergestate->mj_FillInner = true;
1540  mergestate->mj_NullOuterTupleSlot =
1541  ExecInitNullTupleSlot(estate,
1542  ExecGetResultType(outerPlanState(mergestate)));
1543  mergestate->mj_NullInnerTupleSlot =
1544  ExecInitNullTupleSlot(estate,
1545  ExecGetResultType(innerPlanState(mergestate)));
1546 
1547  /*
1548  * Can't handle right or full join with non-constant extra
1549  * joinclauses. This should have been caught by planner.
1550  */
1551  if (!check_constant_qual(node->join.joinqual,
1552  &mergestate->mj_ConstFalseJoin))
1553  ereport(ERROR,
1554  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1555  errmsg("FULL JOIN is only supported with merge-joinable join conditions")));
1556  break;
1557  default:
1558  elog(ERROR, "unrecognized join type: %d",
1559  (int) node->join.jointype);
1560  }
1561 
1562  /*
1563  * initialize tuple type and projection info
1564  */
1565  ExecAssignResultTypeFromTL(&mergestate->js.ps);
1566  ExecAssignProjectionInfo(&mergestate->js.ps, NULL);
1567 
1568  /*
1569  * preprocess the merge clauses
1570  */
1571  mergestate->mj_NumClauses = list_length(node->mergeclauses);
1572  mergestate->mj_Clauses = MJExamineQuals(node->mergeclauses,
1573  node->mergeFamilies,
1574  node->mergeCollations,
1575  node->mergeStrategies,
1576  node->mergeNullsFirst,
1577  (PlanState *) mergestate);
1578 
1579  /*
1580  * initialize join state
1581  */
1582  mergestate->mj_JoinState = EXEC_MJ_INITIALIZE_OUTER;
1583  mergestate->mj_MatchedOuter = false;
1584  mergestate->mj_MatchedInner = false;
1585  mergestate->mj_OuterTupleSlot = NULL;
1586  mergestate->mj_InnerTupleSlot = NULL;
1587 
1588  /*
1589  * initialization successful
1590  */
1591  MJ1_printf("ExecInitMergeJoin: %s\n",
1592  "node initialized");
1593 
1594  return mergestate;
1595 }
JoinType jointype
Definition: execnodes.h:1679
List * qual
Definition: plannodes.h:130
#define IsA(nodeptr, _type_)
Definition: nodes.h:559
TupleTableSlot * ExecInitExtraTupleSlot(EState *estate)
Definition: execTuples.c:852
#define MJ1_printf(s, p)
Definition: execdebug.h:140
ExprContext * mj_InnerEContext
Definition: execnodes.h:1741
bool mj_ConstFalseJoin
Definition: execnodes.h:1730
PlanState ps
Definition: execnodes.h:1678
TupleTableSlot * mj_MarkedTupleSlot
Definition: execnodes.h:1737
List * qual
Definition: execnodes.h:1062
TupleTableSlot * mj_NullInnerTupleSlot
Definition: execnodes.h:1739
int errcode(int sqlerrcode)
Definition: elog.c:575
List * targetlist
Definition: execnodes.h:1061
EState * state
Definition: execnodes.h:1049
List * joinqual
Definition: execnodes.h:1680
void ExecAssignResultTypeFromTL(PlanState *planstate)
Definition: execUtils.c:430
List * mergeclauses
Definition: plannodes.h:661
JoinType jointype
Definition: plannodes.h:619
ExprState * ExecInitExpr(Expr *node, PlanState *parent)
Definition: execQual.c:4266
bool mj_MatchedOuter
Definition: execnodes.h:1733
TupleTableSlot * ExecInitNullTupleSlot(EState *estate, TupleDesc tupType)
Definition: execTuples.c:866
static MergeJoinClause MJExamineQuals(List *mergeclauses, Oid *mergefamilies, Oid *mergecollations, int *mergestrategies, bool *mergenullsfirst, PlanState *parent)
#define ERROR
Definition: elog.h:43
void ExecInitResultTupleSlot(EState *estate, PlanState *planstate)
Definition: execTuples.c:832
bool mj_MatchedInner
Definition: execnodes.h:1734
#define EXEC_FLAG_BACKWARD
Definition: executor.h:60
#define outerPlanState(node)
Definition: execnodes.h:1090
#define innerPlan(node)
Definition: plannodes.h:158
void ExecAssignProjectionInfo(PlanState *planstate, TupleDesc inputDesc)
Definition: execUtils.c:657
MergeJoinClause mj_Clauses
Definition: execnodes.h:1727
#define EXEC_FLAG_REWIND
Definition: executor.h:59
#define ereport(elevel, rest)
Definition: elog.h:122
#define EXEC_MJ_INITIALIZE_OUTER
#define outerPlan(node)
Definition: plannodes.h:159
static bool check_constant_qual(List *qual, bool *is_const_false)
void ExecSetSlotDescriptor(TupleTableSlot *slot, TupleDesc tupdesc)
Definition: execTuples.c:247
Oid * mergeFamilies
Definition: plannodes.h:663
Oid * mergeCollations
Definition: plannodes.h:664
Plan * plan
Definition: execnodes.h:1047
JoinState js
Definition: execnodes.h:1725
bool * mergeNullsFirst
Definition: plannodes.h:666
#define makeNode(_type_)
Definition: nodes.h:556
#define NULL
Definition: c.h:226
int * mergeStrategies
Definition: plannodes.h:665
#define Assert(condition)
Definition: c.h:671
#define EXEC_FLAG_MARK
Definition: executor.h:61
TupleTableSlot * mj_InnerTupleSlot
Definition: execnodes.h:1736
void ExecAssignExprContext(EState *estate, PlanState *planstate)
Definition: execUtils.c:408
ExprContext * mj_OuterEContext
Definition: execnodes.h:1740
static int list_length(const List *l)
Definition: pg_list.h:89
TupleTableSlot * mj_NullOuterTupleSlot
Definition: execnodes.h:1738
TupleDesc ExecGetResultType(PlanState *planstate)
Definition: execUtils.c:459
List * targetlist
Definition: plannodes.h:129
int errmsg(const char *fmt,...)
Definition: elog.c:797
Join join
Definition: plannodes.h:660
ExprContext * CreateExprContext(EState *estate)
Definition: execUtils.c:208
#define elog
Definition: elog.h:219
bool mj_ExtraMarks
Definition: execnodes.h:1729
#define innerPlanState(node)
Definition: execnodes.h:1089
PlanState * ExecInitNode(Plan *node, EState *estate, int eflags)
Definition: execProcnode.c:137
Definition: pg_list.h:45
List * joinqual
Definition: plannodes.h:620
TupleTableSlot * mj_OuterTupleSlot
Definition: execnodes.h:1735
Plan plan
Definition: plannodes.h:618
TupleTableSlot* ExecMergeJoin ( MergeJoinState node)

Definition at line 599 of file nodeMergejoin.c.

References Assert, ExprContext::ecxt_innertuple, ExprContext::ecxt_outertuple, elog, ERROR, EXEC_MJ_ENDINNER, EXEC_MJ_ENDOUTER, EXEC_MJ_INITIALIZE_INNER, EXEC_MJ_INITIALIZE_OUTER, EXEC_MJ_JOINTUPLES, EXEC_MJ_NEXTINNER, EXEC_MJ_NEXTOUTER, EXEC_MJ_SKIP_TEST, EXEC_MJ_SKIPINNER_ADVANCE, EXEC_MJ_SKIPOUTER_ADVANCE, EXEC_MJ_TESTOUTER, ExecMarkPos(), ExecProcNode(), ExecProject(), ExecQual(), ExecRestrPos(), innerPlan, innerPlanState, InstrCountFiltered1, InstrCountFiltered2, JOIN_ANTI, JOIN_SEMI, JoinState::joinqual, JoinState::jointype, MergeJoinState::js, MarkInnerTuple, MJ_DEBUG_COMPARE, MJ_DEBUG_PROC_NODE, MJ_DEBUG_QUAL, MJ_dump, MergeJoinState::mj_ExtraMarks, MergeJoinState::mj_FillInner, MergeJoinState::mj_FillOuter, MergeJoinState::mj_InnerTupleSlot, MergeJoinState::mj_JoinState, MergeJoinState::mj_MarkedTupleSlot, MergeJoinState::mj_MatchedInner, MergeJoinState::mj_MatchedOuter, MergeJoinState::mj_OuterTupleSlot, MJ_printf, MJCompare(), MJEVAL_ENDOFJOIN, MJEVAL_MATCHABLE, MJEVAL_NONMATCHABLE, MJEvalInnerValues(), MJEvalOuterValues(), MJFillInner(), MJFillOuter(), NIL, NULL, outerPlan, outerPlanState, JoinState::ps, PlanState::ps_ExprContext, PlanState::ps_ProjInfo, PlanState::qual, ResetExprContext, and TupIsNull.

Referenced by ExecProcNode().

600 {
601  List *joinqual;
602  List *otherqual;
603  bool qualResult;
604  int compareResult;
606  TupleTableSlot *innerTupleSlot;
608  TupleTableSlot *outerTupleSlot;
609  ExprContext *econtext;
610  bool doFillOuter;
611  bool doFillInner;
612 
613  /*
614  * get information from node
615  */
616  innerPlan = innerPlanState(node);
617  outerPlan = outerPlanState(node);
618  econtext = node->js.ps.ps_ExprContext;
619  joinqual = node->js.joinqual;
620  otherqual = node->js.ps.qual;
621  doFillOuter = node->mj_FillOuter;
622  doFillInner = node->mj_FillInner;
623 
624  /*
625  * Reset per-tuple memory context to free any expression evaluation
626  * storage allocated in the previous tuple cycle.
627  */
628  ResetExprContext(econtext);
629 
630  /*
631  * ok, everything is setup.. let's go to work
632  */
633  for (;;)
634  {
635  MJ_dump(node);
636 
637  /*
638  * get the current state of the join and do things accordingly.
639  */
640  switch (node->mj_JoinState)
641  {
642  /*
643  * EXEC_MJ_INITIALIZE_OUTER means that this is the first time
644  * ExecMergeJoin() has been called and so we have to fetch the
645  * first matchable tuple for both outer and inner subplans. We
646  * do the outer side in INITIALIZE_OUTER state, then advance
647  * to INITIALIZE_INNER state for the inner subplan.
648  */
650  MJ_printf("ExecMergeJoin: EXEC_MJ_INITIALIZE_OUTER\n");
651 
652  outerTupleSlot = ExecProcNode(outerPlan);
653  node->mj_OuterTupleSlot = outerTupleSlot;
654 
655  /* Compute join values and check for unmatchability */
656  switch (MJEvalOuterValues(node))
657  {
658  case MJEVAL_MATCHABLE:
659  /* OK to go get the first inner tuple */
661  break;
662  case MJEVAL_NONMATCHABLE:
663  /* Stay in same state to fetch next outer tuple */
664  if (doFillOuter)
665  {
666  /*
667  * Generate a fake join tuple with nulls for the
668  * inner tuple, and return it if it passes the
669  * non-join quals.
670  */
671  TupleTableSlot *result;
672 
673  result = MJFillOuter(node);
674  if (result)
675  return result;
676  }
677  break;
678  case MJEVAL_ENDOFJOIN:
679  /* No more outer tuples */
680  MJ_printf("ExecMergeJoin: nothing in outer subplan\n");
681  if (doFillInner)
682  {
683  /*
684  * Need to emit right-join tuples for remaining
685  * inner tuples. We set MatchedInner = true to
686  * force the ENDOUTER state to advance inner.
687  */
689  node->mj_MatchedInner = true;
690  break;
691  }
692  /* Otherwise we're done. */
693  return NULL;
694  }
695  break;
696 
698  MJ_printf("ExecMergeJoin: EXEC_MJ_INITIALIZE_INNER\n");
699 
700  innerTupleSlot = ExecProcNode(innerPlan);
701  node->mj_InnerTupleSlot = innerTupleSlot;
702 
703  /* Compute join values and check for unmatchability */
704  switch (MJEvalInnerValues(node, innerTupleSlot))
705  {
706  case MJEVAL_MATCHABLE:
707 
708  /*
709  * OK, we have the initial tuples. Begin by skipping
710  * non-matching tuples.
711  */
713  break;
714  case MJEVAL_NONMATCHABLE:
715  /* Mark before advancing, if wanted */
716  if (node->mj_ExtraMarks)
717  ExecMarkPos(innerPlan);
718  /* Stay in same state to fetch next inner tuple */
719  if (doFillInner)
720  {
721  /*
722  * Generate a fake join tuple with nulls for the
723  * outer tuple, and return it if it passes the
724  * non-join quals.
725  */
726  TupleTableSlot *result;
727 
728  result = MJFillInner(node);
729  if (result)
730  return result;
731  }
732  break;
733  case MJEVAL_ENDOFJOIN:
734  /* No more inner tuples */
735  MJ_printf("ExecMergeJoin: nothing in inner subplan\n");
736  if (doFillOuter)
737  {
738  /*
739  * Need to emit left-join tuples for all outer
740  * tuples, including the one we just fetched. We
741  * set MatchedOuter = false to force the ENDINNER
742  * state to emit first tuple before advancing
743  * outer.
744  */
746  node->mj_MatchedOuter = false;
747  break;
748  }
749  /* Otherwise we're done. */
750  return NULL;
751  }
752  break;
753 
754  /*
755  * EXEC_MJ_JOINTUPLES means we have two tuples which satisfied
756  * the merge clause so we join them and then proceed to get
757  * the next inner tuple (EXEC_MJ_NEXTINNER).
758  */
759  case EXEC_MJ_JOINTUPLES:
760  MJ_printf("ExecMergeJoin: EXEC_MJ_JOINTUPLES\n");
761 
762  /*
763  * Set the next state machine state. The right things will
764  * happen whether we return this join tuple or just fall
765  * through to continue the state machine execution.
766  */
768 
769  /*
770  * Check the extra qual conditions to see if we actually want
771  * to return this join tuple. If not, can proceed with merge.
772  * We must distinguish the additional joinquals (which must
773  * pass to consider the tuples "matched" for outer-join logic)
774  * from the otherquals (which must pass before we actually
775  * return the tuple).
776  *
777  * We don't bother with a ResetExprContext here, on the
778  * assumption that we just did one while checking the merge
779  * qual. One per tuple should be sufficient. We do have to
780  * set up the econtext links to the tuples for ExecQual to
781  * use.
782  */
783  outerTupleSlot = node->mj_OuterTupleSlot;
784  econtext->ecxt_outertuple = outerTupleSlot;
785  innerTupleSlot = node->mj_InnerTupleSlot;
786  econtext->ecxt_innertuple = innerTupleSlot;
787 
788  qualResult = (joinqual == NIL ||
789  ExecQual(joinqual, econtext, false));
790  MJ_DEBUG_QUAL(joinqual, qualResult);
791 
792  if (qualResult)
793  {
794  node->mj_MatchedOuter = true;
795  node->mj_MatchedInner = true;
796 
797  /* In an antijoin, we never return a matched tuple */
798  if (node->js.jointype == JOIN_ANTI)
799  {
801  break;
802  }
803 
804  /*
805  * In a semijoin, we'll consider returning the first
806  * match, but after that we're done with this outer tuple.
807  */
808  if (node->js.jointype == JOIN_SEMI)
810 
811  qualResult = (otherqual == NIL ||
812  ExecQual(otherqual, econtext, false));
813  MJ_DEBUG_QUAL(otherqual, qualResult);
814 
815  if (qualResult)
816  {
817  /*
818  * qualification succeeded. now form the desired
819  * projection tuple and return the slot containing it.
820  */
821  MJ_printf("ExecMergeJoin: returning tuple\n");
822 
823  return ExecProject(node->js.ps.ps_ProjInfo);
824  }
825  else
826  InstrCountFiltered2(node, 1);
827  }
828  else
829  InstrCountFiltered1(node, 1);
830  break;
831 
832  /*
833  * EXEC_MJ_NEXTINNER means advance the inner scan to the next
834  * tuple. If the tuple is not nil, we then proceed to test it
835  * against the join qualification.
836  *
837  * Before advancing, we check to see if we must emit an
838  * outer-join fill tuple for this inner tuple.
839  */
840  case EXEC_MJ_NEXTINNER:
841  MJ_printf("ExecMergeJoin: EXEC_MJ_NEXTINNER\n");
842 
843  if (doFillInner && !node->mj_MatchedInner)
844  {
845  /*
846  * Generate a fake join tuple with nulls for the outer
847  * tuple, and return it if it passes the non-join quals.
848  */
849  TupleTableSlot *result;
850 
851  node->mj_MatchedInner = true; /* do it only once */
852 
853  result = MJFillInner(node);
854  if (result)
855  return result;
856  }
857 
858  /*
859  * now we get the next inner tuple, if any. If there's none,
860  * advance to next outer tuple (which may be able to join to
861  * previously marked tuples).
862  *
863  * NB: must NOT do "extraMarks" here, since we may need to
864  * return to previously marked tuples.
865  */
866  innerTupleSlot = ExecProcNode(innerPlan);
867  node->mj_InnerTupleSlot = innerTupleSlot;
868  MJ_DEBUG_PROC_NODE(innerTupleSlot);
869  node->mj_MatchedInner = false;
870 
871  /* Compute join values and check for unmatchability */
872  switch (MJEvalInnerValues(node, innerTupleSlot))
873  {
874  case MJEVAL_MATCHABLE:
875 
876  /*
877  * Test the new inner tuple to see if it matches
878  * outer.
879  *
880  * If they do match, then we join them and move on to
881  * the next inner tuple (EXEC_MJ_JOINTUPLES).
882  *
883  * If they do not match then advance to next outer
884  * tuple.
885  */
886  compareResult = MJCompare(node);
887  MJ_DEBUG_COMPARE(compareResult);
888 
889  if (compareResult == 0)
891  else
892  {
893  Assert(compareResult < 0);
895  }
896  break;
897  case MJEVAL_NONMATCHABLE:
898 
899  /*
900  * It contains a NULL and hence can't match any outer
901  * tuple, so we can skip the comparison and assume the
902  * new tuple is greater than current outer.
903  */
905  break;
906  case MJEVAL_ENDOFJOIN:
907 
908  /*
909  * No more inner tuples. However, this might be only
910  * effective and not physical end of inner plan, so
911  * force mj_InnerTupleSlot to null to make sure we
912  * don't fetch more inner tuples. (We need this hack
913  * because we are not transiting to a state where the
914  * inner plan is assumed to be exhausted.)
915  */
916  node->mj_InnerTupleSlot = NULL;
918  break;
919  }
920  break;
921 
922  /*-------------------------------------------
923  * EXEC_MJ_NEXTOUTER means
924  *
925  * outer inner
926  * outer tuple - 5 5 - marked tuple
927  * 5 5
928  * 6 6 - inner tuple
929  * 7 7
930  *
931  * we know we just bumped into the
932  * first inner tuple > current outer tuple (or possibly
933  * the end of the inner stream)
934  * so get a new outer tuple and then
935  * proceed to test it against the marked tuple
936  * (EXEC_MJ_TESTOUTER)
937  *
938  * Before advancing, we check to see if we must emit an
939  * outer-join fill tuple for this outer tuple.
940  *------------------------------------------------
941  */
942  case EXEC_MJ_NEXTOUTER:
943  MJ_printf("ExecMergeJoin: EXEC_MJ_NEXTOUTER\n");
944 
945  if (doFillOuter && !node->mj_MatchedOuter)
946  {
947  /*
948  * Generate a fake join tuple with nulls for the inner
949  * tuple, and return it if it passes the non-join quals.
950  */
951  TupleTableSlot *result;
952 
953  node->mj_MatchedOuter = true; /* do it only once */
954 
955  result = MJFillOuter(node);
956  if (result)
957  return result;
958  }
959 
960  /*
961  * now we get the next outer tuple, if any
962  */
963  outerTupleSlot = ExecProcNode(outerPlan);
964  node->mj_OuterTupleSlot = outerTupleSlot;
965  MJ_DEBUG_PROC_NODE(outerTupleSlot);
966  node->mj_MatchedOuter = false;
967 
968  /* Compute join values and check for unmatchability */
969  switch (MJEvalOuterValues(node))
970  {
971  case MJEVAL_MATCHABLE:
972  /* Go test the new tuple against the marked tuple */
974  break;
975  case MJEVAL_NONMATCHABLE:
976  /* Can't match, so fetch next outer tuple */
978  break;
979  case MJEVAL_ENDOFJOIN:
980  /* No more outer tuples */
981  MJ_printf("ExecMergeJoin: end of outer subplan\n");
982  innerTupleSlot = node->mj_InnerTupleSlot;
983  if (doFillInner && !TupIsNull(innerTupleSlot))
984  {
985  /*
986  * Need to emit right-join tuples for remaining
987  * inner tuples.
988  */
990  break;
991  }
992  /* Otherwise we're done. */
993  return NULL;
994  }
995  break;
996 
997  /*--------------------------------------------------------
998  * EXEC_MJ_TESTOUTER If the new outer tuple and the marked
999  * tuple satisfy the merge clause then we know we have
1000  * duplicates in the outer scan so we have to restore the
1001  * inner scan to the marked tuple and proceed to join the
1002  * new outer tuple with the inner tuples.
1003  *
1004  * This is the case when
1005  * outer inner
1006  * 4 5 - marked tuple
1007  * outer tuple - 5 5
1008  * new outer tuple - 5 5
1009  * 6 8 - inner tuple
1010  * 7 12
1011  *
1012  * new outer tuple == marked tuple
1013  *
1014  * If the outer tuple fails the test, then we are done
1015  * with the marked tuples, and we have to look for a
1016  * match to the current inner tuple. So we will
1017  * proceed to skip outer tuples until outer >= inner
1018  * (EXEC_MJ_SKIP_TEST).
1019  *
1020  * This is the case when
1021  *
1022  * outer inner
1023  * 5 5 - marked tuple
1024  * outer tuple - 5 5
1025  * new outer tuple - 6 8 - inner tuple
1026  * 7 12
1027  *
1028  * new outer tuple > marked tuple
1029  *
1030  *---------------------------------------------------------
1031  */
1032  case EXEC_MJ_TESTOUTER:
1033  MJ_printf("ExecMergeJoin: EXEC_MJ_TESTOUTER\n");
1034 
1035  /*
1036  * Here we must compare the outer tuple with the marked inner
1037  * tuple. (We can ignore the result of MJEvalInnerValues,
1038  * since the marked inner tuple is certainly matchable.)
1039  */
1040  innerTupleSlot = node->mj_MarkedTupleSlot;
1041  (void) MJEvalInnerValues(node, innerTupleSlot);
1042 
1043  compareResult = MJCompare(node);
1044  MJ_DEBUG_COMPARE(compareResult);
1045 
1046  if (compareResult == 0)
1047  {
1048  /*
1049  * the merge clause matched so now we restore the inner
1050  * scan position to the first mark, and go join that tuple
1051  * (and any following ones) to the new outer.
1052  *
1053  * NOTE: we do not need to worry about the MatchedInner
1054  * state for the rescanned inner tuples. We know all of
1055  * them will match this new outer tuple and therefore
1056  * won't be emitted as fill tuples. This works *only*
1057  * because we require the extra joinquals to be constant
1058  * when doing a right or full join --- otherwise some of
1059  * the rescanned tuples might fail the extra joinquals.
1060  * This obviously won't happen for a constant-true extra
1061  * joinqual, while the constant-false case is handled by
1062  * forcing the merge clause to never match, so we never
1063  * get here.
1064  */
1065  ExecRestrPos(innerPlan);
1066 
1067  /*
1068  * ExecRestrPos probably should give us back a new Slot,
1069  * but since it doesn't, use the marked slot. (The
1070  * previously returned mj_InnerTupleSlot cannot be assumed
1071  * to hold the required tuple.)
1072  */
1073  node->mj_InnerTupleSlot = innerTupleSlot;
1074  /* we need not do MJEvalInnerValues again */
1075 
1077  }
1078  else
1079  {
1080  /* ----------------
1081  * if the new outer tuple didn't match the marked inner
1082  * tuple then we have a case like:
1083  *
1084  * outer inner
1085  * 4 4 - marked tuple
1086  * new outer - 5 4
1087  * 6 5 - inner tuple
1088  * 7
1089  *
1090  * which means that all subsequent outer tuples will be
1091  * larger than our marked inner tuples. So we need not
1092  * revisit any of the marked tuples but can proceed to
1093  * look for a match to the current inner. If there's
1094  * no more inners, no more matches are possible.
1095  * ----------------
1096  */
1097  Assert(compareResult > 0);
1098  innerTupleSlot = node->mj_InnerTupleSlot;
1099 
1100  /* reload comparison data for current inner */
1101  switch (MJEvalInnerValues(node, innerTupleSlot))
1102  {
1103  case MJEVAL_MATCHABLE:
1104  /* proceed to compare it to the current outer */
1106  break;
1107  case MJEVAL_NONMATCHABLE:
1108 
1109  /*
1110  * current inner can't possibly match any outer;
1111  * better to advance the inner scan than the
1112  * outer.
1113  */
1115  break;
1116  case MJEVAL_ENDOFJOIN:
1117  /* No more inner tuples */
1118  if (doFillOuter)
1119  {
1120  /*
1121  * Need to emit left-join tuples for remaining
1122  * outer tuples.
1123  */
1125  break;
1126  }
1127  /* Otherwise we're done. */
1128  return NULL;
1129  }
1130  }
1131  break;
1132 
1133  /*----------------------------------------------------------
1134  * EXEC_MJ_SKIP means compare tuples and if they do not
1135  * match, skip whichever is lesser.
1136  *
1137  * For example:
1138  *
1139  * outer inner
1140  * 5 5
1141  * 5 5
1142  * outer tuple - 6 8 - inner tuple
1143  * 7 12
1144  * 8 14
1145  *
1146  * we have to advance the outer scan
1147  * until we find the outer 8.
1148  *
1149  * On the other hand:
1150  *
1151  * outer inner
1152  * 5 5
1153  * 5 5
1154  * outer tuple - 12 8 - inner tuple
1155  * 14 10
1156  * 17 12
1157  *
1158  * we have to advance the inner scan
1159  * until we find the inner 12.
1160  *----------------------------------------------------------
1161  */
1162  case EXEC_MJ_SKIP_TEST:
1163  MJ_printf("ExecMergeJoin: EXEC_MJ_SKIP_TEST\n");
1164 
1165  /*
1166  * before we advance, make sure the current tuples do not
1167  * satisfy the mergeclauses. If they do, then we update the
1168  * marked tuple position and go join them.
1169  */
1170  compareResult = MJCompare(node);
1171  MJ_DEBUG_COMPARE(compareResult);
1172 
1173  if (compareResult == 0)
1174  {
1175  ExecMarkPos(innerPlan);
1176 
1177  MarkInnerTuple(node->mj_InnerTupleSlot, node);
1178 
1180  }
1181  else if (compareResult < 0)
1183  else
1184  /* compareResult > 0 */
1186  break;
1187 
1188  /*
1189  * SKIPOUTER_ADVANCE: advance over an outer tuple that is
1190  * known not to join to any inner tuple.
1191  *
1192  * Before advancing, we check to see if we must emit an
1193  * outer-join fill tuple for this outer tuple.
1194  */
1196  MJ_printf("ExecMergeJoin: EXEC_MJ_SKIPOUTER_ADVANCE\n");
1197 
1198  if (doFillOuter && !node->mj_MatchedOuter)
1199  {
1200  /*
1201  * Generate a fake join tuple with nulls for the inner
1202  * tuple, and return it if it passes the non-join quals.
1203  */
1204  TupleTableSlot *result;
1205 
1206  node->mj_MatchedOuter = true; /* do it only once */
1207 
1208  result = MJFillOuter(node);
1209  if (result)
1210  return result;
1211  }
1212 
1213  /*
1214  * now we get the next outer tuple, if any
1215  */
1216  outerTupleSlot = ExecProcNode(outerPlan);
1217  node->mj_OuterTupleSlot = outerTupleSlot;
1218  MJ_DEBUG_PROC_NODE(outerTupleSlot);
1219  node->mj_MatchedOuter = false;
1220 
1221  /* Compute join values and check for unmatchability */
1222  switch (MJEvalOuterValues(node))
1223  {
1224  case MJEVAL_MATCHABLE:
1225  /* Go test the new tuple against the current inner */
1227  break;
1228  case MJEVAL_NONMATCHABLE:
1229  /* Can't match, so fetch next outer tuple */
1231  break;
1232  case MJEVAL_ENDOFJOIN:
1233  /* No more outer tuples */
1234  MJ_printf("ExecMergeJoin: end of outer subplan\n");
1235  innerTupleSlot = node->mj_InnerTupleSlot;
1236  if (doFillInner && !TupIsNull(innerTupleSlot))
1237  {
1238  /*
1239  * Need to emit right-join tuples for remaining
1240  * inner tuples.
1241  */
1243  break;
1244  }
1245  /* Otherwise we're done. */
1246  return NULL;
1247  }
1248  break;
1249 
1250  /*
1251  * SKIPINNER_ADVANCE: advance over an inner tuple that is
1252  * known not to join to any outer tuple.
1253  *
1254  * Before advancing, we check to see if we must emit an
1255  * outer-join fill tuple for this inner tuple.
1256  */
1258  MJ_printf("ExecMergeJoin: EXEC_MJ_SKIPINNER_ADVANCE\n");
1259 
1260  if (doFillInner && !node->mj_MatchedInner)
1261  {
1262  /*
1263  * Generate a fake join tuple with nulls for the outer
1264  * tuple, and return it if it passes the non-join quals.
1265  */
1266  TupleTableSlot *result;
1267 
1268  node->mj_MatchedInner = true; /* do it only once */
1269 
1270  result = MJFillInner(node);
1271  if (result)
1272  return result;
1273  }
1274 
1275  /* Mark before advancing, if wanted */
1276  if (node->mj_ExtraMarks)
1277  ExecMarkPos(innerPlan);
1278 
1279  /*
1280  * now we get the next inner tuple, if any
1281  */
1282  innerTupleSlot = ExecProcNode(innerPlan);
1283  node->mj_InnerTupleSlot = innerTupleSlot;
1284  MJ_DEBUG_PROC_NODE(innerTupleSlot);
1285  node->mj_MatchedInner = false;
1286 
1287  /* Compute join values and check for unmatchability */
1288  switch (MJEvalInnerValues(node, innerTupleSlot))
1289  {
1290  case MJEVAL_MATCHABLE:
1291  /* proceed to compare it to the current outer */
1293  break;
1294  case MJEVAL_NONMATCHABLE:
1295 
1296  /*
1297  * current inner can't possibly match any outer;
1298  * better to advance the inner scan than the outer.
1299  */
1301  break;
1302  case MJEVAL_ENDOFJOIN:
1303  /* No more inner tuples */
1304  MJ_printf("ExecMergeJoin: end of inner subplan\n");
1305  outerTupleSlot = node->mj_OuterTupleSlot;
1306  if (doFillOuter && !TupIsNull(outerTupleSlot))
1307  {
1308  /*
1309  * Need to emit left-join tuples for remaining
1310  * outer tuples.
1311  */
1313  break;
1314  }
1315  /* Otherwise we're done. */
1316  return NULL;
1317  }
1318  break;
1319 
1320  /*
1321  * EXEC_MJ_ENDOUTER means we have run out of outer tuples, but
1322  * are doing a right/full join and therefore must null-fill
1323  * any remaining unmatched inner tuples.
1324  */
1325  case EXEC_MJ_ENDOUTER:
1326  MJ_printf("ExecMergeJoin: EXEC_MJ_ENDOUTER\n");
1327 
1328  Assert(doFillInner);
1329 
1330  if (!node->mj_MatchedInner)
1331  {
1332  /*
1333  * Generate a fake join tuple with nulls for the outer
1334  * tuple, and return it if it passes the non-join quals.
1335  */
1336  TupleTableSlot *result;
1337 
1338  node->mj_MatchedInner = true; /* do it only once */
1339 
1340  result = MJFillInner(node);
1341  if (result)
1342  return result;
1343  }
1344 
1345  /* Mark before advancing, if wanted */
1346  if (node->mj_ExtraMarks)
1347  ExecMarkPos(innerPlan);
1348 
1349  /*
1350  * now we get the next inner tuple, if any
1351  */
1352  innerTupleSlot = ExecProcNode(innerPlan);
1353  node->mj_InnerTupleSlot = innerTupleSlot;
1354  MJ_DEBUG_PROC_NODE(innerTupleSlot);
1355  node->mj_MatchedInner = false;
1356 
1357  if (TupIsNull(innerTupleSlot))
1358  {
1359  MJ_printf("ExecMergeJoin: end of inner subplan\n");
1360  return NULL;
1361  }
1362 
1363  /* Else remain in ENDOUTER state and process next tuple. */
1364  break;
1365 
1366  /*
1367  * EXEC_MJ_ENDINNER means we have run out of inner tuples, but
1368  * are doing a left/full join and therefore must null- fill
1369  * any remaining unmatched outer tuples.
1370  */
1371  case EXEC_MJ_ENDINNER:
1372  MJ_printf("ExecMergeJoin: EXEC_MJ_ENDINNER\n");
1373 
1374  Assert(doFillOuter);
1375 
1376  if (!node->mj_MatchedOuter)
1377  {
1378  /*
1379  * Generate a fake join tuple with nulls for the inner
1380  * tuple, and return it if it passes the non-join quals.
1381  */
1382  TupleTableSlot *result;
1383 
1384  node->mj_MatchedOuter = true; /* do it only once */
1385 
1386  result = MJFillOuter(node);
1387  if (result)
1388  return result;
1389  }
1390 
1391  /*
1392  * now we get the next outer tuple, if any
1393  */
1394  outerTupleSlot = ExecProcNode(outerPlan);
1395  node->mj_OuterTupleSlot = outerTupleSlot;
1396  MJ_DEBUG_PROC_NODE(outerTupleSlot);
1397  node->mj_MatchedOuter = false;
1398 
1399  if (TupIsNull(outerTupleSlot))
1400  {
1401  MJ_printf("ExecMergeJoin: end of outer subplan\n");
1402  return NULL;
1403  }
1404 
1405  /* Else remain in ENDINNER state and process next tuple. */
1406  break;
1407 
1408  /*
1409  * broken state value?
1410  */
1411  default:
1412  elog(ERROR, "unrecognized mergejoin state: %d",
1413  (int) node->mj_JoinState);
1414  }
1415  }
1416 }
#define EXEC_MJ_NEXTOUTER
JoinType jointype
Definition: execnodes.h:1679
#define NIL
Definition: pg_list.h:69
TupleTableSlot * ExecProject(ProjectionInfo *projInfo)
Definition: execQual.c:5214
TupleTableSlot * ExecProcNode(PlanState *node)
Definition: execProcnode.c:380
#define EXEC_MJ_SKIPOUTER_ADVANCE
ProjectionInfo * ps_ProjInfo
Definition: execnodes.h:1079
#define EXEC_MJ_TESTOUTER
#define MJ_DEBUG_COMPARE(res)
Definition: execdebug.h:144
#define MJ_dump(state)
Definition: execdebug.h:143
PlanState ps
Definition: execnodes.h:1678
static MJEvalResult MJEvalInnerValues(MergeJoinState *mergestate, TupleTableSlot *innerslot)
static int MJCompare(MergeJoinState *mergestate)
ExprContext * ps_ExprContext
Definition: execnodes.h:1078
#define EXEC_MJ_ENDOUTER
TupleTableSlot * mj_MarkedTupleSlot
Definition: execnodes.h:1737
#define MJ_printf(s)
Definition: execdebug.h:139
List * qual
Definition: execnodes.h:1062
#define EXEC_MJ_INITIALIZE_INNER
#define EXEC_MJ_SKIP_TEST
List * joinqual
Definition: execnodes.h:1680
static TupleTableSlot * MJFillInner(MergeJoinState *node)
static MJEvalResult MJEvalOuterValues(MergeJoinState *mergestate)
void ExecRestrPos(PlanState *node)
Definition: execAmi.c:348
bool mj_MatchedOuter
Definition: execnodes.h:1733
#define ERROR
Definition: elog.h:43
#define EXEC_MJ_NEXTINNER
bool mj_MatchedInner
Definition: execnodes.h:1734
#define MarkInnerTuple(innerTupleSlot, mergestate)
#define outerPlanState(node)
Definition: execnodes.h:1090
#define innerPlan(node)
Definition: plannodes.h:158
TupleTableSlot * ecxt_innertuple
Definition: execnodes.h:129
bool ExecQual(List *qual, ExprContext *econtext, bool resultForNull)
Definition: execQual.c:5055
#define TupIsNull(slot)
Definition: tuptable.h:138
#define InstrCountFiltered1(node, delta)
Definition: execnodes.h:1093
#define EXEC_MJ_INITIALIZE_OUTER
#define outerPlan(node)
Definition: plannodes.h:159
#define EXEC_MJ_JOINTUPLES
#define EXEC_MJ_ENDINNER
#define MJ_DEBUG_PROC_NODE(slot)
Definition: execdebug.h:146
void ExecMarkPos(PlanState *node)
Definition: execAmi.c:299
JoinState js
Definition: execnodes.h:1725
TupleTableSlot * ecxt_outertuple
Definition: execnodes.h:130
#define NULL
Definition: c.h:226
#define Assert(condition)
Definition: c.h:671
TupleTableSlot * mj_InnerTupleSlot
Definition: execnodes.h:1736
#define InstrCountFiltered2(node, delta)
Definition: execnodes.h:1098
#define MJ_DEBUG_QUAL(clause, res)
Definition: execdebug.h:145
#define EXEC_MJ_SKIPINNER_ADVANCE
#define elog
Definition: elog.h:219
bool mj_ExtraMarks
Definition: execnodes.h:1729
#define innerPlanState(node)
Definition: execnodes.h:1089
Definition: pg_list.h:45
static TupleTableSlot * MJFillOuter(MergeJoinState *node)
#define ResetExprContext(econtext)
Definition: executor.h:332
TupleTableSlot * mj_OuterTupleSlot
Definition: execnodes.h:1735
void ExecReScanMergeJoin ( MergeJoinState node)

Definition at line 1632 of file nodeMergejoin.c.

References PlanState::chgParam, EXEC_MJ_INITIALIZE_OUTER, ExecClearTuple(), ExecReScan(), MergeJoinState::js, PlanState::lefttree, MergeJoinState::mj_InnerTupleSlot, MergeJoinState::mj_JoinState, MergeJoinState::mj_MarkedTupleSlot, MergeJoinState::mj_MatchedInner, MergeJoinState::mj_MatchedOuter, MergeJoinState::mj_OuterTupleSlot, NULL, JoinState::ps, and PlanState::righttree.

Referenced by ExecReScan().

1633 {
1635 
1637  node->mj_MatchedOuter = false;
1638  node->mj_MatchedInner = false;
1639  node->mj_OuterTupleSlot = NULL;
1640  node->mj_InnerTupleSlot = NULL;
1641 
1642  /*
1643  * if chgParam of subnodes is not null then plans will be re-scanned by
1644  * first ExecProcNode.
1645  */
1646  if (node->js.ps.lefttree->chgParam == NULL)
1647  ExecReScan(node->js.ps.lefttree);
1648  if (node->js.ps.righttree->chgParam == NULL)
1649  ExecReScan(node->js.ps.righttree);
1650 
1651 }
PlanState ps
Definition: execnodes.h:1678
void ExecReScan(PlanState *node)
Definition: execAmi.c:73
TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
Definition: execTuples.c:439
TupleTableSlot * mj_MarkedTupleSlot
Definition: execnodes.h:1737
struct PlanState * righttree
Definition: execnodes.h:1064
struct PlanState * lefttree
Definition: execnodes.h:1063
bool mj_MatchedOuter
Definition: execnodes.h:1733
bool mj_MatchedInner
Definition: execnodes.h:1734
#define EXEC_MJ_INITIALIZE_OUTER
Bitmapset * chgParam
Definition: execnodes.h:1072
JoinState js
Definition: execnodes.h:1725
#define NULL
Definition: c.h:226
TupleTableSlot * mj_InnerTupleSlot
Definition: execnodes.h:1736
TupleTableSlot * mj_OuterTupleSlot
Definition: execnodes.h:1735