1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-29 10:41:53 +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:
Jeff Davis
2020-03-04 17:20:20 -08:00
parent 3ed2005ff5
commit c954d49046
6 changed files with 101 additions and 7 deletions

View File

@ -2928,7 +2928,8 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
else
Assert(false);
phase->evaltrans = ExecBuildAggTrans(aggstate, phase, dosort, dohash);
phase->evaltrans = ExecBuildAggTrans(aggstate, phase, dosort, dohash,
false);
}