Skip site navigation (1) Skip section navigation (2)

review: More frame options in window functions

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>
Subject: review: More frame options in window functions
Date: 2010-01-14 10:06:26
Message-ID: 162867791001140206r64dc3136s3e27689679ec1d54@mail.gmail.com (view raw or flat)
Thread:
Lists: 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 moving average,
     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

Responses

pgsql-hackers by date

Next:From: Magnus HaganderDate: 2010-01-14 10:09:45
Subject: Re: Streaming replication and non-blocking I/O
Previous:From: Heikki LinnakangasDate: 2010-01-14 10:04:24
Subject: Re: Streaming replication and non-blocking I/O

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group