You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Rick Hillegas (JIRA)" <ji...@apache.org> on 2011/05/10 20:51:48 UTC

[jira] [Commented] (DERBY-672) Re-enable user defined aggregates

    [ https://issues.apache.org/jira/browse/DERBY-672?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13031306#comment-13031306 ] 

Rick Hillegas commented on DERBY-672:
-------------------------------------

The SQL Server syntax for user-defined aggregates can be found here: http://msdn.microsoft.com/en-us/library/ms182741.aspx and http://msdn.microsoft.com/en-us/library/ms131051.aspx In summary, you bind an external class to an aggregate name. The class must satisfy a contract, which requires it to have methods to initialize, aggregate, merge, and terminate:

CREATE AGGREGATE [<schemaName>.]<aggregateName> ( <functionParameter> [, <functionParameter> ] * )
RETURNS <returnDataType>
EXTERNAL NAME <className>

where <functionParameter> is as defined for CREATE FUNCTION (a parameter name followed by a dataType)

and <className> implements the following methods:

public void init();
public void accumulate( <methodParameter> [, <methodParameter> ] *);  // method parameters correspond to function parameters above
public void merge( <className> otherAggregator );
public <returnType> terminate();  // returnType corresponds to returnDataType above




> Re-enable user defined aggregates
> ---------------------------------
>
>                 Key: DERBY-672
>                 URL: https://issues.apache.org/jira/browse/DERBY-672
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>            Reporter: Rick Hillegas
>
> Nicolas Dufour in an email thread titled "functions and list" started on November 2, 2005 requests the ability to create user defined aggregates.
> This functionality used to be in Cloudscape. It was disabled presumably because it was considered non-standard. However, most of the machinery needed for this feature is still in the code. We should re-enable user defined aggregates after we agree on acceptable syntax.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira