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

window function v03 against HEAD

From: H(dot)Harada <umi(dot)tanuki(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: window function v03 against HEAD
Date: 2008-07-28 10:25:55
Message-ID: e08cc0400807280325s69452bd3r721fda77a2ea20f9@mail.gmail.com (view raw or flat)
Thread:
Lists: 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: window_function_v03_patch.tgz
Description: application/x-gzip (30.1 KB)

Responses

pgsql-hackers by date

Next:From: Zdenek KotalaDate: 2008-07-28 10:27:43
Subject: Re: Review: DTrace probes (merged version) ver_03
Previous:From: Bjorn MunchDate: 2008-07-28 10:00:05
Subject: Re: Whence cometh the data in src/test/regress/data/streets.data ?

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