mirror of
https://github.com/postgres/postgres.git
synced 2025-08-25 20:23:07 +03:00
Extend ExecBuildAggTrans() to support a NULL pointer check.
Optionally push a step to check for a NULL pointer to the pergroup state. This will be important for disk-based hash aggregation in combination with grouping sets. When memory limits are reached, a given tuple may find its per-group state for some grouping sets but not others. For the former, it advances the per-group state as normal; for the latter, it skips evaluation and the calling code will have to spill the tuple and reprocess it in a later batch. Add the NULL check as a separate expression step because in some common cases it's not needed. Discussion: https://postgr.es/m/20200221202212.ssb2qpmdgrnx52sj%40alap3.anarazel.de
This commit is contained in:
@@ -225,6 +225,7 @@ typedef enum ExprEvalOp
|
||||
EEOP_AGG_DESERIALIZE,
|
||||
EEOP_AGG_STRICT_INPUT_CHECK_ARGS,
|
||||
EEOP_AGG_STRICT_INPUT_CHECK_NULLS,
|
||||
EEOP_AGG_PLAIN_PERGROUP_NULLCHECK,
|
||||
EEOP_AGG_PLAIN_TRANS_INIT_STRICT_BYVAL,
|
||||
EEOP_AGG_PLAIN_TRANS_STRICT_BYVAL,
|
||||
EEOP_AGG_PLAIN_TRANS_BYVAL,
|
||||
@@ -622,6 +623,13 @@ typedef struct ExprEvalStep
|
||||
int jumpnull;
|
||||
} agg_strict_input_check;
|
||||
|
||||
/* for EEOP_AGG_PLAIN_PERGROUP_NULLCHECK */
|
||||
struct
|
||||
{
|
||||
int setoff;
|
||||
int jumpnull;
|
||||
} agg_plain_pergroup_nullcheck;
|
||||
|
||||
/* for EEOP_AGG_PLAIN_TRANS_[INIT_][STRICT_]{BYVAL,BYREF} */
|
||||
/* for EEOP_AGG_ORDERED_TRANS_{DATUM,TUPLE} */
|
||||
struct
|
||||
|
@@ -255,7 +255,7 @@ extern ExprState *ExecInitQual(List *qual, PlanState *parent);
|
||||
extern ExprState *ExecInitCheck(List *qual, PlanState *parent);
|
||||
extern List *ExecInitExprList(List *nodes, PlanState *parent);
|
||||
extern ExprState *ExecBuildAggTrans(AggState *aggstate, struct AggStatePerPhaseData *phase,
|
||||
bool doSort, bool doHash);
|
||||
bool doSort, bool doHash, bool nullcheck);
|
||||
extern ExprState *ExecBuildGroupingEqual(TupleDesc ldesc, TupleDesc rdesc,
|
||||
const TupleTableSlotOps *lops, const TupleTableSlotOps *rops,
|
||||
int numCols,
|
||||
|
Reference in New Issue
Block a user