[
https://issues.apache.org/jira/browse/DERBY-716?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Rick Hillegas updated DERBY-716:
--------------------------------
Attachment: derby-716-01-basic-aa.diff
Attaching a patch which adds basic support for Derby-style Table Functions.
This patch allows you to declare user-defined Table Functions and to invoke
them in simple SELECT statements. I've included a JUnit test for this
functionality. The existing regression tests pass cleanly for me.
A description of the contents of this patch follows:
-----------------------------------------------------------
(1) Created a new datatype, RowMultiSetImpl, to represent the return type of a
Table Function.
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/iapi/types/TypeId.java
M java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java
M java/engine/org/apache/derby/iapi/types/DTSClassInfo.java
M java/engine/org/apache/derby/catalog/TypeDescriptor.java
A java/engine/org/apache/derby/catalog/types/RowMultiSetImpl.java
M java/engine/org/apache/derby/catalog/types/TypeDescriptorImpl.java
M java/engine/org/apache/derby/catalog/types/BaseTypeIdImpl.java
-----------------------------------------------------------
(2) Added new syntax for declaring Derby-style Table Functions.
M java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java
M java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
M java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java
Factored out the check for builtin VTIs so that the parser can know whether to
build nodes for a constructor-based VTI or a static-method-based VTI.
M java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
M java/engine/org/apache/derby/iapi/sql/dictionary/AliasDescriptor.java
M java/engine/org/apache/derby/catalog/types/RoutineAliasInfo.java
Parser support for Table Function DDL.
-----------------------------------------------------------
(3) Supported the invocation of Table Functions in simple SELECTs.
M java/engine/org/apache/derby/impl/sql/compile/MethodCallNode.java
M java/engine/org/apache/derby/impl/sql/compile/VTIDeferModPolicy.java
M java/engine/org/apache/derby/impl/sql/compile/NewInvocationNode.java
M java/engine/org/apache/derby/impl/sql/compile/FromVTI.java
Moved some bind() logic from NewInvocationNode into its superclass,
MethodCallNode. The previous scheme allowed the invocation of VTIs which are
constructors. The new scheme also allows the invocation of VTIs which are
static methods.
M java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
Factored out some code which builds ResultColumns. The newly factored-out
method is used to bind() the shape of the return value of a Table Function.
M java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java
Don't try to cast returned ResultSets.
M java/engine/org/apache/derby/iapi/sql/execute/ResultSetFactory.java
M
java/engine/org/apache/derby/impl/sql/execute/GenericResultSetFactory.java
M java/engine/org/apache/derby/impl/sql/execute/VTIResultSet.java
Accounted for the fact that the returned columns of Table Functions are
nullable according to the SQL standard.
-----------------------------------------------------------
(4) Added new error messages.
M java/engine/org/apache/derby/loc/messages.xml
M java/shared/org/apache/derby/shared/common/reference/SQLState.java
-----------------------------------------------------------
(5) Added a JUnit test for this functionality.
A
java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java
A
java/testing/org/apache/derbyTesting/functionTests/tests/lang/StringColumnVTI.java
M java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
M
java/testing/org/apache/derbyTesting/functionTests/tests/lang/SysDiagVTIMappingTest.java
A
java/testing/org/apache/derbyTesting/functionTests/tests/lang/StringArrayVTI.java
M java/testing/org/apache/derbyTesting/junit/BaseTestCase.java
> Re-enable VTIs
> --------------
>
> Key: DERBY-716
> URL: https://issues.apache.org/jira/browse/DERBY-716
> Project: Derby
> Issue Type: New Feature
> Components: SQL
> Reporter: Rick Hillegas
> Assignee: Rick Hillegas
> Attachments: derby-716-01-basic-aa.diff, functionTables.html,
> functionTables.html, functionTables.html
>
>
> Cloudscape used to expose Virtual Table Interfaces, by which any class which
> implemented ResultSet could be included in a query's FROM list. Derby still
> exposes a number of these VTIs as diagnostic tools. However, Derby now
> prevents customers from declaring their own VTIs. The parser raises an error
> if a VTI's package isn't one of the Derby diagnostic packages.
> This is a very powerful feature which customers can use to solve many
> problems. We should discuss the reasons that it was disabled and come up with
> a plan for putting this power back into our customers' hands.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.