teiid SVN: r2751 - in trunk/engine/src: test/java/org/teiid/query/optimizer and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-12-02 10:32:06 -0500 (Thu, 02 Dec 2010)
New Revision: 2751
Modified:
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java
trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java
Log:
TEIID-1381 fix for incorrect validation of insert commands
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java 2010-12-01 14:38:10 UTC (rev 2750)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java 2010-12-02 15:32:06 UTC (rev 2751)
@@ -588,7 +588,7 @@
}
}
- if (c == null && !container.getGroup().isTempGroupSymbol() &&
+ if (c == null && !(container instanceof Insert) && !container.getGroup().isTempGroupSymbol() &&
!CriteriaCapabilityValidatorVisitor.canPushLanguageObject(container, metadata.getModelID(container.getGroup().getMetadataID()), metadata, capFinder, analysisRecord)) {
throw new QueryPlannerException(QueryPlugin.Util.getString("RelationalPlanner.nonpushdown_command", container)); //$NON-NLS-1$
}
Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java 2010-12-01 14:38:10 UTC (rev 2750)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java 2010-12-02 15:32:06 UTC (rev 2751)
@@ -6368,6 +6368,22 @@
}
/**
+ * Ensure that the pushdown check doesn't fail
+ * @throws Exception
+ */
+ @Test public void testInsertQueryExpression1() throws Exception {
+ String sql = "insert into pm1.g1 (e1) select e1 || 1 from pm1.g2"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+
+ ProcessorPlan plan = helpPlan(sql, metadata, new String[] {"SELECT g_0.e1 FROM pm1.g2 AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+ //requires a txn, since an non pushdown/iterated insert is used
+ assertTrue(plan.requiresTransaction(false));
+
+ checkNodeTypes(plan, new int[] {1}, new Class[] {ProjectIntoNode.class});
+ }
+
+ /**
* previously the subqueries were being pushed too far and then not having the appropriate correlated references
*/
@Test public void testCorrelatedSubqueryOverJoin() {
14 years
teiid SVN: r2750 - in branches/7.1.x/engine/src: test/java/org/teiid/query/optimizer and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-12-01 09:38:10 -0500 (Wed, 01 Dec 2010)
New Revision: 2750
Modified:
branches/7.1.x/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java
branches/7.1.x/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java
Log:
TEIID-1381 fix for insert statement pushdown validation
Modified: branches/7.1.x/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java 2010-11-30 18:55:44 UTC (rev 2749)
+++ branches/7.1.x/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java 2010-12-01 14:38:10 UTC (rev 2750)
@@ -507,7 +507,7 @@
}
}
- if (c == null && !container.getGroup().isTempGroupSymbol() &&
+ if (c == null && !(container instanceof Insert) && !container.getGroup().isTempGroupSymbol() &&
!CriteriaCapabilityValidatorVisitor.canPushLanguageObject(container, metadata.getModelID(container.getGroup().getMetadataID()), metadata, capFinder, analysisRecord)) {
throw new QueryPlannerException(QueryPlugin.Util.getString("RelationalPlanner.nonpushdown_command", container)); //$NON-NLS-1$
}
Modified: branches/7.1.x/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java
===================================================================
--- branches/7.1.x/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java 2010-11-30 18:55:44 UTC (rev 2749)
+++ branches/7.1.x/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java 2010-12-01 14:38:10 UTC (rev 2750)
@@ -6364,6 +6364,22 @@
}
/**
+ * Ensure that the pushdown check doesn't fail
+ * @throws Exception
+ */
+ @Test public void testInsertQueryExpression1() throws Exception {
+ String sql = "insert into pm1.g1 (e1) select e1 || 1 from pm1.g2"; //$NON-NLS-1$
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+
+ ProcessorPlan plan = helpPlan(sql, metadata, new String[] {"SELECT g_0.e1 FROM pm1.g2 AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+ //requires a txn, since an non pushdown/iterated insert is used
+ assertTrue(plan.requiresTransaction(false));
+
+ checkNodeTypes(plan, new int[] {1}, new Class[] {ProjectIntoNode.class});
+ }
+
+ /**
* previously the subqueries were being pushed too far and then not having the appropriate correlated references
*/
@Test public void testCorrelatedSubqueryOverJoin() {
14 years