Author: jolee
Date: 2011-12-07 11:55:59 -0500 (Wed, 07 Dec 2011)
New Revision: 3722
Modified:
branches/7.6.x/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
Log:
https://issues.jboss.org/browse/TEIID-1862
Unit test to prevent regression of:
https://c.na7.visual.force.com/apex/Case_View?id=500A0000008T0Ck&sfdc...
Modified:
branches/7.6.x/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
===================================================================
---
branches/7.6.x/engine/src/test/java/org/teiid/query/processor/TestProcessor.java 2011-12-07
15:46:45 UTC (rev 3721)
+++
branches/7.6.x/engine/src/test/java/org/teiid/query/processor/TestProcessor.java 2011-12-07
16:55:59 UTC (rev 3722)
@@ -7653,5 +7653,35 @@
Arrays.asList(3)});
}
+ @Test public void testMultipleAliasInUnionAll(){
+ String sql = "SELECT enterprise_id FROM ( " +
+ "SELECT * FROM ( " +
+ " SELECT id, id AS display_id, 103 AS enterprise_id FROM ("
+
+ " SELECT 'x' as id, e1 FROM pm1.g1) AS nexted103) as
table103Source " +
+ "UNION ALL " +
+ "SELECT 'x', 'x' AS display_id, 101 AS
enterprise_id FROM (" +
+ " SELECT 'x', e1 FROM pm1.g1) AS nested101 " +
+ "UNION ALL " +
+ "SELECT 'x', 'x' AS display_id, 100 AS
enterprise_id FROM (" +
+ " SELECT 'x', e1 FROM pm1.g1) AS nested100) as
tableFrom1stSelect " +
+ "WHERE enterprise_id = 100";
+
+
+ // Create expected results - would expect these to be:
+ List[] expected = new List[] {
+ Arrays.asList(100)
+ };
+
+ // Construct data manager with data
+ HardcodedDataManager dataManager = new HardcodedDataManager();
+ dataManager.addData("SELECT 100 FROM pm1.g1 AS g_0", new List[]
{Arrays.asList(100)});
+
+ Command command = helpParse(sql);
+ ProcessorPlan plan = helpGetPlan(command, RealMetadataFactory.example1Cached(),
TestOptimizer.getGenericFinder(false));
+ // Run query
+ helpProcess(plan, dataManager, expected);
+
+ }
+
private static final boolean DEBUG = false;
}