Re: [HACKERS] proposal: tuplestore, tuplesort aggregate functions

2010-08-19 Thread David Fetter
On Thu, Aug 19, 2010 at 06:03:57PM -0400, Robert Haas wrote: > On Thu, Aug 19, 2010 at 5:53 PM, David Fetter wrote: > > On Thu, Aug 19, 2010 at 05:40:46PM -0400, Tom Lane wrote: > >> "Kevin Grittner" writes: > >> > Robert Haas wrote: > >> >> I suppose there could also be a bit of an ambiguity if

Re: [HACKERS] proposal: tuplestore, tuplesort aggregate functions

2010-08-19 Thread Robert Haas
On Thu, Aug 19, 2010 at 5:53 PM, David Fetter wrote: > On Thu, Aug 19, 2010 at 05:40:46PM -0400, Tom Lane wrote: >> "Kevin Grittner" writes: >> > Robert Haas wrote: >> >> I suppose there could also be a bit of an ambiguity if you're working >> >> with a type like int4 where the values are discre

Re: [HACKERS] proposal: tuplestore, tuplesort aggregate functions

2010-08-19 Thread David Fetter
On Thu, Aug 19, 2010 at 05:40:46PM -0400, Tom Lane wrote: > "Kevin Grittner" writes: > > Robert Haas wrote: > >> I suppose there could also be a bit of an ambiguity if you're working > >> with a type like int4 where the values are discrete steps. Like, what > >> do you do with {1, 2}? > > Hmm,

Re: [HACKERS] proposal: tuplestore, tuplesort aggregate functions

2010-08-19 Thread Tom Lane
"Kevin Grittner" writes: > Robert Haas wrote: >> I suppose there could also be a bit of an ambiguity if you're working >> with a type like int4 where the values are discrete steps. Like, what >> do you do with {1, 2}? Hmm, good point. > The same thing you do with the avg function? avg's appr

Re: [HACKERS] proposal: tuplestore, tuplesort aggregate functions

2010-08-19 Thread Kevin Grittner
Robert Haas wrote: > I suppose there could also be a bit of an ambiguity if you're working > with a type like int4 where the values are discrete steps. Like, what > do you do with {1, 2}? The same thing you do with the avg function? -Kevin -- Sent via pgsql-hackers mailing list (pgsql-hac

Re: [HACKERS] proposal: tuplestore, tuplesort aggregate functions

2010-08-19 Thread Robert Haas
On Thu, Aug 19, 2010 at 4:21 PM, Tom Lane wrote: > Robert Haas writes: >> You've made this assertion at least three times now, but I confess >> that I've only ever learned one way to compute a median; and quick >> Google searches for "median", "kinds of median", and few other >> variants failed t

Re: [HACKERS] proposal: tuplestore, tuplesort aggregate functions

2010-08-19 Thread Tom Lane
Robert Haas writes: > You've made this assertion at least three times now, but I confess > that I've only ever learned one way to compute a median; and quick > Google searches for "median", "kinds of median", and few other > variants failed to turn up anything obvious either. There are different

Re: [HACKERS] proposal: tuplestore, tuplesort aggregate functions

2010-08-19 Thread Robert Haas
On Thu, Aug 19, 2010 at 9:46 AM, David Fetter wrote: > As to median, please make sure you say in detail which median you're > using and name it so, as there is no single, authoritative median. You've made this assertion at least three times now, but I confess that I've only ever learned one way t

Re: [HACKERS] proposal: tuplestore, tuplesort aggregate functions

2010-08-19 Thread Pavel Stehule
2010/8/19 David Fetter : > On Thu, Aug 19, 2010 at 12:45:13PM +0200, Pavel Stehule wrote: >> Hello >> >> > I'll test both variant first. Maybe there are not any significant >> > difference between them. Now nodeAgg can build, fill a tuplesort. >> > So I think is natural use it. It needs only one -

Re: [HACKERS] proposal: tuplestore, tuplesort aggregate functions

2010-08-19 Thread David Fetter
On Thu, Aug 19, 2010 at 12:45:13PM +0200, Pavel Stehule wrote: > Hello > > > I'll test both variant first. Maybe there are not any significant > > difference between them. Now nodeAgg can build, fill a tuplesort. > > So I think is natural use it. It needs only one - skip a calling a > > transident

Re: [HACKERS] proposal: tuplestore, tuplesort aggregate functions

2010-08-19 Thread Pavel Stehule
Hello > > I'll test both variant first. Maybe there are not any significant > difference between them. Now nodeAgg can build, fill a tuplesort. So I > think is natural use it. It needs only one - skip a calling a > transident function and directly call final function with external > tuplesort. Min

Re: [HACKERS] proposal: tuplestore, tuplesort aggregate functions

2010-08-18 Thread Pavel Stehule
2010/8/18 Tom Lane : > Pavel Stehule writes: >> 2010/8/18 Tom Lane : >>> There would be plenty of scope to re-use the machinery without any >>> SQL-level extensions.  All you need is a polymorphic aggregate >>> transition function that maintains a tuplestore or whatever. > >> Have we to use a tran

Re: [HACKERS] proposal: tuplestore, tuplesort aggregate functions

2010-08-18 Thread Tom Lane
Pavel Stehule writes: > 2010/8/18 Tom Lane : >> There would be plenty of scope to re-use the machinery without any >> SQL-level extensions.  All you need is a polymorphic aggregate >> transition function that maintains a tuplestore or whatever. > Have we to use a transisdent function? If we impl

Re: [HACKERS] proposal: tuplestore, tuplesort aggregate functions

2010-08-18 Thread David Fetter
On Wed, Aug 18, 2010 at 04:46:57PM +0200, Pavel Stehule wrote: > 2010/8/18 Tom Lane : > > David Fetter writes: > >> Apart from the medians, which "median-like" aggregates do you > >> have in mind to start with?  If you can provide examples of > >> "median-like" aggregates that people might need to

Re: [HACKERS] proposal: tuplestore, tuplesort aggregate functions

2010-08-18 Thread Tom Lane
David Fetter writes: > On Wed, Aug 18, 2010 at 10:39:33AM -0400, Tom Lane wrote: >> There would be plenty of scope to re-use the machinery without any >> SQL-level extensions. All you need is a polymorphic aggregate >> transition function that maintains a tuplestore or whatever. >> I don't see th

Re: [HACKERS] proposal: tuplestore, tuplesort aggregate functions

2010-08-18 Thread Pavel Stehule
2010/8/18 Tom Lane : > David Fetter writes: >> Apart from the medians, which "median-like" aggregates do you have in >> mind to start with?  If you can provide examples of "median-like" >> aggregates that people might need to implement as user-defined >> aggregates, or other places where people wo

Re: [HACKERS] proposal: tuplestore, tuplesort aggregate functions

2010-08-18 Thread David Fetter
On Wed, Aug 18, 2010 at 10:39:33AM -0400, Tom Lane wrote: > David Fetter writes: > > Apart from the medians, which "median-like" aggregates do you have in > > mind to start with? If you can provide examples of "median-like" > > aggregates that people might need to implement as user-defined > > ag

Re: [HACKERS] proposal: tuplestore, tuplesort aggregate functions

2010-08-18 Thread Pavel Stehule
2010/8/18 David Fetter : > On Wed, Aug 18, 2010 at 04:10:18PM +0200, Pavel Stehule wrote: >> 2010/8/18 David Fetter : >> > Which median do you plan to implement?  Or do you plan to implement >> > several different medians, each with distinguishing names? >> >> my proposal enabled implementation of

Re: [HACKERS] proposal: tuplestore, tuplesort aggregate functions

2010-08-18 Thread Tom Lane
David Fetter writes: > Apart from the medians, which "median-like" aggregates do you have in > mind to start with? If you can provide examples of "median-like" > aggregates that people might need to implement as user-defined > aggregates, or other places where people would use this machinery, it

Re: [HACKERS] proposal: tuplestore, tuplesort aggregate functions

2010-08-18 Thread David Fetter
On Wed, Aug 18, 2010 at 04:10:18PM +0200, Pavel Stehule wrote: > 2010/8/18 David Fetter : > > Which median do you plan to implement?  Or do you plan to implement > > several different medians, each with distinguishing names? > > my proposal enabled implementation of any "median like" function. But

Re: [HACKERS] proposal: tuplestore, tuplesort aggregate functions

2010-08-18 Thread Pavel Stehule
2010/8/18 David Fetter : > On Wed, Aug 18, 2010 at 04:03:25PM +0200, Pavel Stehule wrote: >> 2010/8/18 Tom Lane : >> > Pavel Stehule writes: >> >> I still thinking about a "median" type functions. My idea is to >> >> introduce a new syntax for stype definition - like >> > >> >> stype = type, or >>

Re: [HACKERS] proposal: tuplestore, tuplesort aggregate functions

2010-08-18 Thread David Fetter
On Wed, Aug 18, 2010 at 04:03:25PM +0200, Pavel Stehule wrote: > 2010/8/18 Tom Lane : > > Pavel Stehule writes: > >> I still thinking about a "median" type functions. My idea is to > >> introduce a new syntax for stype definition - like > > > >> stype = type, or > >> stype = ARRAY OF type [ ORDER

Re: [HACKERS] proposal: tuplestore, tuplesort aggregate functions

2010-08-18 Thread Pavel Stehule
2010/8/18 Tom Lane : > Pavel Stehule writes: >> I still thinking about a "median" type functions. My idea is to >> introduce a new syntax for stype definition - like > >> stype = type, or >> stype = ARRAY OF type [ ORDER [ DESC | ASC ]], or >> stype = TUPLESTORE OF type, or >> stype = TUPLESORT OF

Re: [HACKERS] proposal: tuplestore, tuplesort aggregate functions

2010-08-18 Thread Tom Lane
Pavel Stehule writes: > I still thinking about a "median" type functions. My idea is to > introduce a new syntax for stype definition - like > stype = type, or > stype = ARRAY OF type [ ORDER [ DESC | ASC ]], or > stype = TUPLESTORE OF type, or > stype = TUPLESORT OF type [ DESC | ASC ] This see

[HACKERS] proposal: tuplestore, tuplesort aggregate functions

2010-08-18 Thread Pavel Stehule
Hello I still thinking about a "median" type functions. My idea is to introduce a new syntax for stype definition - like stype = type, or stype = ARRAY OF type [ ORDER [ DESC | ASC ]], or stype = TUPLESTORE OF type, or stype = TUPLESORT OF type [ DESC | ASC ] when stype is ARRAY of then final an