[teiid-commits] teiid SVN: r2704 - in branches/7.1.x/engine/src: test/java/org/teiid/query/processor and 1 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Thu Nov 4 12:42:14 EDT 2010


Author: shawkins
Date: 2010-11-04 12:42:13 -0400 (Thu, 04 Nov 2010)
New Revision: 2704

Modified:
   branches/7.1.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
   branches/7.1.x/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java
   branches/7.1.x/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java
Log:
TEIID-1348 fix for pk on a column other than the first

Modified: branches/7.1.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java	2010-11-03 21:35:27 UTC (rev 2703)
+++ branches/7.1.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java	2010-11-04 16:42:13 UTC (rev 2704)
@@ -489,7 +489,10 @@
 				}
 			}
 			
+			List<ElementSymbol> variables = table.getColumns();
+			
 			if (ts == null) {
+				variables = allColumns;
 				//TODO: coordinate a distributed load
 				//TODO: order by primary key nulls first - then have an insert ordered optimization
 				String transformation = metadata.getVirtualPlan(group.getMetadataID()).getQuery();
@@ -510,7 +513,7 @@
 			}
 			
 			//TODO: if this insert fails, it's unnecessary to do the undo processing
-			table.insert(ts, table.getColumns());
+			table.insert(ts, variables);
 			rowCount = table.getRowCount();
 			//TODO: could pre-process indexes to remove overlap
 			for (Object index : metadata.getIndexesInGroup(group.getMetadataID())) {

Modified: branches/7.1.x/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java
===================================================================
--- branches/7.1.x/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java	2010-11-03 21:35:27 UTC (rev 2703)
+++ branches/7.1.x/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java	2010-11-04 16:42:13 UTC (rev 2704)
@@ -145,5 +145,9 @@
 		execute("SELECT * from vgroup6 where y in ('zne', 'zwo') order by y desc", Arrays.asList("two", "zwo"), Arrays.asList("one", "zne"));
 		execute("SELECT * from vgroup6 where y is null", Arrays.asList((String)null, (String)null));
 	}
+	
+	@Test public void testPrimaryKeyOnOtherColumn() throws Exception {
+		execute("SELECT * from vgroup7 where y is null", Arrays.asList("1", null, 1));
+	}
     
 }

Modified: branches/7.1.x/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java
===================================================================
--- branches/7.1.x/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java	2010-11-03 21:35:27 UTC (rev 2703)
+++ branches/7.1.x/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java	2010-11-04 16:42:13 UTC (rev 2704)
@@ -385,6 +385,16 @@
         
         createKey(KeyRecord.Type.Index, "idx", vGroup6, vElements6.subList(1, 2));
         
+        //non-covering index
+        QueryNode vTrans7 = new QueryNode("VGroup7", "SELECT '1', 'z' || substring(x, 2) as y, 1 as z FROM matsrc");         //$NON-NLS-1$ //$NON-NLS-2$
+        Table vGroup7 = createVirtualGroup("VGroup7", virtModel, vTrans7); //$NON-NLS-1$
+        vGroup7.setMaterialized(true);
+        List<Column> vElements7 = createElements(vGroup7,
+                                      new String[] { "x", "y", "z" }, //$NON-NLS-1$
+                                      new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER});
+        
+        createKey(KeyRecord.Type.Primary, "pk", vGroup7, vElements7.subList(1, 2));
+        
         Schema sp = createVirtualModel("sp", metadataStore); //$NON-NLS-1$
         ColumnSet<Procedure> rs = createResultSet("sp1.vsprs1", new String[] { "StringKey" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
         ProcedureParameter param = createParameter("param1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$



More information about the teiid-commits mailing list