You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by kr...@apache.org on 2009/11/16 15:27:13 UTC
svn commit: r880768 - in /db/derby/code/branches/10.4/java:
engine/org/apache/derby/impl/sql/execute/InsertResultSet.java
testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest2.java
Author: kristwaa
Date: Mon Nov 16 14:27:13 2009
New Revision: 880768
URL: http://svn.apache.org/viewvc?rev=880768&view=rev
Log:
DERBY-4435: Emptying index fails with NPE doing replacement import of empty file.
Merged fix from trunk (revision 834725).
Modified:
db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java
db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest2.java
Modified: db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java?rev=880768&r1=880767&r2=880768&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java (original)
+++ db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java Mon Nov 16 14:27:13 2009
@@ -2151,6 +2151,7 @@
ExecRow baseRows = null;
ColumnOrdering[][] ordering = new ColumnOrdering[numIndexes][];
int numColumns = td.getNumberOfColumns();
+ collation = new int[numIndexes][];
// Create the BitSet for mapping the partial row to the full row
FormatableBitSet bitSet = new FormatableBitSet(numColumns + 1);
@@ -2330,6 +2331,10 @@
properties.put("nKeyFields", Integer.toString(indexRowLength));
indexCC.close();
+
+ collation[index] =
+ constants.irgs[index].getColumnCollationIds(
+ td.getColumnDescriptorList());
// We can finally drain the sorter and rebuild the index
// Populate the index.
Modified: db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest2.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest2.java?rev=880768&r1=880767&r2=880768&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest2.java (original)
+++ db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest2.java Mon Nov 16 14:27:13 2009
@@ -737,6 +737,10 @@
ps.executeUpdate();
}
+ s.execute(
+ "CREATE TABLE EMPTY_TABLE (NAME VARCHAR(40))");
+ s.execute(
+ "CREATE INDEX EMPTY_TABLE_IDX ON EMPTY_TABLE(NAME)");
commit();
}
@@ -1128,6 +1132,7 @@
private void dropTable() throws SQLException
{
dropTable("CUSTOMER");
+ dropTable("EMPTY_TABLE");
}
private void runQueries(
@@ -1473,6 +1478,21 @@
setUpTable();
+ //DERBY-4435
+ String emptyFileName =
+ (SupportFilesSetup.getReadWrite("empty_file.dat")).getPath();
+ s.execute("DELETE FROM EMPTY_TABLE");
+ //there is no data in EMPTY_TABLE so empty_file.dat will be empty
+ //after export
+ doExportTable("APP", "EMPTY_TABLE", emptyFileName, null, null, "UTF-16");
+ commit();
+ // bulk insert with replace to empty table/one index from an empty file
+ // import empty_file.dat into EMPTY_TABLE
+ doImportTable(
+ "APP", "EMPTY_TABLE", emptyFileName, "|", "``", null, 1);
+
+ commit();
+
// export CUSTOMER date to names.dat
String fileName =
(SupportFilesSetup.getReadWrite("names.dat")).getPath();
@@ -1481,7 +1501,6 @@
commit();
-
// bulk insert to empty table, no indexes without replace
// (last arg 0 = no replace).
s.execute("DELETE FROM CUSTOMER");