MCPcopy Create free account
hub / github.com/apache/cloudberry / AggCheckCallContext

Function AggCheckCallContext

src/backend/executor/nodeAgg.c:4894–4919  ·  view source on GitHub ↗

* AggCheckCallContext - test if a SQL function is being called as an aggregate * * The transition and/or final functions of an aggregate may want to verify * that they are being called as aggregates, rather than as plain SQL * functions. They should use this function to do so. The return value * is nonzero if being called as an aggregate, or zero if not. (Specific * nonzero values are AGG

Source from the content-addressed store, hash-verified

4892 * cache it in the transvalue itself (for internal-type transvalues).
4893 */
4894int
4895AggCheckCallContext(FunctionCallInfo fcinfo, MemoryContext *aggcontext)
4896{
4897 if (fcinfo->context && IsA(fcinfo->context, AggState))
4898 {
4899 if (aggcontext)
4900 {
4901 AggState *aggstate = ((AggState *) fcinfo->context);
4902 ExprContext *cxt = aggstate->curaggcontext;
4903
4904 *aggcontext = cxt->ecxt_per_tuple_memory;
4905 }
4906 return AGG_CONTEXT_AGGREGATE;
4907 }
4908 if (fcinfo->context && IsA(fcinfo->context, WindowAggState))
4909 {
4910 if (aggcontext)
4911 *aggcontext = ((WindowAggState *) fcinfo->context)->curaggcontext;
4912 return AGG_CONTEXT_WINDOW;
4913 }
4914
4915 /* this is just to prevent "uninitialized variable" warnings */
4916 if (aggcontext)
4917 *aggcontext = NULL;
4918 return 0;
4919}
4920
4921/*
4922 * AggGetAggref - allow an aggregate support function to get its Aggref

Callers 15

jsonb_agg_transfnFunction · 0.85
jsonb_agg_finalfnFunction · 0.85
jsonb_object_agg_transfnFunction · 0.85
jsonb_object_agg_finalfnFunction · 0.85
int8incFunction · 0.85
int8decFunction · 0.85
range_agg_transfnFunction · 0.85
range_agg_finalfnFunction · 0.85
makeNumericAggStateFunction · 0.85
numeric_combineFunction · 0.85
numeric_avg_combineFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected