--2oS5YaxWCcQjTEyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Sat, Jul 05, 2008 at 07:04:29PM +0900, H.Harada wrote:
> Hi,
>=20
> As I proposed a month before, I am working on window function.
Very nice!
> http://umitanuki.net/pgsql/wfv01/design.html
>=20
> The problem is, as written in the "Things to discussed" section of the
> do***ent, how you define window functions (e.g. RANK()). My idea is to
> treat them as specialized functions such as SET OF functions and mark
> it in pg_proc. But this doesn't resolve RANK() boundary problem.
Actually, I would make RANK() and ROW_NUMBER() act more like
aggregates. ISTM you have two kinds of window functions:
- aggregation: a result is calculated over a set and the result copied
across all the rows.
- order depenadant: same as above, but the result is different for each
row.
I think you could make the latter work using the current aggregation
setup, just by calling the final_func for each row rather than just
once at the end.
That would make RANK() a normal aggrgate which returns the number of
distinct values seen so far (assuming input is ordered) and
ROW_NUMBER() is just an alias for COUNT().
I hope this is clear, let me know if it doesn't make sense.
Have a nice day,
--=20
Martijn van Oosterhout <kleptog@[EMAIL PROTECTED]
> http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while=20
> boarding. Thank you for flying nlogn airlines.
--2oS5YaxWCcQjTEyO
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFIb4MoIB7bNG8LQkwRAuxyAJ99O3vGv/Qa+aQS2MX5ODcOhoyL1QCdFQm9
uCM71L1B2VSN0NQootlMb3M=
=ufh0
-----END PGP SIGNATURE-----
--2oS5YaxWCcQjTEyO--


|