PostgreSQL Source Code git master
|
Go to the source code of this file.
Macros | |
#define | WINDOW_SEEK_CURRENT 0 |
#define | WINDOW_SEEK_HEAD 1 |
#define | WINDOW_SEEK_TAIL 2 |
#define | PG_WINDOW_OBJECT() ((WindowObject) fcinfo->context) |
#define | WindowObjectIsValid(winobj) ((winobj) != NULL && IsA(winobj, WindowObjectData)) |
Typedefs | |
typedef struct WindowObjectData * | WindowObject |
Functions | |
void * | WinGetPartitionLocalMemory (WindowObject winobj, Size sz) |
int64 | WinGetCurrentPosition (WindowObject winobj) |
int64 | WinGetPartitionRowCount (WindowObject winobj) |
void | WinSetMarkPosition (WindowObject winobj, int64 markpos) |
bool | WinRowsArePeers (WindowObject winobj, int64 pos1, int64 pos2) |
Datum | WinGetFuncArgInPartition (WindowObject winobj, int argno, int relpos, int seektype, bool set_mark, bool *isnull, bool *isout) |
Datum | WinGetFuncArgInFrame (WindowObject winobj, int argno, int relpos, int seektype, bool set_mark, bool *isnull, bool *isout) |
Datum | WinGetFuncArgCurrent (WindowObject winobj, int argno, bool *isnull) |
#define PG_WINDOW_OBJECT | ( | ) | ((WindowObject) fcinfo->context) |
Definition at line 39 of file windowapi.h.
#define WINDOW_SEEK_CURRENT 0 |
Definition at line 32 of file windowapi.h.
#define WINDOW_SEEK_HEAD 1 |
Definition at line 33 of file windowapi.h.
#define WINDOW_SEEK_TAIL 2 |
Definition at line 34 of file windowapi.h.
#define WindowObjectIsValid | ( | winobj | ) | ((winobj) != NULL && IsA(winobj, WindowObjectData)) |
Definition at line 41 of file windowapi.h.
typedef struct WindowObjectData* WindowObject |
Definition at line 37 of file windowapi.h.
int64 WinGetCurrentPosition | ( | WindowObject | winobj | ) |
Definition at line 3251 of file nodeWindowAgg.c.
References Assert, WindowAggState::currentpos, WindowObjectIsValid, and WindowObjectData::winstate.
Referenced by rank_up(), window_cume_dist(), window_percent_rank(), window_rank(), and window_row_number().
Datum WinGetFuncArgCurrent | ( | WindowObject | winobj, |
int | argno, | ||
bool * | isnull | ||
) |
Definition at line 3659 of file nodeWindowAgg.c.
References WindowObjectData::argstates, Assert, ExprContext::ecxt_outertuple, ExecEvalExpr(), list_nth(), ScanState::ps, PlanState::ps_ExprContext, WindowAggState::ss, ScanState::ss_ScanTupleSlot, WindowObjectIsValid, and WindowObjectData::winstate.
Referenced by leadlag_common(), window_nth_value(), and window_ntile().
Datum WinGetFuncArgInFrame | ( | WindowObject | winobj, |
int | argno, | ||
int | relpos, | ||
int | seektype, | ||
bool | set_mark, | ||
bool * | isnull, | ||
bool * | isout | ||
) |
Definition at line 3464 of file nodeWindowAgg.c.
References WindowObjectData::argstates, Assert, WindowAggState::currentpos, ExprContext::ecxt_outertuple, elog, ERROR, ExecEvalExpr(), WindowAggState::frameheadpos, FRAMEOPTION_EXCLUDE_CURRENT_ROW, FRAMEOPTION_EXCLUDE_GROUP, FRAMEOPTION_EXCLUDE_TIES, FRAMEOPTION_EXCLUSION, WindowAggState::frameOptions, WindowAggState::frametailpos, WindowAggState::groupheadpos, WindowAggState::grouptailpos, list_nth(), Max, Min, ScanState::ps, PlanState::ps_ExprContext, row_is_in_frame(), WindowAggState::ss, WindowAggState::temp_slot_1, update_frameheadpos(), update_frametailpos(), update_grouptailpos(), window_gettupleslot(), WINDOW_SEEK_CURRENT, WINDOW_SEEK_HEAD, WINDOW_SEEK_TAIL, WindowObjectIsValid, WinSetMarkPosition(), and WindowObjectData::winstate.
Referenced by window_first_value(), window_last_value(), and window_nth_value().
Datum WinGetFuncArgInPartition | ( | WindowObject | winobj, |
int | argno, | ||
int | relpos, | ||
int | seektype, | ||
bool | set_mark, | ||
bool * | isnull, | ||
bool * | isout | ||
) |
Definition at line 3376 of file nodeWindowAgg.c.
References WindowObjectData::argstates, Assert, WindowAggState::currentpos, ExprContext::ecxt_outertuple, elog, ERROR, ExecEvalExpr(), list_nth(), ScanState::ps, PlanState::ps_ExprContext, spool_tuples(), WindowAggState::spooled_rows, WindowAggState::ss, WindowAggState::temp_slot_1, window_gettupleslot(), WINDOW_SEEK_CURRENT, WINDOW_SEEK_HEAD, WINDOW_SEEK_TAIL, WindowObjectIsValid, WinSetMarkPosition(), and WindowObjectData::winstate.
Referenced by leadlag_common().
void * WinGetPartitionLocalMemory | ( | WindowObject | winobj, |
Size | sz | ||
) |
Definition at line 3236 of file nodeWindowAgg.c.
References Assert, WindowObjectData::localmem, MemoryContextAllocZero(), WindowAggState::partcontext, WindowObjectIsValid, and WindowObjectData::winstate.
Referenced by rank_up(), window_cume_dist(), window_dense_rank(), window_ntile(), window_percent_rank(), and window_rank().
int64 WinGetPartitionRowCount | ( | WindowObject | winobj | ) |
Definition at line 3266 of file nodeWindowAgg.c.
References Assert, spool_tuples(), WindowAggState::spooled_rows, WindowObjectIsValid, and WindowObjectData::winstate.
Referenced by window_cume_dist(), window_ntile(), and window_percent_rank().
bool WinRowsArePeers | ( | WindowObject | winobj, |
int64 | pos1, | ||
int64 | pos2 | ||
) |
Definition at line 3319 of file nodeWindowAgg.c.
References are_peers(), Assert, elog, ERROR, ExecClearTuple(), if(), INT64_FORMAT, WindowAgg::ordNumCols, PlanState::plan, ScanState::ps, res, WindowAggState::ss, WindowAggState::temp_slot_1, WindowAggState::temp_slot_2, window_gettupleslot(), WindowObjectIsValid, and WindowObjectData::winstate.
Referenced by rank_up(), and window_cume_dist().
void WinSetMarkPosition | ( | WindowObject | winobj, |
int64 | markpos | ||
) |
Definition at line 3284 of file nodeWindowAgg.c.
References Assert, WindowAggState::buffer, elog, ERROR, WindowObjectData::markpos, WindowObjectData::markptr, WindowObjectData::readptr, WindowObjectData::seekpos, tuplestore_select_read_pointer(), tuplestore_skiptuples(), WindowObjectIsValid, and WindowObjectData::winstate.
Referenced by eval_windowaggregates(), rank_up(), window_row_number(), WinGetFuncArgInFrame(), and WinGetFuncArgInPartition().