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

Rick Hillegas updated DERBY-4789:
---------------------------------

    Attachment: derby-4789-01-ab-alwaysForTableFunctions.diff

Attaching derby-4789-01-ab-alwaysForTableFunctions.diff. This patch enables the 
bulk-insert optimization when the source stream of an INSERT statement includes 
a table function. I am running regression tests now.

This patch does the following:

1) At the end of optimization of an INSERT statement, bulk-insert is turned on 
if a user-defined table function is found in the source stream of the INSERT.

2) No changes are made to bulk-insert itself. New conglomerates are created 
only if the target table is empty

The patch is tested using an INSERT from a table function and an INSERT from a 
view which wraps a table function. In both cases, bulk-insert occurs if the 
target table is empty.

Touches the following files:

------------

A      
java/engine/org/apache/derby/impl/sql/compile/HasTableFunctionVisitor.java
M      java/engine/org/apache/derby/impl/sql/compile/FromVTI.java
M      java/engine/org/apache/derby/impl/sql/compile/HasNodeVisitor.java

Creates a new Visitor which reports whether the AST contains a user-defined 
table function.


------------

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

Logic to support (1).


------------

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

New test cases.


> Always apply the bulk-insert optimization when inserting from a table 
> function.
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-4789
>                 URL: https://issues.apache.org/jira/browse/DERBY-4789
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>            Reporter: Rick Hillegas
>         Attachments: derby-4789-01-ab-alwaysForTableFunctions.diff
>
>
> Inserting from a table function is a lot like importing from a file:
> 1) Derby has limited visibility into the size of the external data source.
> 2) The user is often trying to import a large data set.
> The import procedures assume that Derby should always apply the bulk-insert 
> optimization when importing from a file. The same assumption seems reasonable 
> whenever a table function appears in the source stream of an INSERT.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to