Author: shawkins
Date: 2010-02-09 15:03:49 -0500 (Tue, 09 Feb 2010)
New Revision: 1809
Modified:
trunk/engine/src/main/java/com/metamatrix/query/sql/lang/SetQuery.java
trunk/engine/src/test/java/com/metamatrix/query/resolver/TestResolver.java
Log:
TEIID-947 metadata calls against cloned set queries may return the wrong type
Modified: trunk/engine/src/main/java/com/metamatrix/query/sql/lang/SetQuery.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/sql/lang/SetQuery.java 2010-02-09
16:38:09 UTC (rev 1808)
+++ trunk/engine/src/main/java/com/metamatrix/query/sql/lang/SetQuery.java 2010-02-09
20:03:49 UTC (rev 1809)
@@ -180,6 +180,10 @@
if(this.getLimit() != null) {
copy.setLimit( (Limit) this.getLimit().clone() );
}
+
+ if (this.projectedTypes != null) {
+ copy.setProjectedTypes(new ArrayList<Class<?>>(projectedTypes));
+ }
return copy;
}
Modified: trunk/engine/src/test/java/com/metamatrix/query/resolver/TestResolver.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/resolver/TestResolver.java 2010-02-09
16:38:09 UTC (rev 1808)
+++ trunk/engine/src/test/java/com/metamatrix/query/resolver/TestResolver.java 2010-02-09
20:03:49 UTC (rev 1809)
@@ -2079,6 +2079,16 @@
assertEquals(DataTypeManager.DefaultDataClasses.INTEGER,
((SingleElementSymbol)command.getProjectedSymbols().get(0)).getType());
}
+ @Test public void testUnionQueryClone() throws Exception{
+ SetQuery command = (SetQuery)helpResolve("SELECT e2, e3 FROM pm1.g1 UNION
SELECT e3, e2 from pm1.g1"); //$NON-NLS-1$
+
+ assertEquals(DataTypeManager.DefaultDataClasses.INTEGER,
((SingleElementSymbol)command.getProjectedSymbols().get(1)).getType());
+
+ command = (SetQuery)command.clone();
+
+ assertEquals(DataTypeManager.DefaultDataClasses.INTEGER,
((SingleElementSymbol)command.getProjectedSymbols().get(1)).getType());
+ }
+
@Test public void testSelectIntoNoFrom() {
helpResolve("SELECT 'a', 19, {b'true'}, 13.999 INTO
pm1.g1"); //$NON-NLS-1$
}
Show replies by date