[teiid-commits] teiid SVN: r1125 - in trunk/engine/src: test/java/com/metamatrix/query/optimizer and 1 other directory.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Tue Jul 14 11:17:47 EDT 2009


Author: shawkins
Date: 2009-07-14 11:17:47 -0400 (Tue, 14 Jul 2009)
New Revision: 1125

Modified:
   trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleCollapseSource.java
   trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RulePlaceAccess.java
   trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestAccessPatterns.java
Log:
TEIID-717 fix for virtual access pattern validation with update commands.

Modified: trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleCollapseSource.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleCollapseSource.java	2009-07-14 13:58:11 UTC (rev 1124)
+++ trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleCollapseSource.java	2009-07-14 15:17:47 UTC (rev 1125)
@@ -81,13 +81,12 @@
             
             // Get nested non-relational plan if there is one
             ProcessorPlan nonRelationalPlan = FrameUtil.getNestedPlan(accessNode);
+    		Command command = FrameUtil.getNonQueryCommand(accessNode);
+
             if(nonRelationalPlan != null) {
                 accessNode.setProperty(NodeConstants.Info.PROCESSOR_PLAN, nonRelationalPlan);
-                    
             } else { 
                 // Create command from access on down and save in access node
-        		Command command = FrameUtil.getNonQueryCommand(accessNode);
-        		
                 if(command == null) {
                 	PlanNode commandRoot = accessNode;
                 	GroupSymbol intoGroup = (GroupSymbol)accessNode.getFirstChild().getProperty(NodeConstants.Info.INTO_GROUP);
@@ -103,9 +102,8 @@
                     	command = insertCommand;
                     }
                 } 
-        		accessNode.setProperty(NodeConstants.Info.ATOMIC_REQUEST, command);
             }
-    				
+    		accessNode.setProperty(NodeConstants.Info.ATOMIC_REQUEST, command);
     		accessNode.removeAllChildren();
         }
        				

Modified: trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RulePlaceAccess.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RulePlaceAccess.java	2009-07-14 13:58:11 UTC (rev 1124)
+++ trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RulePlaceAccess.java	2009-07-14 15:17:47 UTC (rev 1125)
@@ -25,8 +25,6 @@
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -46,7 +44,6 @@
 import com.metamatrix.query.optimizer.relational.plantree.NodeFactory;
 import com.metamatrix.query.optimizer.relational.plantree.PlanNode;
 import com.metamatrix.query.resolver.util.ResolverUtil;
-import com.metamatrix.query.sql.lang.Command;
 import com.metamatrix.query.sql.lang.Insert;
 import com.metamatrix.query.sql.symbol.ElementSymbol;
 import com.metamatrix.query.sql.symbol.Expression;

Modified: trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestAccessPatterns.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestAccessPatterns.java	2009-07-14 13:58:11 UTC (rev 1124)
+++ trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestAccessPatterns.java	2009-07-14 15:17:47 UTC (rev 1125)
@@ -41,10 +41,20 @@
         TestOptimizer.helpPlan(sql, TestValidator.exampleMetadata4(), new String[] {"SELECT test.\"group\".e0, test.\"group\".e2 FROM test.\"group\" WHERE (test.\"group\".e0 = 1) AND (test.\"group\".e1 = '2')"}); //$NON-NLS-1$
     }
 
+    public void testVirtualAccessPatternPassing1() {
+        String sql = "delete from vm1.g37 where e1 = 1"; //$NON-NLS-1$
+        TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), new String[] {});
+    }
+    
     public void testVirtualAccessPatternFailing() {
         String sql = "SELECT e0, e2 FROM vTest.vGroup2 where e0=1"; //$NON-NLS-1$
         TestOptimizer.helpPlan(sql, TestValidator.exampleMetadata4(), null, null, null, TestOptimizer.SHOULD_FAIL); 
     }
+    
+    public void testVirtualAccessPatternFailing1() {
+        String sql = "delete from vm1.g37"; //$NON-NLS-1$
+        TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), null, null, null, TestOptimizer.SHOULD_FAIL);
+    }
 
     public void testAccessPattern1() throws Exception {
         String sql = "SELECT e0, e2 FROM vTest.vGroup where e0=1 and e1='2'"; //$NON-NLS-1$




More information about the teiid-commits mailing list