[teiid-commits] teiid SVN: r3229 - branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Tue Jun 7 17:19:41 EDT 2011


Author: shawkins
Date: 2011-06-07 17:19:41 -0400 (Tue, 07 Jun 2011)
New Revision: 3229

Modified:
   branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestOptionalJoins.java
Log:
TEIID-1622 adding the unit test from 7.1.1

Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestOptionalJoins.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestOptionalJoins.java	2011-06-07 19:53:58 UTC (rev 3228)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestOptionalJoins.java	2011-06-07 21:19:41 UTC (rev 3229)
@@ -347,7 +347,7 @@
     }
     
     /**
-     * Union should prevent the removal from happening 
+     * Union all should not prevent the removal from happening 
      */
     @Test public void testOptionalJoinWithUnion() { 
         ProcessorPlan plan = TestOptimizer.helpPlan("select pm1.g2.e4 from /* optional */ pm1.g1 inner join pm1.g2 on pm1.g1.e1 = pm1.g2.e1 union all select convert(pm1.g2.e2, double) from /* optional */ pm1.g1 inner join pm1.g2 on pm1.g1.e1 = pm1.g2.e1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
@@ -371,6 +371,31 @@
         });    
     }
     
+    /**
+     * The first branch should have the join removed, but not the second branch
+     */
+    @Test public void testOptionalJoinWithUnion1() { 
+        ProcessorPlan plan = TestOptimizer.helpPlan("select e4 from (select e4, e2 from (select pm1.g2.e4, pm1.g1.e2 from /* optional */ pm1.g1 inner join pm1.g2 on pm1.g1.e1 = pm1.g2.e1) as x union all select e4, e2 from (select convert(pm2.g1.e2, double) as e4, pm2.g2.e2 from /* optional */ pm2.g1 inner join pm2.g2 on pm2.g1.e1 = pm2.g2.e1) as x) as y", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
+            new String[] {"SELECT pm1.g2.e4 FROM pm1.g2", "SELECT g_0.e2 FROM pm2.g1 AS g_0, pm2.g2 AS g_1 WHERE g_0.e1 = g_1.e1"} ); //$NON-NLS-1$ //$NON-NLS-2$
+
+        TestOptimizer.checkNodeTypes(plan, new int[] {
+            2,      // Access
+            0,      // DependentAccess
+            0,      // DependentSelect
+            0,      // DependentProject
+            0,      // DupRemove
+            0,      // Grouping
+            0,      // Join
+            0,      // MergeJoin
+            0,      // Null
+            0,      // PlanExecution
+            1,      // Project
+            0,      // Select
+            0,      // Sort
+            1       // UnionAll
+        });    
+    }
+    
     @Test public void testOptionalJoinWithCompoundCriteria() { 
         ProcessorPlan plan = TestOptimizer.helpPlan("SELECT length(z) FROM /* optional */ pm1.g1 inner join (select e2 as y, e3 || 'x' as z from pm1.g1 ORDER BY z) AS x on pm1.g1.e2=x.y and concat(x.y, x.z) = '1'", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
             new String[] {"SELECT e3 FROM pm1.g1"} ); //$NON-NLS-1$



More information about the teiid-commits mailing list