In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
< aggstate->Numtrans; transno++) {/ / conversion function AggStatePerTrans pertrans = & aggstate- > pertrans [transno]; / / pergroup AggStatePerGroup pergroupstate; pergroupstate = & pergroup [Transno] If (pertrans- > numSortCols > 0) {/ /-there is DISTINCT/ORDER BY / / verification, and Hash does not need to sort Assert (aggstate- > aggstrategy! = AGG_HASHED & & aggstate- > aggstrategy! = AGG_MIXED) If (pertrans- > numInputs = = 1) / / separate process_ordered_aggregate_single (aggstate, pertrans, pergroupstate) Else / / multiple process_ordered_aggregate_multi (aggstate, pertrans, pergroupstate);}} / * * Run the final functions. * execute the function that gets the final value * / / traverses the aggregate for (aggno = 0; aggno)
< aggstate->Numaggs; aggno++) {/ / get peragg AggStatePerAgg peragg = & peraggs [aggno]; int transno = peragg- > transno; AggStatePerGroup pergroupstate; / / pergroup pergroupstate = & pergroup [transno] If (DO_AGGSPLIT_SKIPFINAL (aggstate- > aggsplit)) / / parallel processing result finalize_partialaggregate (aggstate, peragg, pergroupstate, & aggvalues [aggno], & aggnulls [aggno]) Else / / call finalize_aggregate to get the result finalize_aggregate (aggstate, peragg, pergroupstate, & aggvalues [aggno], & aggnulls [aggno]);}}
Project_aggregates
The project_aggregates function projects the results of a set (which have been calculated by the finalize_aggregates function).
/ * * Project the result of a group (whose aggs have already been calculated by * finalize_aggregates) Returns the result slot, or NULL if no row is * projected (suppressed by qual). * project a set of results (which have been calculated by the finalize_aggregates function). * returns the result slot, and returns NULL if there is no result row projection (processed by qual). * / static TupleTableSlot * project_aggregates (AggState * aggstate) {ExprContext * econtext = aggstate- > ss.ps.ps_ExprContext; / * * Check the qual (HAVING clause); if the group does not match, ignore it. * check conditional expressions (HAVING clause). If it does not match with group, ignore it. * / if (ExecQual (aggstate- > ss.ps.qual, econtext)) {/ * Form and return projection tuple using the aggregate results and * the representative input tuple. * use the aggregate result and the corresponding input tuple to form and return the projection tuple. * / return ExecProject (aggstate- > ss.ps.ps_ProjInfo);} else InstrCountFiltered1 (aggstate, 1); return NULL;} # define InstrCountFiltered1 (node, delta)\ do {\ if (PlanState *) (node))-> instrument)\ ((PlanState *) (node))-> instrument- > nfiltered1 + = (delta);\} while (0)
ExecProject
The ExecProject function projects tuples based on projection information and stores them in the slot parameter passed to ExecBuildProjectInfo ().
/ * ExecProject * * Projects a tuple based on projection info and stores it in the slot passed * to ExecBuildProjectInfo (). * projects tuples based on projection information and stores them in the slot parameter passed to ExecBuildProjectInfo (). * * Note: the result is always a virtual tuple; therefore it may reference * the contents of the exprContext's scan tuples and/or temporary results * constructed in the exprContext. If the caller wishes the result to be * valid longer than that data will be valid, he must call ExecMaterializeSlot * on the result slot. * Note: the result is usually a virtual tuple. Therefore, the tuple may rely on the contents of the exprContext scan tuple and / or temporary results built in exprContext. * if the caller wants the result to last longer than the data, the caller must call ExecMaterializeSlot (materialization) on the result slot. * / # ifndef FRONTENDstatic inline TupleTableSlot * ExecProject (ProjectionInfo * projInfo) {ExprContext * econtext = projInfo- > pi_exprContext; ExprState * state = & projInfo- > pi_state; TupleTableSlot * slot = state- > resultslot; bool isnull; / * * Clear any former contents of the result slot. This makes it safe for * us to use the slot's Datum/isnull arrays as workspace. * clear the form and content of the result slot. * this ensures that slot's Datum/isnull array is OK. * / ExecClearTuple (slot); / * Run the expression, discarding scalar result from the last column. * / / perform expression parsing and discard the scalar result. (void) ExecEvalExprSwitchContext (state, econtext, & isnull); / * Successfully formed a result row. Mark the result slot as containing a * valid virtual tuple (inlined version of ExecStoreVirtualTuple ()). * successfully form a result row. * the tag result slot contains valid virtual tuples (inline version of ExecStoreVirtualTuple) * / slot- > tts_isempty = false; slot- > tts_nvalid = slot- > tts_tupleDescriptor- > natts; return slot;} # endif 3. Tracking and analysis
N/A
IV. Reference materials
PostgreSQL Source Code interpretation (178)-query # 95 (aggregate function) # 1 related data structures
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.