I happily announce that the first design of window function was
finished and the patch against HEAD is released online. See
The window functions such like row_number(), rank(), dense_rank(),
percent_rank() are experimentally defined within the patch as
* It is formed as an aggregate function, seen in pg_aggregate
* It does or does not have trans function.
* It has a final function that is declared as VOLATILE.
* Its final function is called multiple times during returning values.
And ranking system is a bit ugly. The problem was how you know the
ranking boundary. Inside rank_final(), you see WindowState node is
pulled out from fcinfo->context and TupleTableSlot is used. Actually I
am not sure if this is appropriate but have tried it, which did work.
So as the first release, I guess it is better that the window
functions are formulated but not open as user-defined functions.
Also, since current design of the window functions is by aggregate,
some of the SQL spec functions such like lag()/lead() was dropped.
These functions need to reach for random rows from current row. For
this needs, we might have to provide something like Window Object
mechanism that allows random access to the current frame.
There's no additional docs and tests, as well as lack of comments in
source code. The "make check" will fail because some of the window
functions do not have trans function.
Reviews and comments are welcome. I'm eager to refine it.
pgsql-hackers by date
|Next:||From: Zdenek Kotala||Date: 2008-07-28 10:27:43|
|Subject: Re: Review: DTrace probes (merged version) ver_03|
|Previous:||From: Bjorn Munch||Date: 2008-07-28 10:00:05|
|Subject: Re: Whence cometh the data in src/test/regress/data/streets.data ?|