window function v03 against HEAD - Mailing list pgsql-hackers

From H.Harada
Subject window function v03 against HEAD
Date
Msg-id e08cc0400807280325s69452bd3r721fda77a2ea20f9@mail.gmail.com
Whole thread Raw
Responses Re: window function v03 against HEAD  (David Fetter <david@fetter.org>)
List pgsql-hackers
I happily announce that the first design of window function was
finished and the patch against HEAD is released online. See
http://umitanuki.net/pgsql/wfv03/design.html

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.

Regards,



--
Hitoshi Harada

Attachment

pgsql-hackers by date:

Previous
From: Bjorn Munch
Date:
Subject: Re: Whence cometh the data in src/test/regress/data/streets.data ?
Next
From: Zdenek Kotala
Date:
Subject: Re: Review: DTrace probes (merged version) ver_03