db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Hillegas (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-672) Re-enable user defined aggregates
Date Fri, 22 Mar 2013 15:33:16 GMT

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

Rick Hillegas commented on DERBY-672:

Thanks for buddy-testing user-defined aggregates, Dag. Here are responses to questions you
posed on this wiki page: http://wiki.apache.org/db-derby/TenTenOneBuddyTesting


>* Currently, our docs say:
>  "An unqualified UDA name may not be the name of an aggregate defined in part 2 of the
SQL Standard, section 10.9:
>  ANY..
>    But even when name is qualified, I see: 
>  ij> create derby aggregate app.ANY for int returns int external name 'foo.Agg';
>  ERROR 42X01: Syntax error: Encountered "ANY" at line 1, column 28.
>    I need to quote it: 
>  ij> create derby aggregate app."ANY" for int returns int external name 'foo.Agg';
>  0 rows inserted/updated/deleted
>    Code or doc correct? 

The wording in the Reference Manual could be improved. Logged DERBY-6116 to track this.


>  "In general, UDAs live in the same namespace as one-argument user-defined functions
(see CREATE FUNCTION statement)."
>    But ij doesn't show aggregates: 
>  ij> create function app."ANY" (i int) returns int parameter style java language java
external name 'foo.bar';
>  ERROR X0Y87: There is already an aggregate or function with one argument whose name
is 'APP'.'ANY'.
>  ij> show functions in app;
>  FUNCTION_SCHEM|FUNCTION_NAME               |REMARKS                            
>  -------------------------------------------------------------------------------
>  0 rows selected

I think what's missing here is a "show aggregates" command. Logged DERBY-6119 to track this.


>* checked simple int aggregator: found agg class could not be static nested class in another(?)
>    Expected or pilot error? If expected, why? document? Currently we say: 
>  "The !ClassNameString is a single-quoted string. It is the full name of a Java class
which implements the org.apache.derby.agg.Aggre>gator interface."

I believe that the problem here is that a period rather than a dollar sign was used in the
name of the nested class in the "external name" clause. This gotcha trips up a lot of people
and indicates that we need to provide some more advice in the Reference Manual. Logged DERBY-6120
to track this issue.


>* The merge method wasn't used in my simple example. When is it used?
>    If only needed in compex queries, we might want to warn the user on how to construct
test cases to debug it... 

This method is called when Derby has to spill intermediate results to disk (and retrieve them
later) when processing a grouped aggregate with a large number of groups. I have added this
explanation to the javadoc for Aggregator.merge() via patch derby-672-23-aa-improveJavadocForAggregator.merge.diff.

While verifying this behavior, I tripped across a problem in the test class ModeAggregator:
its state was not serializable. I corrected that problem via patch derby-672-22-aa-makeModeAggregateStateSerializable.diff.
This prompted me to log an issue for beefing up the UDA documentation with the advice that
all of the state of a UDA must be serializable: DERBY-6127.


>* In the GRANT-statement refman page, we are inconsisten when it comes to explaining
>    identifiers (seen when looking at GRANT USAGE of aggregates): "table-Name" occurences
are linked to a section explainig them (rre>ftablename.html), but UDA names are defined
in-lined as 
>      GRANT USAGE ON DERBY AGGREGATE [ schemaName. ] SQL92Identifier TO grantees
>    In a third variant, 
>      GRANT EXECUTE ON { FUNCTION | PROCEDURE } routine-designator TO grantees
>    routine-designator is defined locally as 
>      routine-designator { function-name | procedure-name }  
>    without links to what "function-name" or "procedure-name" might look like. It would
be good to harmonize the latter two forms to> a central definition as for "table-Name".
>    Finally, I noted that the definition page for SchemaName doesn't link to the SQL92Identifier

Logged DERBY-6121 to track this issue.

> 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
>            Assignee: Rick Hillegas
>         Attachments: d672-no-exceptions.diff, derby-672-01-aa-ddl.diff, derby-672-02-ac-nonDistinct.diff,
derby-672-03-aa-distinct.diff, derby-672-03-ab-distinct.diff, derby-672-04-aa-fixJSR169test.diff,
derby-672-05-aa-java7testOrderProblem.diff, derby-672-06-aa-grantRevoke.diff, derby-672-07-aa-fixJSR169again.diff,
derby-672-08-aa-fixJSR169yetAgain.diff, derby-672-09-ab-udtAggregates.diff, derby-672-10-af-typeBounds.diff,
derby-672-11-aa-tests.diff, derby-672-11-ab-tests.diff, derby-672-12-aa-implicitCasts.diff,
derby-672-13-aa-differentReturnType.diff, derby-672-14-aa-collations.diff, derby-672-15-aa-setCollation.diff,
derby-672-16-aa-forbidInGroupBy.diff, derby-672-17-aa-moreTests.diff, derby-672-18-aa-udaInJar.diff,
derby-672-19-aa-precisionChecks.diff, derby-672-20-aa-exactBounds.diff, derby-672-21-aa-typeDependencies.diff,
derby-672-22-aa-makeModeAggregateStateSerializable.diff, derby-672-23-aa-improveJavadocForAggregator.merge.diff,
UserDefinedAggregates.html, UserDefinedAggregates.html, UserDefinedAggregates.html, UserDefinedAggregates.html
> 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.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

View raw message