review: More frame options in window functions - Mailing list pgsql-hackers

From Pavel Stehule
Subject review: More frame options in window functions
Date
Msg-id 162867791001140206r64dc3136s3e27689679ec1d54@mail.gmail.com
Whole thread Raw
Responses Re: review: More frame options in window functions  (Hitoshi Harada <umi.tanuki@gmail.com>)
List pgsql-hackers
Hello

I looked on Hitoshi's patch - and my result is:

1. Patch is in correct format, it is cleanly applied and compilation
is without warnings,
2. Patch contains adequate changes of doc, and rich set of regress tests,
3. If I could to understand to implemented feature - it is in
conformity with SQL standard,
4. This feature increase feature set in analytic area:    a)  we can do simply some operation over time series like
movingaverage,    b) it decrease difference between Oracle and DB2 in this area (so
 
port of some application should be simpler)

5. Last version of this patch work without known crashes
6. make check doesn't signalise any problem

7. Source code respects our coding guidelines - it is well commented
8. Contrib is compiled without warnings
9. All contrib regress tests passed.

Bonus:
It simplify and unifies access to agg or window context via func:
AggGetMemoryContext. It protect us against a future changes.

My  recommendation
* add some examples to documentation - mainly some use case of RANGE frame

Possible issue
* It could to break compatibility for some custom aggregates in C.
This topic was discussed and this way is preferred. I thing, so this
issue  have to be documented somewhere:

"if you use aggcontext in your custom aggregates, fix your code"

if (fcinfo->context && IsA(fcinfo->context, AggState))        aggcontext = ((AggState *) fcinfo->context)->aggcontext;
else if (fcinfo->context && IsA(fcinfo->context, WindowAggState))        aggcontext = ((WindowAggState *)
fcinfo->context)->wincontext;
else

have to be replaced with line:     aggcontext = AggGetMemoryContext((Node *) fcinfo->context, &iswindowagg);

Regards
Pavel Stehule


pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Streaming replication and non-blocking I/O
Next
From: Magnus Hagander
Date:
Subject: Re: Streaming replication and non-blocking I/O