📄 execnodes.h
字号:
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 * * indexqualorig execution state for indexqualorig expressions * ScanKeys Skey structures to scan index rel * NumScanKeys number of Skey structs * RuntimeKeyInfo 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 * RelationDesc index relation descriptor * ScanDesc index scan descriptor * ---------------- */typedef struct IndexScanState{ ScanState ss; /* its first field is NodeTag */ List *indexqualorig; ScanKey iss_ScanKeys; int iss_NumScanKeys; ExprState **iss_RuntimeKeyInfo; ExprContext *iss_RuntimeContext; bool iss_RuntimeKeysReady; Relation iss_RelationDesc; IndexScanDesc iss_ScanDesc;} IndexScanState;/* ---------------- * BitmapIndexScanState information * * result bitmap to return output into, or NULL * ScanKeys Skey structures to scan index rel * NumScanKeys number of Skey structs * RuntimeKeyInfo 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 * RelationDesc index relation descriptor * ScanDesc index scan descriptor * ---------------- */typedef struct BitmapIndexScanState{ ScanState ss; /* its first field is NodeTag */ TIDBitmap *biss_result; ScanKey biss_ScanKeys; int biss_NumScanKeys; ExprState **biss_RuntimeKeyInfo; ExprContext *biss_RuntimeContext; bool biss_RuntimeKeysReady; Relation biss_RelationDesc; IndexScanDesc biss_ScanDesc;} BitmapIndexScanState;/* ---------------- * BitmapHeapScanState information * * bitmapqualorig execution state for bitmapqualorig expressions * tbm bitmap obtained from child index scan(s) * tbmres current-page data * curslot current tbmres index or tuple offset on page * minslot lowest tbmres index or tuple offset to try * maxslot highest tbmres index or tuple offset to try * ---------------- */typedef struct BitmapHeapScanState{ ScanState ss; /* its first field is NodeTag */ List *bitmapqualorig; TIDBitmap *tbm; TBMIterateResult *tbmres; int curslot; int minslot; int maxslot;} BitmapHeapScanState;/* ---------------- * 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 * * NumClauses number of mergejoinable join clauses * Clauses info for each mergejoinable clause * JoinState current "state" of join. see execdefs.h * FillOuter true if should emit unjoined outer tuples anyway * FillInner true if should emit unjoined inner tuples anyway * MatchedOuter true if found a join match for current outer tuple * MatchedInner true if found a join match for current inner tuple * OuterTupleSlot slot in tuple table for cur outer tuple * InnerTupleSlot slot in tuple table for cur inner tuple * MarkedTupleSlot slot in tuple table for marked tuple * NullOuterTupleSlot prepared null tuple for right outer joins * NullInnerTupleSlot prepared null tuple for left outer joins * OuterEContext workspace for computing outer tuple's join values * InnerEContext workspace for computing inner tuple's join values * ---------------- *//* private in nodeMergejoin.c: */typedef struct MergeJoinClauseData *MergeJoinClause;typedef struct MergeJoinState{ JoinState js; /* its first field is NodeTag */ int mj_NumClauses; MergeJoinClause mj_Clauses; /* array of length mj_NumClauses */ int mj_JoinState; bool mj_FillOuter; bool mj_FillInner; bool mj_MatchedOuter; bool mj_MatchedInner; TupleTableSlot *mj_OuterTupleSlot; TupleTableSlot *mj_InnerTupleSlot; TupleTableSlot *mj_MarkedTupleSlot; TupleTableSlot *mj_NullOuterTupleSlot; TupleTableSlot *mj_NullInnerTupleSlot; ExprContext *mj_OuterEContext; ExprContext *mj_InnerEContext;} MergeJoinState;/* ---------------- * HashJoinState information * * hj_HashTable hash table for the hashjoin * (NULL if table not built yet) * hj_CurHashValue hash value for current outer tuple * hj_CurBucketNo bucket# for current outer tuple * hj_CurTuple last inner tuple matched to current outer * tuple, or NULL if starting search * (CurHashValue, CurBucketNo and CurTuple are * undefined if OuterTupleSlot is empty!) * 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_FirstOuterTupleSlot first tuple retrieved from outer plan * hj_NeedNewOuter true if need new outer tuple on next call * hj_MatchedOuter true if found a join match for current outer * hj_OuterNotEmpty true if outer relation known not empty * ---------------- *//* these structs are defined in executor/hashjoin.h: */typedef struct HashJoinTupleData *HashJoinTuple;typedef struct HashJoinTableData *HashJoinTable;typedef struct HashJoinState{ JoinState js; /* its first field is NodeTag */ List *hashclauses; /* list of ExprState nodes */ HashJoinTable hj_HashTable; uint32 hj_CurHashValue; 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; TupleTableSlot *hj_FirstOuterTupleSlot; bool hj_NeedNewOuter; bool hj_MatchedOuter; bool hj_OuterNotEmpty;} 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 */ 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 its result slot). * 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 */ 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -