home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / postgres / postgre3.z / postgre3 / src / lib / H / nodes / plannodes.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-27  |  10.1 KB  |  488 lines

  1. /* ----------------------------------------------------------------
  2.  *   FILE
  3.  *    plannodes.h
  4.  *    
  5.  *   DESCRIPTION
  6.  *    definitions for query plan nodes
  7.  *
  8.  *   NOTES
  9.  *    this file is listed in lib/Gen/inherits.sh and in the
  10.  *    INH_SRC list in conf/inh.mk and is used to generate the
  11.  *    obj/lib/C/plannodes.c file
  12.  *
  13.  *    For explanations of what the structure members mean,
  14.  *    see ~postgres/doc/query-tree.t.
  15.  *
  16.  *   IDENTIFICATION
  17.  *    $Header: /private/postgres/src/lib/H/nodes/RCS/plannodes.h,v 1.39 1992/03/31 23:15:35 mer Exp $
  18.  * ----------------------------------------------------------------
  19.  */
  20.  
  21. #ifndef PlanNodesIncluded
  22. #define    PlanNodesIncluded
  23.  
  24. #include "tmp/postgres.h"
  25.  
  26. #include "nodes/nodes.h"        /* bogus inheritance system */
  27. #include "nodes/pg_lisp.h"
  28. #include "nodes/primnodes.h"
  29. #include "nodes/plannodes.gen"
  30. #include "rules/prs2stub.h"
  31.  
  32. /* ----------------------------------------------------------------
  33.  *  Executor State types are used in the plannode structures
  34.  *  so we have to include their definitions too.
  35.  *
  36.  *    Node Type        node information used by executor
  37.  *
  38.  * control nodes
  39.  *
  40.  *    Existential        ExistentialState    exstate;
  41.  *    Result            ResultState        resstate;
  42.  *    Append            AppendState        unionstate;
  43.  *
  44.  * scan nodes
  45.  *
  46.  *        Scan ***        ScanState        scanstate;
  47.  *        IndexScan        IndexScanState        indxstate;
  48.  *
  49.  *      (*** nodes which inherit Scan also inherit scanstate)
  50.  *
  51.  * join nodes
  52.  *
  53.  *    NestLoop        NestLoopState        nlstate;
  54.  *    MergeJoin        MergeJoinState        mergestate;
  55.  *    HashJoin        HashJoinState        hashjoinstate;
  56.  *
  57.  * materialize nodes
  58.  *
  59.  *    Material        MaterialState        matstate;
  60.  *      Sort            SortState        sortstate;
  61.  *      Unique            UniqueState        uniquestate;
  62.  *      Hash            HashState        hashstate;
  63.  *
  64.  * ----------------------------------------------------------------
  65.  */
  66. #include "nodes/execnodes.h"        /* XXX move executor types elsewhere */
  67.  
  68.  
  69. /* ----------------------------------------------------------------
  70.  *    Node Function Declarations
  71.  *
  72.  *  All of these #defines indicate that we have written print/equal/copy
  73.  *  support for the classes named.  The print routines are in
  74.  *  lib/C/printfuncs.c, the equal functions are in lib/C/equalfincs.c and
  75.  *  the copy functions can be found in lib/C/copyfuncs.c
  76.  *
  77.  *  An interface routine is generated automatically by Gen_creator.sh for
  78.  *  each node type.  This routine will call either do nothing or call
  79.  *  an _print, _equal or _copy function defined in one of the above
  80.  *  files, depending on whether or not the appropriate #define is specified.
  81.  *
  82.  *  Thus, when adding a new node type, you have to add a set of
  83.  *  _print, _equal and _copy functions to the above files and then
  84.  *  add some #defines below.
  85.  *
  86.  *  This is pretty complicated, and a better-designed system needs to be
  87.  *  implemented.
  88.  * ----------------------------------------------------------------
  89.  */
  90.  
  91. /* ----------------
  92.  *    Node Out Function declarations
  93.  * ----------------
  94.  */
  95. #define    OutPlanExists
  96. #define    OutResultExists
  97. #define    OutExistentialExists
  98. #define    OutAppendExists
  99. #define    OutJoinExists
  100. #define OutJoinRuleInfoExists
  101. #define    OutNestLoopExists
  102. #define    OutMergeJoinExists
  103. #define    OutHashJoinExists
  104. #define    OutScanExists
  105. #define    OutSeqScanExists
  106. #define    OutIndexScanExists
  107. #define    OutTempExists
  108. #define OutAggExists
  109. #define    OutSortExists
  110. #define    OutHashExists
  111. #define OutUniqueExists
  112. #define OutFragmentExists
  113. #define OutScanTempsExists
  114.  
  115.  
  116. /* ----------------
  117.  *    Node Equal Function declarations
  118.  * ----------------
  119.  */
  120. #define EqualFragmentExists
  121.  
  122.  
  123. /* ----------------
  124.  *    Node Copy Function declarations
  125.  * ----------------
  126.  */
  127. #define    CopyPlanExists
  128. #define    CopyResultExists
  129. #define    CopyExistentialExists
  130. #define    CopyAppendExists
  131. #define    CopyJoinExists
  132. #define CopyJoinRuleInfoExists
  133. #define    CopyNestLoopExists
  134. #define    CopyMergeJoinExists
  135. #define    CopyHashJoinExists
  136. #define    CopyScanExists
  137. #define    CopySeqScanExists
  138. #define    CopyIndexScanExists
  139. #define    CopyTempExists
  140. #define CopyAggExists
  141. #define    CopySortExists
  142. #define    CopyHashExists
  143. #define CopyUniqueExists
  144. #define CopyScanTempsExists
  145.  
  146.  
  147. /* ----------------------------------------------------------------
  148.  *            node definitions
  149.  * ----------------------------------------------------------------
  150.  */
  151.  
  152. /* ----------------
  153.  *    Plan node
  154.  * ----------------
  155.  */
  156.  
  157. /* followind typedef's were added and  'struct Blah''s were replaced
  158.  * with 'BlahPtr' in the #define's.  The reason?  Sprite cannot handle
  159.  * 'struct Blah *blah'.        - ron 'blah blah' choi
  160.  */
  161. typedef    struct EState *EStatePtr;
  162. typedef    struct Plan *PlanPtr;
  163.  
  164. class (Plan) public (Node) {
  165. #define PlanDefs \
  166.     inherits0(Node); \
  167.     Cost            cost; \
  168.     Count            plan_size; \
  169.     Count            plan_width; \
  170.     Count            plan_tupperpage; \
  171.     int            fragment; \
  172.     int            parallel; \
  173.     EStatePtr        state; \
  174.     List            qptargetlist; \
  175.     List            qpqual; \
  176.     PlanPtr            lefttree; \
  177.     PlanPtr            righttree
  178.  /* private: */
  179.     PlanDefs;
  180.  /* public: */
  181. };
  182.  
  183.  
  184. /* --------------
  185.  *  Fragment node
  186.  * --------------
  187.  */
  188. /* followind typedef's were added and  'struct Blah''s were replaced
  189.  * with 'BlahPtr' in the #define's.  The reason?  Sprite cannot handle
  190.  * 'struct Blah *blah'.        - ron 'blah blah' choi
  191.  */
  192. typedef    struct Fragment *FragmentPtr;
  193.  
  194. class (Fragment) public (Node) {
  195. #define FragmentDefs \
  196.         inherits0(Node); \
  197.         Plan               frag_root; \
  198.         Plan               frag_parent_op; \
  199.         int                frag_parallel; \
  200.         List               frag_subtrees; \
  201.         FragmentPtr        frag_parent_frag; \
  202.     List        frag_parsetree; \
  203.     bool        frag_is_inprocess; \
  204.     float        frag_iorate
  205.  /* private: */
  206.         FragmentDefs;
  207.  /* public: */
  208. };
  209.  
  210. /*
  211.  * ===============
  212.  * Top-level nodes
  213.  * ===============
  214.  */
  215.  
  216. /* ----------------
  217.  *    existential node
  218.  * ----------------
  219.  */
  220. class (Existential) public (Plan) {
  221.     inherits1(Plan);
  222.  /* public: */
  223. };
  224.  
  225. /* ----------------
  226.  *    result node
  227.  * ----------------
  228.  */
  229. class (Result) public (Plan) {
  230.     inherits1(Plan);
  231.  /* private: */
  232.     List            resrellevelqual;
  233.     List            resconstantqual;
  234.     ResultState        resstate;
  235.  /* public: */
  236. };
  237.  
  238. /* ----------------
  239.  *    append node
  240.  * ----------------
  241.  */
  242. class (Append) public (Plan) {
  243.     inherits1(Plan);
  244.  /* private: */
  245.     List            unionplans;
  246.     Index            unionrelid;
  247.     List            unionrtentries;
  248.     AppendState        unionstate;
  249.  /* public: */
  250. };
  251.  
  252. /*
  253.  * ==========
  254.  * Scan nodes
  255.  * ==========
  256.  */
  257.  
  258. class (Scan) public (Plan) {
  259. #define    ScanDefs \
  260.     inherits1(Plan); \
  261.     Index            scanrelid; \
  262.        ScanState        scanstate
  263.  /* private: */
  264.     ScanDefs;
  265.  /* public: */
  266. };
  267.  
  268. /* ----------------
  269.  *    sequential scan node
  270.  * ----------------
  271.  */
  272. class (SeqScan) public (Scan) {
  273.     inherits2(Scan);
  274.  /* private: */
  275.  /* public: */
  276. };
  277.  
  278. class (ScanTemps) public (Plan) {
  279. #define ScanTempDefs \
  280.         inherits1(Plan); \
  281.         List        temprelDescs; \
  282.         ScanTempState   scantempState
  283. /* private: */
  284.         ScanTempDefs;
  285. /* public: */
  286. };
  287.  
  288. /* ----------------
  289.  *    index scan node
  290.  * ----------------
  291.  */
  292. class (IndexScan) public (Scan) {
  293.     inherits2(Scan);
  294.  /* private: */
  295.     List            indxid;
  296.     List            indxqual;
  297.     IndexScanState        indxstate;
  298.  /* public: */
  299. };
  300.  
  301. /*
  302.  * ==========
  303.  * Join nodes
  304.  * ==========
  305.  */
  306.  
  307. /* ----------------
  308.  *    Rule information stored in Join nodes
  309.  * ----------------
  310.  */
  311. class (JoinRuleInfo) public (Node) {
  312.     inherits0(Node);
  313.  /* private: */
  314.     ObjectId    jri_operator;
  315.     AttributeNumber    jri_inattrno;
  316.     AttributeNumber    jri_outattrno;
  317.     RuleLock    jri_lock;
  318.     ObjectId    jri_ruleid;
  319.     Prs2StubId    jri_stubid;
  320.     Prs2OneStub    jri_stub;
  321.     Prs2StubStats    jri_stats;
  322.  /* public: */
  323. };
  324.  
  325. /* ----------------
  326.  *    Join node
  327.  * ----------------
  328.  */
  329.  
  330. /* followind typedef's were added and  'struct Blah''s were replaced
  331.  * with 'BlahPtr' in the #define's.  The reason?  Sprite cannot handle
  332.  * 'struct Blah *blah'.        - ron 'blah blah' choi
  333.  */
  334. typedef    struct JoinRuleInfo *JoinRuleInfoPtr;
  335.  
  336. class (Join) public (Plan) {
  337. #define    JoinDefs \
  338.     inherits1(Plan);    \
  339.     JoinRuleInfoPtr    ruleinfo
  340.  /* private: */
  341.     JoinDefs;
  342.  /* public: */
  343. };
  344.  
  345. /* ----------------
  346.  *    nest loop join node
  347.  * ----------------
  348.  */
  349. class (NestLoop) public (Join) {
  350.     inherits2(Join);
  351.  /* private: */
  352.     NestLoopState        nlstate;
  353.     JoinRuleInfo        nlRuleInfo;
  354.  /* public: */
  355. };
  356.  
  357. /* ----------------
  358.  *    merge join node
  359.  * ----------------
  360.  */
  361. class (MergeJoin) public (Join) {
  362.     inherits2(Join);
  363.  /* private: */
  364.     List            mergeclauses;
  365.     ObjectId        mergesortop;
  366.     List            mergerightorder;
  367.     List            mergeleftorder;
  368.     MergeJoinState        mergestate;
  369.  /* public: */
  370. };
  371.  
  372. /* ----------------
  373.  *    hash join (probe) node
  374.  * ----------------
  375.  */
  376. class (HashJoin) public (Join) {
  377.     inherits2(Join);
  378.  /* private: */
  379.     List            hashclauses;
  380.     ObjectId        hashjoinop;
  381.     HashJoinState        hashjoinstate;
  382.     HashJoinTable        hashjointable;
  383.     IpcMemoryKey        hashjointablekey;
  384.     int            hashjointablesize;
  385.     bool            hashdone;
  386.  /* public: */
  387. };
  388.  
  389.  
  390. /*
  391.  * ==========
  392.  * Temp nodes
  393.  * ==========
  394.  */
  395.  
  396. class (Temp) public (Plan) {
  397. #define    TempDefs \
  398.     inherits1(Plan); \
  399.     ObjectId        tempid; \
  400.     Count            keycount
  401.  /* private: */
  402.     TempDefs;
  403.  /* public: */
  404. };
  405.  
  406. /* ----------------
  407.  *    materialization node
  408.  * ----------------
  409.  */
  410. class (Material) public (Temp) {
  411. #define MaterialDefs \
  412.     inherits2(Temp); \
  413.     MaterialState        matstate
  414.  /* private: */
  415.     MaterialDefs;
  416.  /* public: */
  417. };
  418.  
  419. /* ----------------
  420.  *    sort node
  421.  * ----------------
  422.  */
  423. class (Sort) public (Temp) {
  424. #define    SortDefs \
  425.     inherits2(Temp); \
  426.     SortState        sortstate
  427.  /* private: */
  428.     SortDefs;
  429.  /* public: */
  430. };
  431. /* ---------------
  432.  *      aggregate node
  433.  * ---------------
  434.  */
  435. class (Agg) public (Temp) {
  436. #define AggDefs \
  437.     inherits2(Temp); \
  438.     String                  aggname; \
  439.     AggState                aggstate
  440.     /* private */
  441.     AggDefs;
  442.     /* public: */
  443. };
  444.  
  445. /* ----------------
  446.  *    unique node
  447.  * ----------------
  448.  */
  449. class (Unique) public (Temp) {
  450. #define UniqueDefs \
  451.     inherits2(Temp); \
  452.     UniqueState        uniquestate
  453.  /* private: */
  454.     UniqueDefs;
  455.  /* public: */
  456. };
  457.  
  458. /* ----------------
  459.  *    hash build node
  460.  * ----------------
  461.  */
  462. class (Hash) public (Plan) {
  463. #define HashDefs \
  464.     inherits1(Plan); \
  465.     Var            hashkey; \
  466.     HashState        hashstate; \
  467.     HashJoinTable        hashtable; \
  468.     IpcMemoryKey        hashtablekey; \
  469.     int            hashtablesize
  470.  /* private: */
  471.     HashDefs;
  472.  /* public: */
  473. };
  474.  
  475. /* ---------------------
  476.  *    choose node
  477.  * ---------------------
  478.  */
  479. class (Choose) public (Plan) {
  480. #define ChooseDefs \
  481.     inherits1(Plan); \
  482.     List            chooseplanlist
  483. /* private: */
  484.     ChooseDefs;
  485. /* public: */
  486. };
  487. #endif /* PlanNodesIncluded */
  488.