Re: Rethinking representation of partial-aggregate steps - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Rethinking representation of partial-aggregate steps
Date
Msg-id 24924.1466955395@sss.pgh.pa.us
Whole thread Raw
In response to Re: Rethinking representation of partial-aggregate steps  (David Rowley <david.rowley@2ndquadrant.com>)
Responses Re: Rethinking representation of partial-aggregate steps  (David Rowley <david.rowley@2ndquadrant.com>)
Re: Rethinking representation of partial-aggregate steps  (David Rowley <david.rowley@2ndquadrant.com>)
List pgsql-hackers
David Rowley <david.rowley@2ndquadrant.com> writes:
> On 26 June 2016 at 04:07, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> After a bit of thought, maybe AggDivision or AggSplit or something
>> along those lines?

> How about AggCompletion? It's seems to fit well in the sense of the
> aggregation being partial or not, but less well when you consider
> serialisation and combining states.

After having worked on the patch some, I think that AggSplit is a pretty
good choice, because it is about how we split up the calculation of an
aggregate.  And it's short, which is a good thing for something that's
going to be a component of assorted names.

What I've got at the moment looks like:


/* Primitive options supported by nodeAgg.c: */
#define AGGSPLITOP_COMBINE      0x1     /* substitute combinefn for transfn */
#define AGGSPLITOP_SERIALIZE    0x2     /* apply serializefn to output */
#define AGGSPLITOP_DESERIALIZE  0x4     /* apply deserializefn to input */
#define AGGSPLITOP_FINALIZE     0x8     /* run finalfn */

/* Supported operating modes (i.e., useful combinations of these options): */
typedef enum AggSplit
{   /* Basic, non-split aggregation: */   AGGSPLIT_SIMPLE = AGGSPLITOP_FINALIZE,   /* Initial phase of partial
aggregation,with serialization: */   AGGSPLIT_PARTIAL_SERIAL = AGGSPLITOP_SERIALIZE,   /* Final phase of partial
aggregation,with deserialization: */   AGGSPLIT_FINAL_DESERIAL = AGGSPLITOP_COMBINE | AGGSPLITOP_DESERIALIZE |
AGGSPLITOP_FINALIZE
} AggSplit;

/* Test macros for the primitive options: */
#define DO_AGGSPLIT_COMBINE(as)     (((as) & AGGSPLITOP_COMBINE) != 0)
#define DO_AGGSPLIT_SERIALIZE(as)   (((as) & AGGSPLITOP_SERIALIZE) != 0)
#define DO_AGGSPLIT_DESERIALIZE(as) (((as) & AGGSPLITOP_DESERIALIZE) != 0)
#define DO_AGGSPLIT_FINALIZE(as)    (((as) & AGGSPLITOP_FINALIZE) != 0)


Looking at this in the light of morning, I'm rather strongly tempted to
invert the sense of the FINALIZE option, so that "simple" mode works out
as zero, ie, select no options.  Maybe call it SKIPFINAL instead of
FINALIZE?
        regards, tom lane



pgsql-hackers by date:

Previous
From: Julien Rouhaud
Date:
Subject: Re: Rename max_parallel_degree?
Next
From: Andrey Zhidenkov
Date:
Subject: Re: Memory leak in Pl/Python