[teiid-issues] [JBoss JIRA] (TEIID-1560) Add support for user defined / pushdown aggregate functions

Steven Hawkins (JIRA) jira-events at lists.jboss.org
Mon Apr 9 15:30:47 EDT 2012


    [ https://issues.jboss.org/browse/TEIID-1560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12682517#comment-12682517 ] 

Steven Hawkins commented on TEIID-1560:
---------------------------------------

Added end-to-end support with metadata support through index procedures marked as functions the new extension metadata properties (in the namespace uri {http://www.teiid.org/ext/relational/2012}) are:

aggregate - to indicate that the function is an aggregate
analytic - if the aggregate must be windowed
allows-orderby - if the aggregate can be ordered, such as xmlagg
allows-distinct - if the aggregate can have DISTINCT specified
uses-distinct-rows - if the aggregate effectively uses distinct rows even if distinct is not specified
decomposable - if a single argument aggregate function can be decomposed as agg(agg(x)) over subsets of the data

To implement a non-pushdown aggregate a developer will implement org.teiid.UserDefinedAggregate with some custom method to act as the accumulator.  The accumulator method is effectively treated the same as a normal user defined function, but should return null and will not be static.

The parser does not generally support parsing aggregate functions that look like regular functions.  For example,
"SELECT myagg(x) FROM ..." will not be properly treated as an aggregate and will fail in validation.  The workaround is to use ALL - "SELECT myagg(ALL x) FROM ..." or any aggregate specific construct.

Confluence updates are still in works and we still need to decide on the DDL support syntax.
                
> Add support for user defined / pushdown aggregate functions
> -----------------------------------------------------------
>
>                 Key: TEIID-1560
>                 URL: https://issues.jboss.org/browse/TEIID-1560
>             Project: Teiid
>          Issue Type: Feature Request
>          Components: Query Engine
>            Reporter: Steven Hawkins
>            Assignee: Steven Hawkins
>             Fix For: 8.0
>
>
> Add support for user defined aggregate functions.  This would also affect the function model metadata.  Our aggregate handling logic will need to be generalized to make this possible.  Starting with the parser we've got special handling for built-in aggregates.
> for user defined aggregate handling just a static method will not work as the function needs to retain state across each group.  Could require that the implementing class extends AggregateFunction. 
> Could also allow user defined aggregates to take an order by clause.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the teiid-issues mailing list