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

2013-03-22 Thread Rick Hillegas (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-672:


Attachment: derby-672-23-aa-improveJavadocForAggregator.merge.diff

Attaching derby-672-23-aa-improveJavadocForAggregator.merge.diff. This patch 
expands the javadoc for the Aggregator.merge() method. Committed at subversion 
revision 1459837.

Buddy-testing raised the following issue: How can users test their merge() 
implementations? It's not clear what kinds of queries cause Derby to call the 
merge() method. The answer is that merge() is called when Derby has to spill 
intermediate results to disk (and retrieve them later) for grouped aggregates 
with a large number of groups. A query like the following can cause Derby to do 
this. The merge() method is called when Derby encounters rows which belong to 
groups which spilled to disk previously:

select a, mode( b ) from mode_inputs group by a order by a


Touches the following file:

M   java/engine/org/apache/derby/agg/Aggregator.java


> 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


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

2013-03-22 Thread Rick Hillegas (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-672:


Attachment: derby-672-22-aa-makeModeAggregateStateSerializable.diff

Attaching derby-672-22-aa-makeModeAggregateStateSerializable.diff. This patch 
makes a helper class Serializable. The helper class is used by the test class 
ModeAggregate. The UserDefinedAggregatesTest runs cleanly for me with this 
patch. Committed at subversion revision 1459784.

I discovered that the helper class needs to be Serializable while writing 
experiments to try to force Derby to perform the merge() phase of aggregation. 
In my experiment, a grouped aggregate with millions of groups ended up 
serializing partial results to disk and this tripped across the 
unserializability of the helper class. It would be worthwhile to file an issue 
to add some advice to the Reference Manual: the Aggregator interface extends 
Serializable, which means that all of the state in your UDA needs to be 
serializable.

Touches the following file:

M   
java/testing/org/apache/derbyTesting/functionTests/tests/lang/ModeAggregate.java


> 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, 
> 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


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

2012-10-23 Thread Rick Hillegas (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-672:


Attachment: UserDefinedAggregates.html

Attaching a 4th rev of the functional spec for this feature. This rev makes a 
couple minor changes:

oFurther clarify that a UDA's input and return types may not be XML.
oAdd package declaration to javadoc for Aggregator.

At this point, I have reached the limit of my ability to test this feature. I 
cannot see past my own blinders. Hopefully, other people will be able to find 
some time to buddy-test this feature.

Thanks,
-Rick


> 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, 
> 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


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

2012-10-23 Thread Rick Hillegas (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-672:


Attachment: derby-672-21-aa-typeDependencies.diff

Attaching derby-672-21-aa-typeDependencies.diff. This patch adds support for 
dependencies of user-defined aggregates on user-defined types. Committed at 
subversion revision 1401303.


Touches the following files:

---

M   java/engine/org/apache/derby/impl/sql/execute/DDLConstantAction.java

Added dependencies of aggregates on types similar to the dependencies of 
routines on types.

---

M   
java/testing/org/apache/derbyTesting/functionTests/tests/lang/UDAPermsTest.java

Tests for GRANT/REVOKE USAGE on types which are used by aggregates.

---

M   
java/testing/org/apache/derbyTesting/functionTests/tests/lang/UserDefinedAggregatesTest.java

Tests for attempting to drop a type which an aggregate uses.


> 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, 
> 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


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

2012-10-23 Thread Knut Anders Hatlen (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Knut Anders Hatlen updated DERBY-672:
-

Attachment: d672-no-exceptions.diff

I took another look at the exception handling in AggregateNode.getSQLName() and 
found that there was no code called from it that could ever cause a 
StandardException. The need to catch StandardException came from 
AliasDescriptor.getSchemaName(), which is declared as throws StandardException 
even though it does not call any methods that could raise StandardExceptions.

The patch d672-no-exceptions.diff removes the unnecessary throws clause from 
AliasDescriptor.getSchemaName() and the methods that call it, as well as the 
exception handler in getSQLName(). The patch also removes a redundant null 
check in isUserDefinedAggregate() (redundant because instanceof implies not 
null). All the regression tests ran cleanly. Committed revision 1401250.

> 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, 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


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

2012-10-22 Thread Rick Hillegas (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-672:


Attachment: derby-672-20-aa-exactBounds.diff

Attaching derby-672-20-aa-exactBounds.diff. This patch tightens up the bounds 
checking on the input and return types of user-defined aggregates. Committed at 
subversion revision 1400984.

When I simplified bounds checking for input and return types, I lost the 
ability to catch some user mistakes at compile time. So for instance, given the 
following UDA:

create derby aggregate bigintMode_16 for bigint
external name 
'org.apache.derbyTesting.functionTests.tests.lang.GenericMode$IntMode'

...the following statement would fail at run time when the user code tried to 
cast a Long to an Integer:

select bigintMode_16( b ) from bigintMode_16_mode_inputs

The solution was to revive the tricky code which I deprecated in patch 
derby-672-10-af-typeBounds.diff and to use that tricky code alongside the 
simpler bounds checking introduced by that patch. The tricky code catches the 
above mismatch at bind() time rather than failing at run time. I am not pleased 
by the complexity of the tricky code but I think it is better to catch these 
kinds of errors when the statement is compiled.


Touches the following files:

---

M   
java/engine/org/apache/derby/iapi/services/loader/Java5ClassInspector.java
M   java/engine/org/apache/derby/iapi/services/loader/ClassInspector.java

Re-introduce the tricky code.

---

M   
java/engine/org/apache/derby/impl/sql/compile/UserAggregateDefinition.java

Wire the tricky code back into bind-time type resolution.

---

M   
java/testing/org/apache/derbyTesting/functionTests/tests/lang/GenericMode.java

While experimenting, I changed the name of the GenericMode type variable from V 
to B. This helps to clearly disambiguate it from the V type variable of the 
Aggregator class itself. It's a cosmetic change which I think may be useful in 
the future if we need to keep improving bounds checking for UDAs.

---

M   
java/testing/org/apache/derbyTesting/functionTests/tests/lang/UserDefinedAggregatesTest.java

Additional tests.


> 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: 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, 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


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

2012-10-19 Thread Rick Hillegas (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-672:


Attachment: derby-672-19-aa-precisionChecks.diff

Attaching derby-672-19-aa-precisionChecks.diff. This patch adds tests for 
precision mismatches in datatype coercion for user-defined aggregates. 
Committed at subversion revision 1400208.



Touches the following files:

---

M   java/engine/org/apache/derby/impl/sql/compile/AggregateNode.java

Adds a comment to the exception-swallowing in getSQLName() as requested by Knut.

---

M   
java/testing/org/apache/derbyTesting/functionTests/tests/lang/UserDefinedAggregatesTest.java

Precision tests.


> 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: 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, 
> 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


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

2012-10-19 Thread Rick Hillegas (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-672:


Attachment: derby-672-18-aa-udaInJar.diff

Attaching derby-672-18-aa-udaInJar.diff. This patch adds support for running 
user-defined aggregates from jar files stored in the database. I am running 
regression tests now.


Touches the following files:

---

M   
java/engine/org/apache/derby/impl/sql/compile/UserAggregateDefinition.java

Fault-in Aggregator before faulting-in the user-supplied class. I don't think 
this is necessary but it looks cleaner.

---

M   java/engine/org/apache/derby/impl/services/reflect/JarLoader.java

Add the Aggregator package to the list of Derby packages which the database 
class loader is willing to load.

---

M   
java/testing/org/apache/derbyTesting/functionTests/tests/lang/DatabaseClassLoadingTest.java
A   
java/testing/org/apache/derbyTesting/functionTests/tests/lang/median_uda.jar

Test for this functionality. The jar file holds a Median aggregator. A new test 
case in DatabaseClassLoadingTest installs the jar, wires it into the database 
class path, and then invokes the aggregate inside.


> 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: 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, 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


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

2012-10-19 Thread Rick Hillegas (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-672:


Attachment: derby-672-17-aa-moreTests.diff

Attaching derby-672-17-aa-moreTests.diff. This patch adds negative tests for 
more illegal uses of user-defined aggregates. Along the way, some code had to 
be corrected. Tests ran cleanly for me. Committed at subversion revision 
1400083.

Touches the following files:

---

M   java/engine/org/apache/derby/impl/sql/compile/AggregateNode.java

Changes some error messages to use the schema-qualified name of the 
user-defined aggregate rather than the name of the class it is bound to.

---

M   java/engine/org/apache/derby/impl/sql/compile/ConditionalNode.java

I was seeing NPEs when using user-defined aggregates in CASE expressions for 
the following reason: although the aggregate-bearing clauses were being bound 
in isolation, the bound forms weren't being substituted back into the larger 
expression tree. I corrected this by putting the bound forms back into the tree.

---

M   
java/testing/org/apache/derbyTesting/functionTests/tests/lang/UserDefinedAggregatesTest.java

Additional test cases.


> 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: 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, 
> 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


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

2012-10-17 Thread Rick Hillegas (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-672:


Attachment: derby-672-16-aa-forbidInGroupBy.diff

Attaching derby-672-16-aa-forbidInGroupBy.diff. This patch forbids user-defined 
aggregates in GROUP BY clauses, just as builtin aggregates are illegal there. I 
will run regression tests.


Touches the following files:



M   java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
M   java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java

Logic to forbid user-defined aggregates in GROUP by clauses.




M   java/engine/org/apache/derby/impl/sql/compile/CollectNodesVisitor.java

Corrected a javadoc comment here.



M   
java/testing/org/apache/derbyTesting/functionTests/tests/lang/UserDefinedAggregatesTest.java

Test case.


> 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: 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, 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


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

2012-10-16 Thread Rick Hillegas (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-672:


Attachment: derby-672-15-aa-setCollation.diff

Attaching derby-672-15-aa-setCollation.diff. This patch sets the collation for 
the string input and return types of user-defined aggregates in the same way 
that it is set for the arguments and return values of functions. Committed at 
subversion revision 1398952.


Touches the following files:

M   java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java
M   java/engine/org/apache/derby/catalog/types/AggregateAliasInfo.java


> 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: 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, 
> 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


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

2012-10-16 Thread Rick Hillegas (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-672:


Attachment: derby-672-14-aa-collations.diff

Attaching derby-672-14-aa-collations.diff. This patch adds a fixture to make 
the user-defined aggregate tests run both with and without territory based 
collations. Committed at subversion revision 1398934.


Touches the following file:

M   
java/testing/org/apache/derbyTesting/functionTests/tests/lang/UserDefinedAggregatesTest.java


> 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: 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, 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


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

2012-10-16 Thread Rick Hillegas (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-672:


Attachment: UserDefinedAggregates.html

Attaching 3rd rev of the functional spec for this feature. This rev 
incorporates the following changes:

oClarifies that a UDA's input and return types are always nullable.
oRemoves SQLException from the signature of Aggregator.
oClarifies that XML is not a valid datatype for UDA inputs and return 
values.
oClarifies that the type of a value passed to a UDA must be storable in the 
input type of the UDA.
oReplaces the "Open Questions" section with an appendix showing an example 
which is suitable for the user guides.


> 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: 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, 
> 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


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

2012-10-15 Thread Rick Hillegas (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-672:


Attachment: derby-672-13-aa-differentReturnType.diff

Attaching derby-672-13-aa-differentReturnType.diff. This patch makes it 
possible for a user-defined aggregate to have different input and return types. 
I am running regression tests now.


Touches the following files:

--

M   java/engine/org/apache/derby/impl/sql/compile/GroupByNode.java

The problem was that the type of the aggregate result column was being derived 
from the type of the aggregate's input expression, for all aggregates except 
for COUNT. This file is changed to use the actual bound type of the aggregate 
result.

--

M   
java/testing/org/apache/derbyTesting/functionTests/tests/lang/UserDefinedAggregatesTest.java
M   java/testing/org/apache/derbyTesting/functionTests/tests/lang/build.xml
A   
java/testing/org/apache/derbyTesting/functionTests/tests/lang/LongMagnitude.java

Additional tests.


> 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: 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, 
> 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


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

2012-10-15 Thread Rick Hillegas (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-672:


Attachment: derby-672-12-aa-implicitCasts.diff

Attaching derby-672-12-aa-implicitCasts.diff. This patch attempts to make 
datatype coercion work for user-defined aggregates the way that it works for 
function arguments. I am running regression tests now.

This patch makes two noteworthy changes:

1) The input arg to the user-defined aggregate is wrapped in a CAST node if we 
would do the same thing when invoking a similar user-defined function on that 
argument.

2) Input datatype checking for user-defined aggregates is relaxed. Instead of 
demanding exact type match, we check to see whether the actual datatype can be 
stored in the expected type. This is what we do for user-defined functions. 
This allows implicit casting to occur at runtime.


Touches the following files:

--

M   java/engine/org/apache/derby/impl/sql/compile/AggregateNode.java
M   
java/engine/org/apache/derby/impl/sql/compile/UserAggregateDefinition.java
M   java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java

Changes needed for (1) and (2).

--

M   
java/testing/org/apache/derbyTesting/functionTests/tests/lang/UserDefinedAggregatesTest.java

Additional tests.


> 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: 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, 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


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

2012-10-10 Thread Rick Hillegas (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-672:


Attachment: derby-672-11-ab-tests.diff

Thanks for the quick review, Knut. Attaching derby-672-11-ab-tests.diff. This 
version makes all of the improvements you suggested. Committed at subversion 
revision 1396589.

I also added another test condition. 
UserDefinedAggregatesTest.test_11_datatypes() will now fail if we add another 
builtin datatype to Derby. The comment accompanying that check explains that 
when we add a new builtin datatype, we need to add a corresponding test case to 
test_11_datatypes().

Touches the following additional file:

M   
java/testing/org/apache/derbyTesting/functionTests/tests/lang/ModeAggregate.java


> 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: 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, 
> 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


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

2012-10-09 Thread Rick Hillegas (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-672:


Attachment: derby-672-11-aa-tests.diff

Attaching derby-672-11-aa-tests.diff. This patch adds a battery of data type 
tests for user-defined aggregates. I will run regression tests.


Touches the following files:

-

M   java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java
M   java/engine/org/apache/derby/loc/messages.xml

Prevent XML from being used as an input or return type of a user-defined 
aggregate. We can't support aggregates on XML types until we add support for 
java.sql.SQLXML, the corresponding Java data type.

-

M   
java/engine/org/apache/derby/impl/sql/compile/UserAggregateDefinition.java

Handle binary SQL types by translating their Java type name as "[B" rather than 
"byte[]".

-

M   
java/testing/org/apache/derbyTesting/functionTests/tests/lang/UserDefinedAggregatesTest.java
M   java/testing/org/apache/derbyTesting/functionTests/tests/lang/build.xml
M   
java/testing/org/apache/derbyTesting/functionTests/tests/lang/GenericMode.java
A   
java/testing/org/apache/derbyTesting/functionTests/tests/lang/LobMode.java

Additional tests.


> 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: 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, 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


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

2012-09-28 Thread Rick Hillegas (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-672:


Attachment: derby-672-10-af-typeBounds.diff

Attaching derby-672-10-af-typeBounds.diff. This patch implements something akin 
to the elegant pattern which Knut suggested in his comment on 2012-07-18. I am 
running regression tests now.

With this patch, you can write a single generic Java class:

public class GenericMode> implements 
Aggregator> {...}

and bind many type-specific aggregates to it:

create derby aggregate intMode_09 for int external name 
'org.apache.derbyTesting.functionTests.tests.lang.GenericMode';
create derby aggregate varcharMode_09 for varchar( 5 ) external name 
'org.apache.derbyTesting.functionTests.tests.lang.GenericMode';
create derby aggregate fullNameMode_09 for FullName_09 external name 
'org.apache.derbyTesting.functionTests.tests.lang.GenericMode';

To achieve this, I replaced the type inspection code used on the input and 
return types of the aggregator. Previously, we were checking for raw types. 
With this patch, we are checking that the declared input and return types fit 
within the generic aggregator's type bounds.


Touches the following files:

-

M   
java/engine/org/apache/derby/iapi/services/loader/Java5ClassInspector.java
M   java/engine/org/apache/derby/iapi/services/loader/ClassInspector.java

Replaced the tricky discovery of raw types with a simpler scheme for
discovering type bounds.

-

M   
java/engine/org/apache/derby/impl/sql/compile/UserAggregateDefinition.java
M   java/engine/org/apache/derby/loc/messages.xml

Used type bounds rather than raw types to match declared SQL types to
actual Java types.

-

M   java/engine/org/apache/derby/impl/sql/compile/AggregateNode.java

When a type mismatch occurs, report it using the SQL name of the
aggregate rather than its Java name.

-

M   java/engine/org/apache/derby/impl/sql/compile/ValueNode.java

Bind user-defined types better.

-

M   
java/testing/org/apache/derbyTesting/functionTests/tests/lang/UserDefinedAggregatesTest.java

Added test cases for generic aggregator classes.


> 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: 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, 
> 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


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

2012-09-27 Thread Rick Hillegas (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-672:


Attachment: derby-672-09-ab-udtAggregates.diff

Attaching derby-672-09-ab-udtAggregates.diff. This patch makes it possible to 
create aggregates on user defined types. I am running regression tests now.

Touches the following files:

--

M   java/engine/org/apache/derby/impl/sql/compile/QueryTreeNode.java
M   java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java

The input and return types of the aggregate needed to be bound in order for 
CREATE DERBY AGGREGATE to succeed on user defined types. 

--

M   
java/testing/org/apache/derbyTesting/functionTests/tests/lang/UserDefinedAggregatesTest.java
A   
java/testing/org/apache/derbyTesting/functionTests/tests/lang/FullName.java
M   
java/testing/org/apache/derbyTesting/functionTests/tests/lang/GenericMode.java
M   java/testing/org/apache/derbyTesting/functionTests/tests/lang/build.xml

Additional test case for creating aggregates on a user-defined type.


> 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: 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, 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


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

2012-09-04 Thread Rick Hillegas (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-672:


Attachment: derby-672-08-aa-fixJSR169yetAgain.diff

Attaching 3rd attempt to fix test failure on jsr 169: 
derby-672-08-aa-fixJSR169yetAgain.diff. Committed at subversion revision 
1380784.

> 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: 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, 
> 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


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

2012-09-03 Thread Rick Hillegas (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-672:


Attachment: derby-672-07-aa-fixJSR169again.diff

Attaching derby-672-07-aa-fixJSR169again.diff. This is a second attempt to fix 
UngroupedAggregatesNegativeTest. The previous fix just seemed to push the 
problem around. Committed at subversion revision 1380207.


Touches the following file:

M   
java/testing/org/apache/derbyTesting/functionTests/tests/lang/UngroupedAggregatesNegativeTest.java


> 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: 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, 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


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

2012-09-03 Thread Rick Hillegas (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-672:


Attachment: derby-672-06-aa-grantRevoke.diff

Attaching derby-672-06-aa-grantRevoke.diff. This patch adds GRANT/REVOKE USAGE 
support for user-defined aggregates. Regression tests passed cleanly for me. 
Committed at subversion revision 1380202.


Touches the following files:

-

M   java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
M   
java/engine/org/apache/derby/iapi/sql/dictionary/StatementGenericPermission.java
M   java/engine/org/apache/derby/iapi/sql/dictionary/PermDescriptor.java
M   java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java
M   java/engine/org/apache/derby/impl/sql/depend/BasicDependencyManager.java

Add user-defined aggregates to the dependency/privilege managers.

-

M   java/engine/org/apache/derby/impl/sql/compile/AggregateNode.java
M   
java/engine/org/apache/derby/impl/sql/compile/UserAggregateDefinition.java

Wire-in dependency and privilege checking for invocations of user-defined 
aggregates.

-

M   java/tools/org/apache/derby/impl/tools/dblook/DB_GrantRevoke.java
M   java/tools/org/apache/derby/loc/toolsmessages.properties

Support for reconstructing permissions on aggregates when the database schema 
is dumped.

-

A   
java/testing/org/apache/derbyTesting/functionTests/tests/lang/UDAPermsTest.java
M   
java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java

Add a new test for USAGE privilege on user-defined aggregates

-

M   
java/testing/org/apache/derbyTesting/functionTests/tests/lang/UserDefinedAggregatesTest.java

Add a test case for dependencies of view/triggers on user-defined aggregates.


> 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: 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, 
> 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


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

2012-08-31 Thread Rick Hillegas (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-672:


Attachment: derby-672-05-aa-java7testOrderProblem.diff

Attaching derby-672-05-aa-java7testOrderProblem.diff. Hopefully this fixes the 
test order problem on Java 7 on Sol32. Committed at subversion revision 1379527.

Touches the following file:

M   
java/testing/org/apache/derbyTesting/functionTests/tests/lang/UserDefinedAggregatesTest.java


> 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: 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, 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


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

2012-08-31 Thread Rick Hillegas (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-672:


Attachment: derby-672-04-aa-fixJSR169test.diff

Thanks for spotting that test failure, Knut. Attaching 
derby-672-04-aa-fixJSR169test.diff, which hopefully fixes the test. The patch 
changes the test to treat both XBCM5 and XJ001 as valid errors. Committed at 
subversion revision 1379519.

I don't understand what's different between my Java ME environment and that of 
the test. With and without the patch, the test runs cleanly for me on both OJEC 
and phoneME.

Touches the following file:

M   
java/testing/org/apache/derbyTesting/functionTests/tests/lang/UngroupedAggregatesNegativeTest.java


> 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: 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, 
> 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


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

2012-08-31 Thread Rick Hillegas (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-672:


Attachment: derby-672-03-ab-distinct.diff

Tests passed cleanly for me on derby-672-03-aa-distinct.diff. Attaching a 
second rev of the patch, which includes more test cases: 
derby-672-03-ab-distinct.diff. Committed at revision 1379505.


> 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: derby-672-01-aa-ddl.diff, 
> derby-672-02-ac-nonDistinct.diff, derby-672-03-aa-distinct.diff, 
> derby-672-03-ab-distinct.diff, 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


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

2012-08-31 Thread Rick Hillegas (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-672:


Attachment: derby-672-03-aa-distinct.diff

Attaching derby-672-03-aa-distinct.diff. This patch adds support for invoking 
DISTINCT user-defined aggregates in the SELECT list. I am running regression 
tests now.

Touches the following files:

---

M   java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj

New parser production for DISTINCT user-defined aggregate invocations. When 
looking for function invocations, we also look for DISTINCT user-defined 
aggregate invocations. If we find one, we return an AggregateNode rather than a 
StaticMethodCallNode.

---

M   java/engine/org/apache/derby/impl/sql/compile/AggregateNode.java
M   java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java

Bind-time support for AggregateNodes which were created by the new parser 
production.

---

M   java/engine/org/apache/derby/impl/sql/execute/UserDefinedAggregator.java

Fixes a casting error in the runtime logic for user-defined aggregates. The 
cast occurs in the merge() processing, which is tickled by DISTINCT aggregates.

---

M   
java/testing/org/apache/derbyTesting/functionTests/tests/lang/UserDefinedAggregatesTest.java

New test cases.


> 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: derby-672-01-aa-ddl.diff, 
> derby-672-02-ac-nonDistinct.diff, derby-672-03-aa-distinct.diff, 
> 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


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

2012-08-28 Thread Rick Hillegas (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-672:


Attachment: derby-672-02-ac-nonDistinct.diff

Attaching derby-672-02-ac-nonDistinct.diff. This patch adds bind() and 
execute() support for non-distinct user-defined aggregates. I am running 
regression tests now.

With this patch you can invoke user-defined aggregates in simple queries. These 
include both scalar and grouped results. So, for instance, the following script 
now runs correctly:

create derby aggregate mode for int external name 
'org.apache.derbyTesting.functionTests.tests.lang.ModeAggregate';
create table mode_inputs( a int, b int );
insert into mode_inputs( a, b ) values ( 1, 1 ), ( 1, 2 ), ( 1, 2 ), ( 1, 2 ), 
( 2, 3 ), ( 2, 3 ), ( 2, 4 );
select mode( b ) from mode_inputs;
select a, mode( b ) from mode_inputs group by a;

Support is NOT included for DISTINCT invocations of user-defined aggregates nor 
for user-defined aggregates in HAVING clauses.

On 2012-07-18 Knut wondered whether we would support parameterized aggregates, 
e.g., with elegant syntax like the following:

create derby aggregate int_mode for int external name 
'GenericMode'; 

Unfortunately, I have not been able to make this work. That is because type 
erasure makes it impossible to instantiate the aggregate via Class.forName(). 
The following sample code demonstrates the problem:

public  class   z
{
public  static  voidmain( String[] args ) throws Exception
{
// raises a ClassNotFoundException
Class.forName( "java.util.ArrayList" );
}
}

Your thoughts about how to work around this limitation are welcome. In the 
meantime, the following less elegant syntax will work:

public  class   GenericMode>implements  
Aggregator>
{
public  static  final   class   IntMode extends GenericMode {}

   ...
}

create derby aggregate intMode for int external name 'GenericMode$IntMode';


Touches the following files:

-

A   java/engine/org/apache/derby/agg
A   java/engine/org/apache/derby/agg/Aggregator.java
A   java/engine/org/apache/derby/agg/build.xml
M   tools/javadoc/publishedapi.ant
M   java/engine/build.xml

Adds this interface to the public api. This is the interface which users 
implement in order to create a user-defined aggregate.

-

M   java/engine/org/apache/derby/impl/services/reflect/DatabaseClasses.java
A   
java/engine/org/apache/derby/impl/services/reflect/Java5ClassFactory.java
M   
java/engine/org/apache/derby/impl/services/reflect/ReflectClassesJava2.java
M   java/engine/org/apache/derby/impl/services/build.xml
M   java/engine/org/apache/derby/modules.properties
M   java/engine/org/apache/derby/iapi/services/build.xml
A   
java/engine/org/apache/derby/iapi/services/loader/Java5ClassInspector.java
M   java/engine/org/apache/derby/iapi/services/loader/ClassInspector.java

Adds a new implementation of the ClassFactory module, for use on JVMs which 
support generics. Adds the following new method to ClassInspector:

/**
 * Given an implementation of a parameterized class/interface, return
 * the actual concrete types of the parameters. Types are returned in the
 * order that they are declared by the parameterized class/interface.
 * So for instance, if the parameterized class is Map and the
 * implementation is HashMap, then the return value is
 * [ Integer.class, String.class ]. This method raises an exception if the
 * JVM does not support generics. May return null if type resolution fails.
 */
public Class[] getGenericParameterTypes( Class parameterizedType, Class 
implementation )
throws StandardException;

On CDC/FP this method raises an exception. On Java 5 and higher, this resolves 
the types of the generic variables. Fortunately, this type resolution is 
possible via the reflection classes. Unfortunately, getting at this information 
is far from straightforward.

-

M   java/engine/org/apache/derby/catalog/types/AggregateAliasInfo.java

Added some accessors to this metadata descriptor.

-

M   java/engine/org/apache/derby/impl/sql/compile/MethodCallNode.java
M   java/engine/org/apache/derby/impl/sql/compile/AggregateNode.java
M   java/engine/org/apache/derby/impl/sql/compile/JavaToSQLValueNode.java
A   
java/engine/org/apache/derby/impl/sql/compile/UserAggregateDefinition.java
M   java/engine/org/apache/derby/impl/sql/compile/JavaValueNode.java
M   java/engine/org/apache/derby/impl/sql/compile/AggregateDefinition.java
M   java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java

Bind-time logic for handling non-distinct user-defined aggregates in the SELECT 
list. These are the highlights:

1) JavaToSQLValueNode.bindExpression() and 
StaticMethod

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

2012-08-16 Thread Rick Hillegas (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-672:


Attachment: derby-672-01-aa-ddl.diff

Attaching derby-672-01-aa-ddl.diff. This patch adds CREATE and DROP ddl for 
user-defined aggregates, including dblook support and upgrade tests. I am 
running full regression tests now.

This patch adds support for the following two DDL statements:

CREATE DERBY AGGREGATE [ schemaName. ] SQL92Identifier
FOR ValueDataType
[ RETURNS ReturnDataType ]
EXTERNAL NAME ClassNameString

and

DROP DERBY AGGREGATE [ schemaName. ] SQL92Identifier RESTRICT

I have gone to some trouble to prevent name collisions between user-defined 
aggregates and 1-arg functions. That work may be useful when we address 
DERBY-5901.


Touches the following files:

--

M   java/engine/org/apache/derby/iapi/sql/depend/DependencyManager.java
M   java/engine/org/apache/derby/iapi/sql/dictionary/AliasDescriptor.java
M   java/engine/org/apache/derby/iapi/sql/dictionary/PermDescriptor.java
M   java/engine/org/apache/derby/iapi/services/io/RegisteredFormatIds.java
M   java/engine/org/apache/derby/iapi/services/io/StoredFormatIds.java
M   java/engine/org/apache/derby/catalog/AliasInfo.java
A   java/engine/org/apache/derby/catalog/types/AggregateAliasInfo.java
M   java/engine/org/apache/derby/impl/sql/catalog/SYSALIASESRowFactory.java

A user-defined aggregate is implemented as a kind of Java alias, like SQL 
routines and UDTs.

--

M   java/engine/org/apache/derby/impl/sql/compile/DropAliasNode.java
M   java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java
M   java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
M   
java/engine/org/apache/derby/impl/sql/execute/CreateAliasConstantAction.java

Actual DDL support. Introduces 2 new non-reserved keywords: DERBY and AGGREGATE.

--

M   java/tools/org/apache/derby/loc/toolsmessages.properties
M   java/engine/org/apache/derby/loc/messages.xml
M   java/shared/org/apache/derby/shared/common/reference/SQLState.java

New error messages introduced by the new DDL.

--

M   java/tools/org/apache/derby/tools/dblook.java
M   java/tools/org/apache/derby/impl/tools/dblook/DB_Alias.java

Tool support for re-creating aggregate DDL when dumping a database.

--

M   java/testing/org/apache/derbyTesting/junit/JDBC.java

Support for dropping aggregates when scouring out schemas inbetween regression 
test cases.

--

A   
java/testing/org/apache/derbyTesting/functionTests/tests/lang/UserDefinedAggregatesTest.java
M   
java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
M   
java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Changes10_10.java
M   
java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_makeDB_2.sql
M   
java/testing/org/apache/derbyTesting/functionTests/master/dblook_test_territory.out
M   
java/testing/org/apache/derbyTesting/functionTests/master/dblook_test.out

New regression tests for basic aggregate DDL, dblook, and upgrade.


> 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: derby-672-01-aa-ddl.diff, 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: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




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

2012-08-16 Thread Rick Hillegas (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-672:


Issue & fix info: Patch Available

> 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: derby-672-01-aa-ddl.diff, 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: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




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

2012-08-16 Thread Rick Hillegas (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-672:


Attachment: UserDefinedAggregates.html

Attaching 2nd rev of a functional spec for this issue. The chief change here is 
to clarify that user-defined aggregates live in the same namespace as 1-arg 
user-defined functions and to avoid widening the namespace issue identified by 
DERBY-5901.

> 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
> Attachments: 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: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




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

2012-07-18 Thread Rick Hillegas (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-672:


Attachment: UserDefinedAggregates.html

Attaching UserDefinedAggregates.html, the first rev of a functional spec for 
this feature.

> 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
> Attachments: 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: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




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

2006-01-23 Thread Mike Matrigali (JIRA)
 [ http://issues.apache.org/jira/browse/DERBY-672?page=all ]

Mike Matrigali updated DERBY-672:
-

Component: SQL

> Re-enable user defined aggregates
> -
>
>  Key: DERBY-672
>  URL: http://issues.apache.org/jira/browse/DERBY-672
>  Project: Derby
> Type: New Feature
>   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.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira