You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Shelley L <ra...@gmail.com> on 2007/03/21 15:41:58 UTC

Aggregates

I need to use several aggregate functions, including most of the built-in
aggregates (count, min, max, avg, etc.) as well as some custom aggregates
(standard deviation and various percentiles).

Is there any documentation or example on how to create custom aggregate
functions?  I have found one reference [1] which only mentions that custom
aggregates can be created, but contains no other details.

(Also, are there any plans to include standard deviation or percentiles as
built-in aggregates in derby?)

[1]
http://db.apache.org/derby/docs/10.2/ref/rrefsqlj33923.html#rrefsqlj33923__sqlj92398

Re: Aggregates

Posted by Rick Hillegas <Ri...@Sun.COM>.
Hi Shelley,

There is an enhancement request logged for this feature: 
http://issues.apache.org/jira/browse/DERBY-672. No-one has picked up 
this enhancement request yet--you are welcome to! Most of the code 
needed for this feature is actually in the Derby codeline. I think the 
blocking issue is that the community must agree on syntax for declaring 
user defined aggregates.

Right now you can fake a user defined aggregate. An example of how to do 
this can be found in the scores demo package in java/demo/scores. For 
more details, please grep that subtree for "getMedianTestScore".

Hope this helps,
-Rick

Shelley L wrote:
> I need to use several aggregate functions, including most of the 
> built-in aggregates (count, min, max, avg, etc.) as well as some 
> custom aggregates (standard deviation and various percentiles).
>
> Is there any documentation or example on how to create custom 
> aggregate functions?  I have found one reference [1] which only 
> mentions that custom aggregates can be created, but contains no other 
> details.
>
> (Also, are there any plans to include standard deviation or 
> percentiles as built-in aggregates in derby?)
>
> [1] 
> http://db.apache.org/derby/docs/10.2/ref/rrefsqlj33923.html#rrefsqlj33923__sqlj92398 
> <http://db.apache.org/derby/docs/10.2/ref/rrefsqlj33923.html#rrefsqlj33923__sqlj92398>