18#include "utils/fmgrprotos.h"
42 bool forward,
bool withoffset,
bool withdefault);
58 if (context->
rank == 0)
342 if (up || context->
rank == 1)
355 for (row = context->
rank; row < totalrows; row++)
419 if (context->
ntile == 0)
442 (
errcode(ERRCODE_INVALID_ARGUMENT_FOR_NTILE),
443 errmsg(
"argument of ntile must be greater than zero")));
447 context->
boundary = total / nbuckets;
529 bool forward,
bool withoffset,
bool withdefault)
552 (forward ? offset : -offset),
706 (
errcode(ERRCODE_INVALID_ARGUMENT_FOR_NTH_VALUE),
707 errmsg(
"argument of nth_value must be greater than zero")));
#define Assert(condition)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
bool get_fn_expr_arg_stable(FmgrInfo *flinfo, int argnum)
#define PG_RETURN_FLOAT8(x)
#define PG_GETARG_POINTER(n)
#define PG_RETURN_INT64(x)
#define PG_RETURN_INT32(x)
#define PG_RETURN_DATUM(x)
#define PG_RETURN_POINTER(x)
Datum WinGetFuncArgInPartition(WindowObject winobj, int argno, int relpos, int seektype, bool set_mark, bool *isnull, bool *isout)
void * WinGetPartitionLocalMemory(WindowObject winobj, Size sz)
Datum WinGetFuncArgInFrame(WindowObject winobj, int argno, int relpos, int seektype, bool set_mark, bool *isnull, bool *isout)
int64 WinGetCurrentPosition(WindowObject winobj)
bool WinRowsArePeers(WindowObject winobj, int64 pos1, int64 pos2)
void WinSetMarkPosition(WindowObject winobj, int64 markpos)
Datum WinGetFuncArgCurrent(WindowObject winobj, int argno, bool *isnull)
int64 WinGetPartitionRowCount(WindowObject winobj)
#define IsA(nodeptr, _type_)
#define FRAMEOPTION_END_CURRENT_ROW
#define FRAMEOPTION_START_UNBOUNDED_PRECEDING
#define FRAMEOPTION_NONDEFAULT
@ MONOTONICFUNC_INCREASING
static int32 DatumGetInt32(Datum X)
MonotonicFunction monotonic
#define PG_WINDOW_OBJECT()
#define WINDOW_SEEK_CURRENT
Datum window_lag_with_offset(PG_FUNCTION_ARGS)
static bool rank_up(WindowObject winobj)
Datum window_dense_rank(PG_FUNCTION_ARGS)
Datum window_cume_dist_support(PG_FUNCTION_ARGS)
Datum window_last_value(PG_FUNCTION_ARGS)
Datum window_percent_rank(PG_FUNCTION_ARGS)
static Datum leadlag_common(FunctionCallInfo fcinfo, bool forward, bool withoffset, bool withdefault)
Datum window_ntile(PG_FUNCTION_ARGS)
Datum window_row_number(PG_FUNCTION_ARGS)
Datum window_percent_rank_support(PG_FUNCTION_ARGS)
Datum window_first_value(PG_FUNCTION_ARGS)
Datum window_lead(PG_FUNCTION_ARGS)
Datum window_lead_with_offset(PG_FUNCTION_ARGS)
Datum window_lag_with_offset_and_default(PG_FUNCTION_ARGS)
Datum window_lag(PG_FUNCTION_ARGS)
Datum window_row_number_support(PG_FUNCTION_ARGS)
Datum window_lead_with_offset_and_default(PG_FUNCTION_ARGS)
Datum window_cume_dist(PG_FUNCTION_ARGS)
Datum window_rank(PG_FUNCTION_ARGS)
Datum window_ntile_support(PG_FUNCTION_ARGS)
struct rank_context rank_context
Datum window_dense_rank_support(PG_FUNCTION_ARGS)
Datum window_nth_value(PG_FUNCTION_ARGS)
Datum window_rank_support(PG_FUNCTION_ARGS)