PostgreSQL Source Code git master
|
#include "postgres.h"
#include <math.h>
#include "catalog/pg_aggregate.h"
#include "catalog/pg_operator.h"
#include "catalog/pg_type.h"
#include "executor/executor.h"
#include "miscadmin.h"
#include "nodes/nodeFuncs.h"
#include "optimizer/optimizer.h"
#include "utils/array.h"
#include "utils/fmgrprotos.h"
#include "utils/lsyscache.h"
#include "utils/tuplesort.h"
Go to the source code of this file.
Data Structures | |
struct | OSAPerQueryState |
struct | OSAPerGroupState |
struct | pct_info |
Typedefs | |
typedef struct OSAPerQueryState | OSAPerQueryState |
typedef struct OSAPerGroupState | OSAPerGroupState |
typedef Datum(* | LerpFunc) (Datum lo, Datum hi, double pct) |
Definition at line 500 of file orderedsetaggs.c.
typedef struct OSAPerGroupState OSAPerGroupState |
typedef struct OSAPerQueryState OSAPerQueryState |
Definition at line 503 of file orderedsetaggs.c.
References DatumGetFloat8(), and Float8GetDatum().
Referenced by percentile_cont_float8_final(), and percentile_cont_float8_multi_final().
|
static |
Definition at line 1142 of file orderedsetaggs.c.
References elog, ERROR, FunctionCallInfoBaseData::flinfo, get_fn_expr_argtype(), i, TupleDescData::natts, and TupleDescAttr().
Referenced by hypothetical_dense_rank_final(), and hypothetical_rank_common().
Datum hypothetical_cume_dist_final | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1278 of file orderedsetaggs.c.
References hypothetical_rank_common(), and PG_RETURN_FLOAT8.
Datum hypothetical_dense_rank_final | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1295 of file orderedsetaggs.c.
References AGG_CONTEXT_AGGREGATE, AggCheckCallContext(), Assert(), CHECK_FOR_INTERRUPTS, OSAPerQueryState::compareTuple, CreateStandaloneExprContext(), DatumGetInt32(), OSAPerQueryState::econtext, ExprContext::ecxt_innertuple, ExprContext::ecxt_outertuple, elog, OSAPerQueryState::eqOperators, ERROR, ExecClearTuple(), ExecDropSingleTupleTableSlot(), ExecQualAndReset(), ExecStoreVirtualTuple(), execTuplesMatchPrepare(), hypothetical_check_argtypes(), i, Int32GetDatum(), MakeSingleTupleTableSlot(), MemoryContextSwitchTo(), OSAPerQueryState::numSortCols, PG_ARGISNULL, PG_GETARG_DATUM, PG_GETARG_POINTER, PG_NARGS, PG_RETURN_INT64, OSAPerQueryState::qcontext, OSAPerGroupState::qstate, slot_getattr(), OSAPerGroupState::sort_done, OSAPerQueryState::sortColIdx, OSAPerQueryState::sortCollations, OSAPerGroupState::sortstate, TupleTableSlot::tts_isnull, TupleTableSlot::tts_values, TTSOpsMinimalTuple, OSAPerQueryState::tupdesc, TupIsNull, tuplesort_gettupleslot(), tuplesort_performsort(), tuplesort_puttupleslot(), and OSAPerQueryState::tupslot.
Datum hypothetical_percent_rank_final | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1258 of file orderedsetaggs.c.
References hypothetical_rank_common(), and PG_RETURN_FLOAT8.
|
static |
Definition at line 1171 of file orderedsetaggs.c.
References AGG_CONTEXT_AGGREGATE, AggCheckCallContext(), Assert(), CHECK_FOR_INTERRUPTS, DatumGetInt32(), elog, ERROR, ExecClearTuple(), ExecStoreVirtualTuple(), flag(), hypothetical_check_argtypes(), i, Int32GetDatum(), OSAPerGroupState::number_of_rows, PG_ARGISNULL, PG_GETARG_DATUM, PG_GETARG_POINTER, PG_NARGS, OSAPerGroupState::qstate, slot_getattr(), OSAPerGroupState::sort_done, OSAPerGroupState::sortstate, TupleTableSlot::tts_isnull, TupleTableSlot::tts_values, OSAPerQueryState::tupdesc, tuplesort_gettupleslot(), tuplesort_performsort(), tuplesort_puttupleslot(), and OSAPerQueryState::tupslot.
Referenced by hypothetical_cume_dist_final(), hypothetical_percent_rank_final(), and hypothetical_rank_final().
Datum hypothetical_rank_final | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1244 of file orderedsetaggs.c.
References hypothetical_rank_common(), and PG_RETURN_INT64.
Definition at line 512 of file orderedsetaggs.c.
References DirectFunctionCall2, Float8GetDatumFast, interval_mi(), interval_mul(), and interval_pl().
Referenced by percentile_cont_interval_final(), and percentile_cont_interval_multi_final().
Datum mode_final | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1033 of file orderedsetaggs.c.
References AGG_CONTEXT_AGGREGATE, AggCheckCallContext(), Assert(), CHECK_FOR_INTERRUPTS, DatumGetBool(), DatumGetPointer(), OSAPerQueryState::eqOperator, OSAPerQueryState::equalfn, fmgr_info_cxt(), FmgrInfo::fn_oid, FunctionCall2Coll(), get_opcode(), OSAPerGroupState::number_of_rows, OidIsValid, pfree(), PG_ARGISNULL, PG_GET_COLLATION, PG_GETARG_POINTER, PG_RETURN_DATUM, PG_RETURN_NULL, OSAPerQueryState::qcontext, OSAPerGroupState::qstate, OSAPerGroupState::sort_done, OSAPerGroupState::sortstate, tuplesort_getdatum(), tuplesort_performsort(), tuplesort_rescan(), OSAPerQueryState::typByVal, and val.
|
static |
Definition at line 339 of file orderedsetaggs.c.
References arg, DatumGetPointer(), ExecClearTuple(), OSAPerGroupState::qstate, OSAPerGroupState::sortstate, tuplesort_end(), and OSAPerQueryState::tupslot.
Referenced by ordered_set_startup().
|
static |
Definition at line 113 of file orderedsetaggs.c.
References AGG_CONTEXT_AGGREGATE, AggCheckCallContext(), AggGetAggref(), Aggref::aggorder, OSAPerQueryState::aggref, AggRegisterCallback(), AggStateIsShared(), Aggref::args, Assert(), CreateTemplateTupleDesc(), elog, SortGroupClause::eqop, OSAPerQueryState::eqOperator, OSAPerQueryState::eqOperators, ERROR, ExecTypeFromTL(), TargetEntry::expr, exprCollation(), exprType(), FunctionCallInfoBaseData::flinfo, FmgrInfo::fn_extra, FmgrInfo::fn_mcxt, FreeTupleDesc(), OSAPerGroupState::gcontext, get_sortgroupclause_tle(), get_typlenbyvalalign(), i, if(), InvalidOid, lfirst, linitial, list_length(), MakeSingleTupleTableSlot(), MemoryContextSwitchTo(), TupleDescData::natts, SortGroupClause::nulls_first, OSAPerGroupState::number_of_rows, OSAPerQueryState::numSortCols, OidIsValid, ordered_set_shutdown(), palloc(), palloc0(), PointerGetDatum(), OSAPerQueryState::qcontext, OSAPerGroupState::qstate, OSAPerQueryState::rescan_needed, TargetEntry::resno, OSAPerGroupState::sort_done, OSAPerQueryState::sortColIdx, OSAPerQueryState::sortCollation, OSAPerQueryState::sortCollations, OSAPerQueryState::sortColType, OSAPerQueryState::sortNullsFirst, OSAPerQueryState::sortNullsFirsts, SortGroupClause::sortop, OSAPerQueryState::sortOperator, OSAPerQueryState::sortOperators, OSAPerGroupState::sortstate, TTSOpsMinimalTuple, OSAPerQueryState::tupdesc, TupleDescCopyEntry(), TupleDescInitEntry(), tuplesort_begin_datum(), tuplesort_begin_heap(), TUPLESORT_NONE, TUPLESORT_RANDOMACCESS, OSAPerQueryState::tupslot, OSAPerQueryState::typAlign, OSAPerQueryState::typByVal, OSAPerQueryState::typLen, and work_mem.
Referenced by ordered_set_transition(), and ordered_set_transition_multi().
Datum ordered_set_transition | ( | PG_FUNCTION_ARGS | ) |
Definition at line 358 of file orderedsetaggs.c.
References OSAPerGroupState::number_of_rows, ordered_set_startup(), PG_ARGISNULL, PG_GETARG_DATUM, PG_GETARG_POINTER, PG_RETURN_POINTER, OSAPerGroupState::sortstate, and tuplesort_putdatum().
Datum ordered_set_transition_multi | ( | PG_FUNCTION_ARGS | ) |
Definition at line 383 of file orderedsetaggs.c.
References OSAPerQueryState::aggref, Assert(), ExecClearTuple(), ExecStoreVirtualTuple(), i, Int32GetDatum(), TupleDescData::natts, OSAPerGroupState::number_of_rows, ordered_set_startup(), PG_ARGISNULL, PG_GETARG_DATUM, PG_GETARG_POINTER, PG_NARGS, PG_RETURN_POINTER, OSAPerGroupState::qstate, OSAPerGroupState::sortstate, TupleTableSlot::tts_isnull, TupleTableSlot::tts_tupleDescriptor, TupleTableSlot::tts_values, tuplesort_puttupleslot(), and OSAPerQueryState::tupslot.
|
static |
Definition at line 646 of file orderedsetaggs.c.
Referenced by setup_pct_info().
|
static |
Definition at line 526 of file orderedsetaggs.c.
References AGG_CONTEXT_AGGREGATE, AggCheckCallContext(), Assert(), elog, ereport, errcode(), errmsg(), ERROR, OSAPerGroupState::number_of_rows, PG_ARGISNULL, PG_GETARG_FLOAT8, PG_GETARG_POINTER, PG_RETURN_DATUM, PG_RETURN_NULL, OSAPerGroupState::qstate, OSAPerGroupState::sort_done, OSAPerQueryState::sortColType, OSAPerGroupState::sortstate, tuplesort_getdatum(), tuplesort_performsort(), tuplesort_rescan(), tuplesort_skiptuples(), and val.
Referenced by percentile_cont_float8_final(), and percentile_cont_interval_final().
Datum percentile_cont_float8_final | ( | PG_FUNCTION_ARGS | ) |
Definition at line 613 of file orderedsetaggs.c.
References float8_lerp(), and percentile_cont_final_common().
Datum percentile_cont_float8_multi_final | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1004 of file orderedsetaggs.c.
References float8_lerp(), FLOAT8PASSBYVAL, and percentile_cont_multi_final_common().
Datum percentile_cont_interval_final | ( | PG_FUNCTION_ARGS | ) |
Definition at line 622 of file orderedsetaggs.c.
References interval_lerp(), and percentile_cont_final_common().
Datum percentile_cont_interval_multi_final | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1019 of file orderedsetaggs.c.
References interval_lerp(), and percentile_cont_multi_final_common().
|
static |
Definition at line 848 of file orderedsetaggs.c.
References AGG_CONTEXT_AGGREGATE, AggCheckCallContext(), ARR_DIMS, ARR_LBOUND, ARR_NDIM, Assert(), construct_empty_array(), construct_md_array(), deconstruct_array_builtin(), elog, ERROR, pct_info::first_row, i, idx(), pct_info::idx, OSAPerGroupState::number_of_rows, palloc(), PG_ARGISNULL, PG_GETARG_ARRAYTYPE_P, PG_GETARG_POINTER, PG_RETURN_NULL, PG_RETURN_POINTER, pct_info::proportion, OSAPerGroupState::qstate, pct_info::second_row, setup_pct_info(), OSAPerGroupState::sort_done, OSAPerQueryState::sortColType, OSAPerGroupState::sortstate, tuplesort_getdatum(), tuplesort_performsort(), tuplesort_rescan(), and tuplesort_skiptuples().
Referenced by percentile_cont_float8_multi_final(), and percentile_cont_interval_multi_final().
Datum percentile_disc_final | ( | PG_FUNCTION_ARGS | ) |
Definition at line 427 of file orderedsetaggs.c.
References AGG_CONTEXT_AGGREGATE, AggCheckCallContext(), Assert(), elog, ereport, errcode(), errmsg(), ERROR, OSAPerGroupState::number_of_rows, PG_ARGISNULL, PG_GETARG_FLOAT8, PG_GETARG_POINTER, PG_RETURN_DATUM, PG_RETURN_NULL, OSAPerGroupState::sort_done, OSAPerGroupState::sortstate, tuplesort_getdatum(), tuplesort_performsort(), tuplesort_rescan(), tuplesort_skiptuples(), and val.
Datum percentile_disc_multi_final | ( | PG_FUNCTION_ARGS | ) |
Definition at line 731 of file orderedsetaggs.c.
References AGG_CONTEXT_AGGREGATE, AggCheckCallContext(), ARR_DIMS, ARR_LBOUND, ARR_NDIM, Assert(), construct_empty_array(), construct_md_array(), deconstruct_array_builtin(), elog, ERROR, pct_info::first_row, i, idx(), pct_info::idx, OSAPerGroupState::number_of_rows, palloc(), PG_ARGISNULL, PG_GETARG_ARRAYTYPE_P, PG_GETARG_POINTER, PG_RETURN_NULL, PG_RETURN_POINTER, OSAPerGroupState::qstate, setup_pct_info(), OSAPerGroupState::sort_done, OSAPerQueryState::sortColType, OSAPerGroupState::sortstate, tuplesort_getdatum(), tuplesort_performsort(), tuplesort_rescan(), tuplesort_skiptuples(), OSAPerQueryState::typAlign, OSAPerQueryState::typByVal, OSAPerQueryState::typLen, and val.
|
static |
Definition at line 662 of file orderedsetaggs.c.
References DatumGetFloat8(), ereport, errcode(), errmsg(), ERROR, pct_info::first_row, i, pct_info::idx, Max, palloc(), pct_info_cmp(), pct_info::proportion, qsort, and pct_info::second_row.
Referenced by percentile_cont_multi_final_common(), and percentile_disc_multi_final().