|
PostgreSQL Source Code git master
|
#include "postgres.h"#include "access/htup_details.h"#include "access/parallel.h"#include "catalog/objectaccess.h"#include "catalog/pg_aggregate.h"#include "catalog/pg_proc.h"#include "catalog/pg_type.h"#include "common/hashfn.h"#include "executor/execExpr.h"#include "executor/executor.h"#include "executor/nodeAgg.h"#include "lib/hyperloglog.h"#include "miscadmin.h"#include "nodes/nodeFuncs.h"#include "optimizer/optimizer.h"#include "parser/parse_agg.h"#include "parser/parse_coerce.h"#include "utils/acl.h"#include "utils/builtins.h"#include "utils/datum.h"#include "utils/expandeddatum.h"#include "utils/injection_point.h"#include "utils/logtape.h"#include "utils/lsyscache.h"#include "utils/memutils.h"#include "utils/memutils_memorychunk.h"#include "utils/syscache.h"#include "utils/tuplesort.h"
Go to the source code of this file.
Data Structures | |
| struct | HashAggSpill |
| struct | HashAggBatch |
| struct | FindColsContext |
Typedefs | |
| typedef struct HashAggSpill | HashAggSpill |
| typedef struct HashAggBatch | HashAggBatch |
| typedef struct FindColsContext | FindColsContext |
| #define CHUNKHDRSZ sizeof(MemoryChunk) |
Definition at line 817 of file nodeAgg.c.
References ExecEvalExprNoReturnSwitchContext(), and fb().
Referenced by agg_fill_hash_table(), agg_refill_hash_table(), and agg_retrieve_direct().
|
static |
Definition at line 707 of file nodeAgg.c.
References FunctionCallInfoBaseData::args, datumCopy(), DatumGetPointer(), ExecAggCopyTransValue(), fb(), FmgrInfo::fn_strict, FunctionCallInvoke, i, FunctionCallInfoBaseData::isnull, NullableDatum::isnull, MemoryContextSwitchTo(), AggStatePerTransData::numTransInputs, AggStatePerTransData::transfn, AggStatePerTransData::transfn_fcinfo, AggStatePerTransData::transtypeByVal, AggStatePerTransData::transtypeLen, and NullableDatum::value.
Referenced by process_ordered_aggregate_multi(), and process_ordered_aggregate_single().
Definition at line 2627 of file nodeAgg.c.
References advance_aggregates(), ExprContext::ecxt_outertuple, fb(), fetch_input_tuple(), hashagg_finish_initial_spills(), lookup_hash_entries(), ResetExprContext, ResetTupleHashIterator, select_current_set(), and TupIsNull.
Referenced by ExecAgg().
Definition at line 2681 of file nodeAgg.c.
References advance_aggregates(), AGG_MIXED, Assert, CHECK_FOR_INTERRUPTS, ExecStoreMinimalTuple(), fb(), hash(), hash_agg_set_limits(), hash_agg_update_metrics(), hashagg_batch_read(), hashagg_recompile_expressions(), hashagg_spill_finish(), hashagg_spill_init(), hashagg_spill_tuple(), AggStatePerHashData::hashslot, AggStatePerHashData::hashtable, initialize_hash_entry(), INJECTION_POINT, list_delete_last(), llast, LogicalTapeClose(), LookupTupleHashEntryHash(), MemSet, NIL, pfree(), prepare_hash_slot(), ReScanExprContext(), ResetExprContext, ResetTupleHashIterator, ResetTupleHashTable(), select_current_set(), and TupleHashEntryGetAdditional().
Referenced by agg_retrieve_hash_table().
|
static |
Definition at line 2281 of file nodeAgg.c.
References advance_aggregates(), AGG_MIXED, AGG_PLAIN, agg_retrieve_hash_table(), Agg::aggstrategy, Assert, ExprContext::ecxt_innertuple, ExprContext::ecxt_outertuple, ExecCopySlotHeapTuple(), ExecForceStoreHeapTuple(), ExecQual(), ExecQualAndReset(), fb(), fetch_input_tuple(), finalize_aggregates(), hashagg_finish_initial_spills(), i, initialize_aggregates(), initialize_phase(), lookup_hash_entries(), Max, Agg::numCols, prepare_projection_slot(), project_aggregates(), ReScanExprContext(), ResetExprContext, ResetTupleHashIterator, select_current_set(), and TupIsNull.
Referenced by ExecAgg().
|
static |
Definition at line 2835 of file nodeAgg.c.
References agg_refill_hash_table(), agg_retrieve_hash_table_in_memory(), and fb().
Referenced by agg_retrieve_direct(), and ExecAgg().
|
static |
Definition at line 2860 of file nodeAgg.c.
References CHECK_FOR_INTERRUPTS, ExprContext::ecxt_outertuple, ExecClearTuple(), ExecStoreMinimalTuple(), ExecStoreVirtualTuple(), fb(), finalize_aggregates(), AggStatePerHashData::hashGrpColIdxInput, AggStatePerHashData::hashiter, AggStatePerHashData::hashslot, AggStatePerHashData::hashtable, i, AggStatePerHashData::numhashGrpCols, prepare_projection_slot(), project_aggregates(), ResetExprContext, ResetTupleHashIterator, ScanTupleHashTable, select_current_set(), slot_getallattrs(), TupleTableSlot::tts_isnull, TupleTableSlot::tts_values, TupleHashEntryGetAdditional(), and TupleHashEntryGetTuple().
Referenced by agg_retrieve_hash_table().
| int AggCheckCallContext | ( | FunctionCallInfo | fcinfo, |
| MemoryContext * | aggcontext | ||
| ) |
Definition at line 4607 of file nodeAgg.c.
References AGG_CONTEXT_AGGREGATE, AGG_CONTEXT_WINDOW, FunctionCallInfoBaseData::context, ExprContext::ecxt_per_tuple_memory, fb(), and IsA.
Referenced by array_agg_array_combine(), array_agg_array_deserialize(), array_agg_array_finalfn(), array_agg_array_serialize(), array_agg_array_transfn(), array_agg_combine(), array_agg_deserialize(), array_agg_finalfn(), array_agg_serialize(), array_agg_transfn(), bytea_string_agg_finalfn(), bytea_string_agg_transfn(), fetch_array_arg_replace_nulls(), float4_accum(), float8_accum(), float8_combine(), float8_regr_accum(), float8_regr_combine(), hypothetical_dense_rank_final(), hypothetical_rank_common(), int2_avg_accum(), int2_avg_accum_inv(), int4_avg_accum(), int4_avg_accum_inv(), int4_avg_combine(), int8_avg_combine(), int8_avg_deserialize(), int8_avg_serialize(), interval_avg_deserialize(), interval_avg_serialize(), json_agg_finalfn(), json_agg_transfn_worker(), json_object_agg_finalfn(), json_object_agg_transfn_worker(), jsonb_agg_finalfn(), jsonb_agg_transfn_worker(), jsonb_object_agg_finalfn(), jsonb_object_agg_transfn_worker(), makeBoolAggState(), makeInt128AggState(), makeIntervalAggState(), makeNumericAggState(), makeStringAggState(), mode_final(), multirange_agg_transfn(), multirange_intersect_agg_transfn(), numeric_avg_combine(), numeric_avg_deserialize(), numeric_avg_serialize(), numeric_combine(), numeric_deserialize(), numeric_poly_combine(), numeric_poly_deserialize(), numeric_poly_serialize(), numeric_serialize(), ordered_set_startup(), percentile_cont_final_common(), percentile_cont_multi_final_common(), percentile_disc_final(), percentile_disc_multi_final(), range_agg_finalfn(), range_agg_transfn(), range_intersect_agg_transfn(), string_agg_combine(), string_agg_deserialize(), string_agg_finalfn(), and string_agg_serialize().
| Aggref * AggGetAggref | ( | FunctionCallInfo | fcinfo | ) |
Definition at line 4651 of file nodeAgg.c.
References AggStatePerTransData::aggref, AggStatePerAggData::aggref, FunctionCallInfoBaseData::context, fb(), and IsA.
Referenced by ordered_set_startup().
| MemoryContext AggGetTempMemoryContext | ( | FunctionCallInfo | fcinfo | ) |
Definition at line 4685 of file nodeAgg.c.
References FunctionCallInfoBaseData::context, fb(), and IsA.
| void AggRegisterCallback | ( | FunctionCallInfo | fcinfo, |
| ExprContextCallbackFunction | func, | ||
| Datum | arg | ||
| ) |
Definition at line 4750 of file nodeAgg.c.
References arg, FunctionCallInfoBaseData::context, elog, ERROR, fb(), IsA, and RegisterExprContextCallback().
Referenced by ordered_set_startup().
| bool AggStateIsShared | ( | FunctionCallInfo | fcinfo | ) |
Definition at line 4711 of file nodeAgg.c.
References AggStatePerTransData::aggshared, FunctionCallInfoBaseData::context, fb(), IsA, and AggStatePerAggData::transno.
Referenced by ordered_set_startup().
Definition at line 1506 of file nodeAgg.c.
References AGG_HASHED, AGG_MIXED, AggStatePerHashData::aggnode, Assert, BuildTupleHashTable(), DO_AGGSPLIT_SKIPFINAL, AggStatePerHashData::eqfuncoids, fb(), AggStatePerHashData::hashfunctions, AggStatePerHashData::hashGrpColIdxHash, AggStatePerHashData::hashslot, AggStatePerHashData::hashtable, AggStatePerHashData::numCols, TupleTableSlot::tts_ops, and TupleTableSlot::tts_tupleDescriptor.
Referenced by build_hash_tables().
Definition at line 1465 of file nodeAgg.c.
References AggStatePerHashData::aggnode, build_hash_table(), fb(), hash_choose_num_buckets(), AggStatePerHashData::hashtable, INJECTION_POINT_CACHED, IS_INJECTION_POINT_ATTACHED, Agg::numGroups, ResetTupleHashTable(), and TupleHashEntrySize().
Referenced by ExecInitAgg(), and ExecReScanAgg().
|
static |
Definition at line 4129 of file nodeAgg.c.
References AGG_HASHED, AGG_MIXED, AggStatePerTransData::aggCollation, Aggref::aggdirectargs, Aggref::aggdistinct, Aggref::aggfilter, Aggref::aggorder, AggStatePerTransData::aggref, AggStatePerTransData::aggshared, AggStatePerTransData::aggsortrequired, AggStatePerTransData::aggtranstype, Aggref::args, Assert, build_aggregate_deserialfn_expr(), build_aggregate_serialfn_expr(), build_aggregate_transfn_expr(), AggStatePerTransData::deserialfn, AggStatePerTransData::deserialfn_fcinfo, AggStatePerTransData::deserialfn_oid, DO_AGGSPLIT_COMBINE, AggStatePerTransData::equalfnMulti, AggStatePerTransData::equalfnOne, ExecInitExtraTupleSlot(), execTuplesMatchPrepare(), ExecTypeFromTL(), exprCollation(), fb(), fmgr_info(), fmgr_info_set_expr, get_opcode(), get_sortgroupclause_tle(), get_typlenbyval(), i, InitFunctionCallInfoData, AggStatePerTransData::initValue, initValue(), AggStatePerTransData::initValueIsNull, AggStatePerTransData::inputtypeByVal, AggStatePerTransData::inputtypeLen, InvalidOid, lfirst, list_length(), Max, NIL, AggStatePerTransData::numDistinctCols, AggStatePerTransData::numInputs, AggStatePerTransData::numSortCols, AggStatePerTransData::numTransInputs, OidIsValid, palloc(), palloc0_array, pfree(), AggStatePerTransData::serialfn, AggStatePerTransData::serialfn_fcinfo, AggStatePerTransData::serialfn_oid, SizeForFunctionCallInfo, AggStatePerTransData::sortColIdx, AggStatePerTransData::sortCollations, AggStatePerTransData::sortdesc, AggStatePerTransData::sortNullsFirst, AggStatePerTransData::sortOperators, AggStatePerTransData::sortslot, AggStatePerTransData::sortstates, AggStatePerTransData::transfn, AggStatePerTransData::transfn_fcinfo, AggStatePerTransData::transfn_oid, AggStatePerTransData::transtypeByVal, AggStatePerTransData::transtypeLen, TTSOpsMinimalTuple, and AggStatePerTransData::uniqslot.
Referenced by ExecInitAgg().
|
static |
Definition at line 2245 of file nodeAgg.c.
References AggState::agg_done, agg_fill_hash_table(), AGG_HASHED, AGG_MIXED, AGG_PLAIN, agg_retrieve_direct(), agg_retrieve_hash_table(), AGG_SORTED, AggStatePerPhaseData::aggstrategy, castNode, CHECK_FOR_INTERRUPTS, fb(), AggState::phase, AggState::table_filled, and TupIsNull.
Referenced by ExecInitAgg().
| void ExecAggEstimate | ( | AggState * | node, |
| ParallelContext * | pcxt | ||
| ) |
Definition at line 4779 of file nodeAgg.c.
References add_size(), ParallelContext::estimator, fb(), PlanState::instrument, mul_size(), ParallelContext::nworkers, ScanState::ps, shm_toc_estimate_chunk, shm_toc_estimate_keys, and AggState::ss.
Referenced by ExecParallelEstimate().
| void ExecAggInitializeDSM | ( | AggState * | node, |
| ParallelContext * | pcxt | ||
| ) |
Definition at line 4800 of file nodeAgg.c.
References fb(), PlanState::instrument, SharedAggInfo::num_workers, ParallelContext::nworkers, PlanState::plan, Plan::plan_node_id, ScanState::ps, AggState::shared_info, shm_toc_allocate(), shm_toc_insert(), AggState::ss, and ParallelContext::toc.
Referenced by ExecParallelInitializeDSM().
| void ExecAggInitializeWorker | ( | AggState * | node, |
| ParallelWorkerContext * | pwcxt | ||
| ) |
Definition at line 4825 of file nodeAgg.c.
References fb(), PlanState::plan, Plan::plan_node_id, ScanState::ps, AggState::shared_info, shm_toc_lookup(), and AggState::ss.
Referenced by ExecParallelInitializeWorker().
Definition at line 4838 of file nodeAgg.c.
References fb(), SharedAggInfo::num_workers, palloc(), and AggState::shared_info.
Referenced by ExecParallelRetrieveInstrumentation().
Definition at line 4394 of file nodeAgg.c.
References AggState::aggcontexts, Assert, ExecEndNode(), fb(), AggregateInstrumentation::hash_batches_used, AggState::hash_batches_used, AggState::hash_disk_used, AggState::hash_mem_peak, AggState::hash_metacxt, AggState::hash_tuplescxt, hashagg_reset_spill_state(), AggState::hashcontext, IsParallelWorker, Max, AggState::maxsets, MemoryContextDelete(), AggState::numtrans, outerPlan, outerPlanState, ParallelWorkerNumber, AggState::pertrans, ReScanExprContext(), AggState::shared_info, SharedAggInfo::sinstrument, AggState::sort_in, AggState::sort_out, AggStatePerTransData::sortstates, and tuplesort_end().
Referenced by ExecEndNode().
Definition at line 3279 of file nodeAgg.c.
References ACL_EXECUTE, aclcheck_error(), ACLCHECK_OK, AGG_HASHED, AGG_MIXED, AGG_PLAIN, AGG_SORTED, AggStatePerAggData::aggdirectargs, Aggref::aggdirectargs, Aggref::aggfnoid, AggStatePerPhaseData::aggnode, AggStatePerHashData::aggnode, AggStatePerTransData::aggref, AggStatePerAggData::aggref, AggStatePerTransData::aggshared, Agg::aggsplit, AggStatePerPhaseData::aggstrategy, Agg::aggstrategy, Aggref::args, Assert, bms_add_member(), bms_add_members(), bms_next_member(), build_aggregate_finalfn_expr(), build_hash_tables(), build_pertrans_for_aggref(), castNode, Agg::chain, DO_AGGSPLIT_COMBINE, DO_AGGSPLIT_DESERIALIZE, DO_AGGSPLIT_SERIALIZE, DO_AGGSPLIT_SKIPFINAL, ExprContext::ecxt_aggnulls, ExprContext::ecxt_aggvalues, elog, ereport, errcode(), errmsg(), ERROR, AggStatePerPhaseData::evaltrans, AggStatePerPhaseData::evaltrans_cache, EXEC_FLAG_BACKWARD, EXEC_FLAG_EXPLAIN_ONLY, EXEC_FLAG_MARK, ExecAgg(), ExecAssignExprContext(), ExecAssignProjectionInfo(), ExecBuildAggTrans(), ExecCreateScanSlotFromOuterPlan(), ExecGetResultSlotOps(), ExecInitExprList(), ExecInitExtraTupleSlot(), ExecInitNode(), ExecInitQual(), ExecInitResultTupleSlotTL(), execTuplesMatchPrepare(), fb(), AggStatePerAggData::finalfn, AggStatePerAggData::finalfn_oid, find_hash_columns(), fmgr_info(), fmgr_info_set_expr, FmgrInfo::fn_strict, format_type_be(), FUNC_MAX_ARGS, get_aggregate_argtypes(), get_func_name(), get_typlenbyval(), GetAggInitVal(), GETSTRUCT(), GetUserId(), Agg::groupingSets, hash_agg_entry_size(), hash_agg_set_limits(), hash_create_memory(), HeapTupleIsValid, i, initialize_phase(), initValue(), AggStatePerTransData::initValueIsNull, InvalidOid, InvokeFunctionExecuteHook, IsBinaryCoercible(), j, lcons_int(), lfirst, list_length(), list_nth_node, makeNode, Max, NIL, AggStatePerHashData::numCols, Agg::numCols, AggStatePerAggData::numFinalArgs, AggStatePerPhaseData::numsets, AggStatePerTransData::numTransInputs, object_aclcheck(), OBJECT_AGGREGATE, OBJECT_FUNCTION, ObjectIdGetDatum(), OidIsValid, outerPlan, outerPlanState, palloc(), palloc0_array, palloc_array, Agg::plan, Plan::qual, ReleaseSysCache(), AggStatePerAggData::resulttypeByVal, AggStatePerAggData::resulttypeLen, SearchSysCache1(), select_current_set(), SysCacheGetAttr(), AggStatePerTransData::transfn, Agg::transitionSpace, AggStatePerAggData::transno, TTSOpsMinimalTuple, and TTSOpsVirtual.
Referenced by ExecInitNode().
Definition at line 4460 of file nodeAgg.c.
References AggState::agg_done, AGG_HASHED, AGG_MIXED, AggState::aggcontexts, Agg::aggParams, AggState::aggstrategy, bms_overlap(), build_hash_tables(), PlanState::chgParam, ExprContext::ecxt_aggnulls, ExprContext::ecxt_aggvalues, ExecClearTuple(), ExecReScan(), fb(), AggState::grp_firstTuple, AggState::hash_ever_spilled, AggState::hash_ngroups_current, AggState::hash_spill_mode, hashagg_recompile_expressions(), hashagg_reset_spill_state(), AggState::hashcontext, AggStatePerHashData::hashiter, AggStatePerHashData::hashtable, heap_freetuple(), initialize_phase(), AggState::input_done, Max, AggState::maxsets, MemSet, AggState::numaggs, AggState::numtrans, outerPlan, outerPlanState, AggState::pergroups, AggState::perhash, AggState::pertrans, PlanState::plan, AggState::projected_set, ScanState::ps, PlanState::ps_ExprContext, ReScanExprContext(), ResetTupleHashIterator, select_current_set(), AggStatePerTransData::sortstates, AggState::ss, ScanState::ss_ScanTupleSlot, AggState::table_filled, and tuplesort_end().
Referenced by ExecReScan().
|
static |
Definition at line 548 of file nodeAgg.c.
References CHECK_FOR_INTERRUPTS, ExecProcNode(), fb(), outerPlanState, TupIsNull, tuplesort_gettupleslot(), and tuplesort_puttupleslot().
Referenced by agg_fill_hash_table(), and agg_retrieve_direct().
|
static |
Definition at line 1044 of file nodeAgg.c.
References AggStatePerTransData::aggCollation, AggStatePerAggData::aggdirectargs, ExecEvalExpr(), fb(), AggStatePerAggData::finalfn, AggStatePerAggData::finalfn_oid, FUNC_MAX_ARGS, FunctionCallInvoke, i, InitFunctionCallInfoData, lfirst, LOCAL_FCINFO, MakeExpandedObjectReadOnly, MemoryContextSwitchTo(), AggStatePerAggData::numFinalArgs, OidIsValid, AggStatePerAggData::resulttypeLen, AggStatePerAggData::transno, and AggStatePerTransData::transtypeLen.
Referenced by finalize_aggregates().
|
static |
Definition at line 1292 of file nodeAgg.c.
References AGG_HASHED, AGG_MIXED, AggStatePerTransData::aggsortrequired, Assert, DatumGetPointer(), DO_AGGSPLIT_SKIPFINAL, ExprContext::ecxt_aggnulls, ExprContext::ecxt_aggvalues, ExecClearTuple(), fb(), finalize_aggregate(), finalize_partialaggregate(), AggStatePerTransData::haslast, AggStatePerTransData::inputtypeByVal, AggStatePerTransData::lastdatum, AggStatePerTransData::lastisnull, AggStatePerTransData::numDistinctCols, AggStatePerTransData::numInputs, pfree(), process_ordered_aggregate_multi(), process_ordered_aggregate_single(), AggStatePerAggData::transno, and AggStatePerTransData::uniqslot.
Referenced by agg_retrieve_direct(), and agg_retrieve_hash_table_in_memory().
|
static |
Definition at line 1144 of file nodeAgg.c.
References FunctionCallInfoBaseData::args, fb(), FmgrInfo::fn_strict, FunctionCallInvoke, FunctionCallInfoBaseData::isnull, NullableDatum::isnull, MakeExpandedObjectReadOnly, MemoryContextSwitchTo(), OidIsValid, AggStatePerAggData::resulttypeLen, AggStatePerTransData::serialfn, AggStatePerTransData::serialfn_fcinfo, AggStatePerTransData::serialfn_oid, AggStatePerAggData::transno, AggStatePerTransData::transtypeLen, and NullableDatum::value.
Referenced by finalize_aggregates().
|
static |
Definition at line 1395 of file nodeAgg.c.
References FindColsContext::aggregated, bms_add_member(), fb(), find_cols_walker(), i, FindColsContext::is_aggref, Agg::plan, and FindColsContext::unaggregated.
Referenced by find_hash_columns().
|
static |
Definition at line 1418 of file nodeAgg.c.
References FindColsContext::aggregated, Assert, bms_add_member(), expression_tree_walker, fb(), find_cols_walker(), FindColsContext::is_aggref, IsA, OUTER_VAR, FindColsContext::unaggregated, Var::varattno, Var::varlevelsup, and Var::varno.
Referenced by find_cols(), and find_cols_walker().
Definition at line 1567 of file nodeAgg.c.
References AggStatePerHashData::aggnode, attnum, bms_add_member(), bms_copy(), bms_del_member(), bms_free(), bms_is_member(), bms_next_member(), bms_num_members(), bms_union(), AggStatePerHashData::eqfuncoids, EState::es_tupleTable, ExecAllocTableSlot(), execTuplesHashPrepare(), ExecTypeFromTL(), fb(), find_cols(), AggStatePerHashData::hashfunctions, AggStatePerHashData::hashGrpColIdxHash, AggStatePerHashData::hashGrpColIdxInput, AggStatePerHashData::hashslot, i, j, lappend(), AggStatePerHashData::largestGrpColIdx, lfirst_int, list_free(), list_nth(), Max, NIL, AggStatePerHashData::numCols, AggStatePerHashData::numhashGrpCols, outerPlanState, palloc(), and TTSOpsMinimalTuple.
Referenced by ExecInitAgg().
Definition at line 4378 of file nodeAgg.c.
References fb(), getTypeInputInfo(), OidInputFunctionCall(), pfree(), and TextDatumGetCString.
Referenced by ExecInitAgg().
Definition at line 1864 of file nodeAgg.c.
References fb(), hash_agg_enter_spill_mode(), INJECTION_POINT_CACHED, IS_INJECTION_POINT_ATTACHED, and MemoryContextMemAllocated().
Referenced by initialize_hash_entry().
Definition at line 1908 of file nodeAgg.c.
References AggStatePerHashData::aggnode, Assert, fb(), hashagg_recompile_expressions(), hashagg_spill_init(), INJECTION_POINT, LogicalTapeSetCreate(), Agg::numGroups, and palloc_array.
Referenced by hash_agg_check_limits().
Definition at line 1698 of file nodeAgg.c.
References CHUNKHDRSZ, fb(), MAXALIGN, pg_nextpower2_size_t, SizeofMinimalTupleHeader, and TupleHashEntrySize().
Referenced by cost_agg(), estimate_hashagg_tablesize(), and ExecInitAgg().
| void hash_agg_set_limits | ( | double | hashentrysize, |
| double | input_groups, | ||
| int | used_bits, | ||
| Size * | mem_limit, | ||
| uint64 * | ngroups_limit, | ||
| int * | num_partitions | ||
| ) |
Definition at line 1806 of file nodeAgg.c.
References fb(), get_hash_memory_limit(), hash_choose_num_partitions(), HASHAGG_READ_BUFFER_SIZE, and HASHAGG_WRITE_BUFFER_SIZE.
Referenced by agg_refill_hash_table(), cost_agg(), and ExecInitAgg().
Definition at line 1944 of file nodeAgg.c.
References AGG_HASHED, AGG_MIXED, fb(), HASHAGG_READ_BUFFER_SIZE, HASHAGG_WRITE_BUFFER_SIZE, LogicalTapeSetBlocks(), MemoryContextMemAllocated(), and TupleHashEntrySize().
Referenced by agg_refill_hash_table(), and hashagg_finish_initial_spills().
Definition at line 2055 of file nodeAgg.c.
References fb().
Referenced by build_hash_tables().
|
static |
Definition at line 2084 of file nodeAgg.c.
References fb(), get_hash_memory_limit(), HASHAGG_MAX_PARTITIONS, HASHAGG_MIN_PARTITIONS, HASHAGG_PARTITION_FACTOR, HASHAGG_READ_BUFFER_SIZE, HASHAGG_WRITE_BUFFER_SIZE, and pg_ceil_log2_32().
Referenced by hash_agg_set_limits(), and hashagg_spill_init().
Definition at line 1997 of file nodeAgg.c.
References ALLOCSET_DEFAULT_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE, ALLOCSET_DEFAULT_MINSIZE, ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, BumpContextCreate(), CreateWorkExprContext(), fb(), Max, Min, pg_prevpower2_size_t, and work_mem.
Referenced by ExecInitAgg().
|
static |
Definition at line 3097 of file nodeAgg.c.
References fb(), and palloc0_object.
Referenced by hashagg_spill_finish().
|
static |
Definition at line 3116 of file nodeAgg.c.
References ereport, errcode_for_file_access(), errmsg_internal(), ERROR, fb(), hash(), LogicalTapeRead(), palloc(), and MinimalTupleData::t_len.
Referenced by agg_refill_hash_table().
Definition at line 3165 of file nodeAgg.c.
References fb(), hash_agg_update_metrics(), hashagg_spill_finish(), HashAggSpill::npartitions, and pfree().
Referenced by agg_fill_hash_table(), and agg_retrieve_direct().
|
static |
Definition at line 1749 of file nodeAgg.c.
References AGG_HASHED, AGG_MIXED, Assert, AggStatePerPhaseData::evaltrans, AggStatePerPhaseData::evaltrans_cache, ExecBuildAggTrans(), fb(), i, j, and TTSOpsMinimalTuple.
Referenced by agg_refill_hash_table(), ExecReScanAgg(), and hash_agg_enter_spill_mode().
Definition at line 3239 of file nodeAgg.c.
References fb(), list_free_deep(), LogicalTapeSetClose(), NIL, and pfree().
Referenced by ExecEndAgg(), and ExecReScanAgg().
|
static |
Definition at line 3199 of file nodeAgg.c.
References estimateHyperLogLog(), fb(), freeHyperLogLog(), hashagg_batch_new(), HASHAGG_READ_BUFFER_SIZE, i, lappend(), LogicalTapeRewindForRead(), and pfree().
Referenced by agg_refill_hash_table(), and hashagg_finish_initial_spills().
|
static |
Definition at line 2984 of file nodeAgg.c.
References fb(), hash_choose_num_partitions(), HASHAGG_HLL_BIT_WIDTH, i, initHyperLogLog(), INJECTION_POINT_CACHED, IS_INJECTION_POINT_ATTACHED, LogicalTapeCreate(), and palloc0_array.
Referenced by agg_refill_hash_table(), hash_agg_enter_spill_mode(), and lookup_hash_entries().
|
static |
Definition at line 3027 of file nodeAgg.c.
References addHyperLogLog(), Assert, bms_is_member(), ExecClearTuple(), ExecFetchSlotMinimalTuple(), ExecStoreVirtualTuple(), fb(), hash(), hash_bytes_uint32(), i, LogicalTapeWrite(), pfree(), slot_getsomeattrs(), MinimalTupleData::t_len, TupleTableSlot::tts_isnull, and TupleTableSlot::tts_values.
Referenced by agg_refill_hash_table(), and lookup_hash_entries().
|
static |
Definition at line 579 of file nodeAgg.c.
References AggStatePerTransData::aggsortrequired, datumCopy(), fb(), AggStatePerTransData::initValue, AggStatePerTransData::initValueIsNull, MemoryContextSwitchTo(), AggStatePerTransData::numInputs, AggStatePerTransData::numSortCols, AggStatePerTransData::sortColIdx, AggStatePerTransData::sortCollations, AggStatePerTransData::sortdesc, AggStatePerTransData::sortNullsFirst, AggStatePerTransData::sortOperators, AggStatePerTransData::sortstates, AggStatePerTransData::transtypeByVal, AggStatePerTransData::transtypeLen, TupleDescAttr(), tuplesort_begin_datum(), tuplesort_begin_heap(), tuplesort_end(), TUPLESORT_NONE, and work_mem.
Referenced by initialize_aggregates(), and initialize_hash_entry().
|
static |
Definition at line 666 of file nodeAgg.c.
References fb(), initialize_aggregate(), Max, and select_current_set().
Referenced by agg_retrieve_direct().
|
static |
Definition at line 2138 of file nodeAgg.c.
References fb(), hash_agg_check_limits(), initialize_aggregate(), and TupleHashEntryGetAdditional().
Referenced by agg_refill_hash_table(), and lookup_hash_entries().
Definition at line 478 of file nodeAgg.c.
References Assert, ExecGetResultType(), fb(), Sort::numCols, outerPlanState, tuplesort_begin_heap(), tuplesort_end(), TUPLESORT_NONE, tuplesort_performsort(), and work_mem.
Referenced by agg_retrieve_direct(), ExecInitAgg(), and ExecReScanAgg().
Definition at line 2182 of file nodeAgg.c.
References AggStatePerHashData::aggnode, fb(), hash(), hashagg_spill_init(), hashagg_spill_tuple(), AggStatePerHashData::hashslot, AggStatePerHashData::hashtable, initialize_hash_entry(), LookupTupleHashEntry(), Agg::numGroups, prepare_hash_slot(), select_current_set(), and TupleHashEntryGetAdditional().
Referenced by agg_fill_hash_table(), and agg_retrieve_direct().
|
inlinestatic |
Definition at line 1202 of file nodeAgg.c.
References ExecClearTuple(), ExecStoreVirtualTuple(), fb(), AggStatePerHashData::hashGrpColIdxInput, i, AggStatePerHashData::largestGrpColIdx, AggStatePerHashData::numhashGrpCols, slot_getsomeattrs(), TupleTableSlot::tts_isnull, and TupleTableSlot::tts_values.
Referenced by agg_refill_hash_table(), and lookup_hash_entries().
|
static |
Definition at line 1247 of file nodeAgg.c.
References attnum, bms_is_member(), ExecStoreAllNullTuple(), fb(), lfirst_int, linitial_int, slot_getsomeattrs(), TTS_EMPTY, and TupleTableSlot::tts_isnull.
Referenced by agg_retrieve_direct(), and agg_retrieve_hash_table_in_memory().
|
static |
Definition at line 947 of file nodeAgg.c.
References advance_transition_function(), FunctionCallInfoBaseData::args, CHECK_FOR_INTERRUPTS, ExprContext::ecxt_innertuple, ExprContext::ecxt_outertuple, AggStatePerTransData::equalfnMulti, ExecClearTuple(), ExecQual(), fb(), i, NullableDatum::isnull, AggStatePerTransData::numDistinctCols, AggStatePerTransData::numTransInputs, ResetExprContext, slot_getsomeattrs(), AggStatePerTransData::sortslot, AggStatePerTransData::sortstates, AggStatePerTransData::transfn_fcinfo, tuplesort_end(), tuplesort_gettupleslot(), tuplesort_performsort(), AggStatePerTransData::uniqslot, and NullableDatum::value.
Referenced by finalize_aggregates().
|
static |
Definition at line 846 of file nodeAgg.c.
References advance_transition_function(), AggStatePerTransData::aggCollation, FunctionCallInfoBaseData::args, Assert, datumCopy(), DatumGetBool(), DatumGetPointer(), AggStatePerTransData::equalfnOne, fb(), FunctionCall2Coll(), AggStatePerTransData::inputtypeByVal, AggStatePerTransData::inputtypeLen, NullableDatum::isnull, MemoryContextReset(), MemoryContextSwitchTo(), AggStatePerTransData::numDistinctCols, pfree(), AggStatePerTransData::sortstates, AggStatePerTransData::transfn_fcinfo, tuplesort_end(), tuplesort_getdatum(), tuplesort_performsort(), and NullableDatum::value.
Referenced by finalize_aggregates().
|
static |
Definition at line 1369 of file nodeAgg.c.
References ExecProject(), ExecQual(), fb(), and InstrCountFiltered1.
Referenced by agg_retrieve_direct(), and agg_retrieve_hash_table_in_memory().
Definition at line 456 of file nodeAgg.c.
References fb().
Referenced by agg_fill_hash_table(), agg_refill_hash_table(), agg_retrieve_direct(), agg_retrieve_hash_table_in_memory(), ExecInitAgg(), ExecReScanAgg(), initialize_aggregates(), and lookup_hash_entries().