Author: shawkins
Date: 2011-11-11 15:22:49 -0500 (Fri, 11 Nov 2011)
New Revision: 3638
Modified:
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/plantree/PlanNode.java
trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java
Log:
TEIID-1823 fix for subquery evaluation in the passing clause
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 2011-11-11
19:53:20 UTC (rev 3637)
+++
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java 2011-11-11
20:22:49 UTC (rev 3638)
@@ -298,7 +298,7 @@
private void connectSubqueryContainers(PlanNode plan) throws QueryPlannerException,
QueryMetadataException, TeiidComponentException {
Set<GroupSymbol> groupSymbols = getGroupSymbols(plan);
- for (PlanNode node : NodeEditor.findAllNodes(plan, NodeConstants.Types.PROJECT |
NodeConstants.Types.SELECT | NodeConstants.Types.JOIN)) {
+ for (PlanNode node : NodeEditor.findAllNodes(plan, NodeConstants.Types.PROJECT |
NodeConstants.Types.SELECT | NodeConstants.Types.JOIN | NodeConstants.Types.SOURCE)) {
List<SubqueryContainer> subqueryContainers =
node.getSubqueryContainers();
if (subqueryContainers.isEmpty()){
continue;
Modified:
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/plantree/PlanNode.java
===================================================================
---
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/plantree/PlanNode.java 2011-11-11
19:53:20 UTC (rev 3637)
+++
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/plantree/PlanNode.java 2011-11-11
20:22:49 UTC (rev 3638)
@@ -38,6 +38,7 @@
import org.teiid.query.sql.LanguageObject;
import org.teiid.query.sql.lang.Criteria;
import org.teiid.query.sql.lang.SubqueryContainer;
+import org.teiid.query.sql.lang.TableFunctionReference;
import org.teiid.query.sql.symbol.ElementSymbol;
import org.teiid.query.sql.symbol.Expression;
import org.teiid.query.sql.symbol.GroupSymbol;
@@ -376,6 +377,13 @@
toSearch = (List<Criteria>)
this.getProperty(NodeConstants.Info.JOIN_CRITERIA);
break;
}
+ case NodeConstants.Types.SOURCE: {
+ TableFunctionReference tfr =
(TableFunctionReference)this.getProperty(NodeConstants.Info.TABLE_FUNCTION);
+ if (tfr != null) {
+ toSearch = Arrays.asList(tfr);
+ }
+ break;
+ }
}
return ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(toSearch);
}
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java
===================================================================
---
trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java 2011-11-11
19:53:20 UTC (rev 3637)
+++
trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java 2011-11-11
20:22:49 UTC (rev 3638)
@@ -193,6 +193,21 @@
process(sql, expected);
}
+ @Test public void testXmlTablePassingSubquery() throws Exception {
+ String sql = "select * from xmltable('/a/b' passing (SELECT
xmlelement(name a, xmlAgg(xmlelement(name b, e1))) from pm1.g1) columns val string path
'/.') as x"; //$NON-NLS-1$
+
+ List<?>[] expected = new List<?>[] {
+ Arrays.asList("a"),
+ Arrays.asList(""),
+ Arrays.asList("a"),
+ Arrays.asList("c"),
+ Arrays.asList("b"),
+ Arrays.asList("a")
+ };
+
+ process(sql, expected);
+ }
+
@Test public void testXmlTableInView() throws Exception {
String sql = "select * from g1"; //$NON-NLS-1$
Show replies by date