execnodes.h
来自「PostgreSQL7.4.6 for Linux」· C头文件 代码 · 共 1,127 行 · 第 1/3 页
H
1,127 行
PlanState ps; /* its first field is NodeTag */ Relation ss_currentRelation; HeapScanDesc ss_currentScanDesc; TupleTableSlot *ss_ScanTupleSlot;} ScanState;/* * SeqScan uses a bare ScanState as its state node, since it needs * no additional fields. */typedef ScanState SeqScanState;/* ---------------- * IndexScanState information * * NumIndices number of indices in this scan * IndexPtr current index in use * ScanKeys Skey structures to scan index rels * NumScanKeys array of no of keys in each Skey struct * RuntimeKeyInfo array of array of exprstates for Skeys * that will be evaluated at runtime * RuntimeContext expr context for evaling runtime Skeys * RuntimeKeysReady true if runtime Skeys have been computed * RelationDescs ptr to array of relation descriptors * ScanDescs ptr to array of scan descriptors * DupHash hashtable for recognizing dups in multiple scan * MaxHash max # entries we will allow in hashtable * ---------------- */typedef struct IndexScanState{ ScanState ss; /* its first field is NodeTag */ List *indxqual; List *indxqualorig; int iss_NumIndices; int iss_IndexPtr; int iss_MarkIndexPtr; ScanKey *iss_ScanKeys; int *iss_NumScanKeys; ExprState ***iss_RuntimeKeyInfo; ExprContext *iss_RuntimeContext; bool iss_RuntimeKeysReady; RelationPtr iss_RelationDescs; IndexScanDescPtr iss_ScanDescs; HTAB *iss_DupHash; long iss_MaxHash;} IndexScanState;/* ---------------- * TidScanState information * * NumTids number of tids in this scan * TidPtr current tid in use * TidList evaluated item pointers * ---------------- */typedef struct TidScanState{ ScanState ss; /* its first field is NodeTag */ List *tss_tideval; /* list of ExprState nodes */ int tss_NumTids; int tss_TidPtr; int tss_MarkTidPtr; ItemPointerData *tss_TidList; HeapTupleData tss_htup;} TidScanState;/* ---------------- * SubqueryScanState information * * SubqueryScanState is used for scanning a sub-query in the range table. * The sub-query will have its own EState, which we save here. * ScanTupleSlot references the current output tuple of the sub-query. * * SubEState exec state for sub-query * ---------------- */typedef struct SubqueryScanState{ ScanState ss; /* its first field is NodeTag */ PlanState *subplan; EState *sss_SubEState;} SubqueryScanState;/* ---------------- * FunctionScanState information * * Function nodes are used to scan the results of a * function appearing in FROM (typically a function returning set). * * tupdesc expected return tuple description * tuplestorestate private state of tuplestore.c * funcexpr state for function expression being evaluated * ---------------- */typedef struct FunctionScanState{ ScanState ss; /* its first field is NodeTag */ TupleDesc tupdesc; Tuplestorestate *tuplestorestate; ExprState *funcexpr;} FunctionScanState;/* ---------------------------------------------------------------- * Join State Information * ---------------------------------------------------------------- *//* ---------------- * JoinState information * * Superclass for state nodes of join plans. * ---------------- */typedef struct JoinState{ PlanState ps; JoinType jointype; List *joinqual; /* JOIN quals (in addition to ps.qual) */} JoinState;/* ---------------- * NestLoopState information * * NeedNewOuter true if need new outer tuple on next call * MatchedOuter true if found a join match for current outer tuple * NullInnerTupleSlot prepared null tuple for left outer joins * ---------------- */typedef struct NestLoopState{ JoinState js; /* its first field is NodeTag */ bool nl_NeedNewOuter; bool nl_MatchedOuter; TupleTableSlot *nl_NullInnerTupleSlot;} NestLoopState;/* ---------------- * MergeJoinState information * * OuterSkipQual outerKey1 < innerKey1 ... * InnerSkipQual outerKey1 > innerKey1 ... * JoinState current "state" of join. see executor.h * MatchedOuter true if found a join match for current outer tuple * MatchedInner true if found a join match for current inner tuple * OuterTupleSlot pointer to slot in tuple table for cur outer tuple * InnerTupleSlot pointer to slot in tuple table for cur inner tuple * MarkedTupleSlot pointer to slot in tuple table for marked tuple * NullOuterTupleSlot prepared null tuple for right outer joins * NullInnerTupleSlot prepared null tuple for left outer joins * ---------------- */typedef struct MergeJoinState{ JoinState js; /* its first field is NodeTag */ List *mergeclauses; /* list of ExprState nodes */ List *mj_OuterSkipQual; /* list of ExprState nodes */ List *mj_InnerSkipQual; /* list of ExprState nodes */ int mj_JoinState; bool mj_MatchedOuter; bool mj_MatchedInner; TupleTableSlot *mj_OuterTupleSlot; TupleTableSlot *mj_InnerTupleSlot; TupleTableSlot *mj_MarkedTupleSlot; TupleTableSlot *mj_NullOuterTupleSlot; TupleTableSlot *mj_NullInnerTupleSlot;} MergeJoinState;/* ---------------- * HashJoinState information * * hj_HashTable hash table for the hashjoin * hj_CurBucketNo bucket# for current outer tuple * hj_CurTuple last inner tuple matched to current outer * tuple, or NULL if starting search * (CurBucketNo and CurTuple are meaningless * unless OuterTupleSlot is nonempty!) * hj_OuterHashKeys the outer hash keys in the hashjoin condition * hj_InnerHashKeys the inner hash keys in the hashjoin condition * hj_HashOperators the join operators in the hashjoin condition * hj_OuterTupleSlot tuple slot for outer tuples * hj_HashTupleSlot tuple slot for hashed tuples * hj_NullInnerTupleSlot prepared null tuple for left outer joins * hj_NeedNewOuter true if need new outer tuple on next call * hj_MatchedOuter true if found a join match for current outer * hj_hashdone true if hash-table-build phase is done * ---------------- */typedef struct HashJoinState{ JoinState js; /* its first field is NodeTag */ List *hashclauses; /* list of ExprState nodes */ HashJoinTable hj_HashTable; int hj_CurBucketNo; HashJoinTuple hj_CurTuple; List *hj_OuterHashKeys; /* list of ExprState nodes */ List *hj_InnerHashKeys; /* list of ExprState nodes */ List *hj_HashOperators; /* list of operator OIDs */ TupleTableSlot *hj_OuterTupleSlot; TupleTableSlot *hj_HashTupleSlot; TupleTableSlot *hj_NullInnerTupleSlot; bool hj_NeedNewOuter; bool hj_MatchedOuter; bool hj_hashdone;} HashJoinState;/* ---------------------------------------------------------------- * Materialization State Information * ---------------------------------------------------------------- *//* ---------------- * MaterialState information * * materialize nodes are used to materialize the results * of a subplan into a temporary file. * * ss.ss_ScanTupleSlot refers to output of underlying plan. * ---------------- */typedef struct MaterialState{ ScanState ss; /* its first field is NodeTag */ void *tuplestorestate; /* private state of tuplestore.c */ bool eof_underlying; /* reached end of underlying plan? */} MaterialState;/* ---------------- * SortState information * ---------------- */typedef struct SortState{ ScanState ss; /* its first field is NodeTag */ bool sort_Done; /* sort completed yet? */ void *tuplesortstate; /* private state of tuplesort.c */} SortState;/* --------------------- * GroupState information * ------------------------- */typedef struct GroupState{ ScanState ss; /* its first field is NodeTag */ FmgrInfo *eqfunctions; /* per-field lookup data for equality fns */ HeapTuple grp_firstTuple; /* copy of first tuple of current group */ bool grp_done; /* indicates completion of Group scan */} GroupState;/* --------------------- * AggState information * * ss.ss_ScanTupleSlot refers to output of underlying plan. * * Note: ss.ps.ps_ExprContext contains ecxt_aggvalues and * ecxt_aggnulls arrays, which hold the computed agg values for the current * input group during evaluation of an Agg node's output tuple(s). We * create a second ExprContext, tmpcontext, in which to evaluate input * expressions and run the aggregate transition functions. * ------------------------- *//* these structs are private in nodeAgg.c: */typedef struct AggStatePerAggData *AggStatePerAgg;typedef struct AggStatePerGroupData *AggStatePerGroup;typedef struct AggState{ ScanState ss; /* its first field is NodeTag */ List *aggs; /* all Aggref nodes in targetlist & quals */ int numaggs; /* length of list (could be zero!) */ FmgrInfo *eqfunctions; /* per-grouping-field equality fns */ FmgrInfo *hashfunctions; /* per-grouping-field hash fns */ AggStatePerAgg peragg; /* per-Aggref information */ MemoryContext aggcontext; /* memory context for long-lived data */ ExprContext *tmpcontext; /* econtext for input expressions */ bool agg_done; /* indicates completion of Agg scan */ /* these fields are used in AGG_PLAIN and AGG_SORTED modes: */ AggStatePerGroup pergroup; /* per-Aggref-per-group working state */ HeapTuple grp_firstTuple; /* copy of first tuple of current group */ /* these fields are used in AGG_HASHED mode: */ TupleHashTable hashtable; /* hash table with one entry per group */ bool table_filled; /* hash table filled yet? */ TupleHashIterator hashiter; /* for iterating through hash table */} AggState;/* ---------------- * UniqueState information * * Unique nodes are used "on top of" sort nodes to discard * duplicate tuples returned from the sort phase. Basically * all it does is compare the current tuple from the subplan * with the previously fetched tuple stored in priorTuple. * If the two are identical in all interesting fields, then * we just fetch another tuple from the sort and try again. * ---------------- */typedef struct UniqueState{ PlanState ps; /* its first field is NodeTag */ FmgrInfo *eqfunctions; /* per-field lookup data for equality fns */ HeapTuple priorTuple; /* most recently returned tuple, or NULL */ MemoryContext tempContext; /* short-term context for comparisons */} UniqueState;/* ---------------- * HashState information * ---------------- */typedef struct HashState{ PlanState ps; /* its first field is NodeTag */ HashJoinTable hashtable; /* hash table for the hashjoin */ List *hashkeys; /* list of ExprState nodes */ /* hashkeys is same as parent's hj_InnerHashKeys */} HashState;/* ---------------- * SetOpState information * * SetOp nodes are used "on top of" sort nodes to discard * duplicate tuples returned from the sort phase. These are * more complex than a simple Unique since we have to count * how many duplicates to return. * ---------------- */typedef struct SetOpState{ PlanState ps; /* its first field is NodeTag */ FmgrInfo *eqfunctions; /* per-field lookup data for equality fns */ bool subplan_done; /* has subplan returned EOF? */ long numLeft; /* number of left-input dups of cur group */ long numRight; /* number of right-input dups of cur group */ long numOutput; /* number of dups left to output */ MemoryContext tempContext; /* short-term context for comparisons */} SetOpState;/* ---------------- * LimitState information * * Limit nodes are used to enforce LIMIT/OFFSET clauses. * They just select the desired subrange of their subplan's output. * * offset is the number of initial tuples to skip (0 does nothing). * count is the number of tuples to return after skipping the offset tuples. * If no limit count was specified, count is undefined and noCount is true. * When lstate == LIMIT_INITIAL, offset/count/noCount haven't been set yet. * ---------------- */typedef enum{ LIMIT_INITIAL, /* initial state for LIMIT node */ LIMIT_EMPTY, /* there are no returnable rows */ LIMIT_INWINDOW, /* have returned a row in the window */ LIMIT_SUBPLANEOF, /* at EOF of subplan (within window) */ LIMIT_WINDOWEND, /* stepped off end of window */ LIMIT_WINDOWSTART /* stepped off beginning of window */} LimitStateCond;typedef struct LimitState{ PlanState ps; /* its first field is NodeTag */ ExprState *limitOffset; /* OFFSET parameter, or NULL if none */ ExprState *limitCount; /* COUNT parameter, or NULL if none */ long offset; /* current OFFSET value */ long count; /* current COUNT, if any */ bool noCount; /* if true, ignore count */ LimitStateCond lstate; /* state machine status, as above */ long position; /* 1-based index of last tuple returned */ TupleTableSlot *subSlot; /* tuple last obtained from subplan */} LimitState;#endif /* EXECNODES_H */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?