[teiid-commits] teiid SVN: r4225 - in trunk/engine/src/main/java/org/teiid/query: processor/relational and 1 other directory.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Sun Jul 8 16:12:43 EDT 2012


Author: shawkins
Date: 2012-07-08 16:12:37 -0400 (Sun, 08 Jul 2012)
New Revision: 4225

Removed:
   trunk/engine/src/main/java/org/teiid/query/processor/relational/SourceNode.java
Modified:
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java
   trunk/engine/src/main/java/org/teiid/query/processor/relational/SelectNode.java
Log:
TEIID-2094 fix for projection issue

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java	2012-07-08 12:06:55 UTC (rev 4224)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java	2012-07-08 20:12:37 UTC (rev 4225)
@@ -398,6 +398,8 @@
 
 				SelectNode selnode = new SelectNode(getID());
 				selnode.setCriteria(crit);
+				//in case the parent was a source
+				selnode.setProjectedExpressions((List<Expression>) node.getProperty(NodeConstants.Info.PROJECT_COLS));
 				processNode = selnode;
                 
 				break;
@@ -489,19 +491,12 @@
 				if(symbolMap != null) {
 					PlanNode child = node.getLastChild();
 
-                    if (node.getParent().getType() == NodeConstants.Types.PROJECT 
-                    		&& node.getParent().getProperty(NodeConstants.Info.INTO_GROUP) != null) {
-                    	return null;
-                    }
-                	if (child.getType() == NodeConstants.Types.PROJECT) {
+                	if (child.getType() == NodeConstants.Types.PROJECT
+                			|| child.getType() == NodeConstants.Types.SELECT) {
                 		//update the project cols based upon the original output
                 		child.setProperty(NodeConstants.Info.PROJECT_COLS, child.getProperty(NodeConstants.Info.OUTPUT_COLS));
-                        child.setProperty(NodeConstants.Info.OUTPUT_COLS, node.getProperty(NodeConstants.Info.OUTPUT_COLS));
-                        return null;
                 	}
-                	//TODO: vet the other node types for how they project, specifically select/join/windowfunctionproject nodes cannot have their elements modified
-                    processNode = new SourceNode(getID());
-                    break;
+                    child.setProperty(NodeConstants.Info.OUTPUT_COLS, node.getProperty(NodeConstants.Info.OUTPUT_COLS));
 				}
 				return null;
     		case NodeConstants.Types.SET_OP:

Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/SelectNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/SelectNode.java	2012-07-08 12:06:55 UTC (rev 4224)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/SelectNode.java	2012-07-08 20:12:37 UTC (rev 4225)
@@ -39,15 +39,17 @@
 import org.teiid.query.processor.ProcessorDataManager;
 import org.teiid.query.sql.LanguageObject;
 import org.teiid.query.sql.lang.Criteria;
+import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.util.CommandContext;
 
 
 public class SelectNode extends SubqueryAwareRelationalNode {
 
 	private Criteria criteria;
+	private List<Expression> projectedExpressions;
     
     // Derived element lookup map
-    private Map elementMap; 
+    private Map<Expression, Integer> elementMap; 
     private int[] projectionIndexes;
 	
     // State if blocked on evaluating a criteria
@@ -77,6 +79,10 @@
 		return this.criteria;
 	}
 	
+	public void setProjectedExpressions(List<Expression> projectedExpressions) {
+		this.projectedExpressions = projectedExpressions;
+	}
+	
 	@Override
 	public void initialize(CommandContext context, BufferManager bufferManager,
 			ProcessorDataManager dataMgr) {
@@ -84,7 +90,7 @@
         // Create element lookup map for evaluating project expressions
         if(this.elementMap == null) {
             this.elementMap = createLookupMap(this.getChildren()[0].getElements());
-            this.projectionIndexes = getProjectionIndexes(this.elementMap, getElements());
+            this.projectionIndexes = getProjectionIndexes(this.elementMap, projectedExpressions!=null?projectedExpressions:getElements());
         }
 	}
 	
@@ -133,6 +139,7 @@
 		target.criteria = criteria;
 		target.elementMap = source.elementMap;
 		target.projectionIndexes = source.projectionIndexes;
+		target.projectedExpressions = source.projectedExpressions;
 	}
     
     public PlanNode getDescriptionProperties() {   

Deleted: trunk/engine/src/main/java/org/teiid/query/processor/relational/SourceNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/SourceNode.java	2012-07-08 12:06:55 UTC (rev 4224)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/SourceNode.java	2012-07-08 20:12:37 UTC (rev 4225)
@@ -1,50 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.query.processor.relational;
-
-import org.teiid.common.buffer.BlockedException;
-import org.teiid.common.buffer.TupleBatch;
-import org.teiid.core.TeiidComponentException;
-import org.teiid.core.TeiidProcessingException;
-
-public class SourceNode extends RelationalNode {
-	protected SourceNode() {
-	}
-	
-	public SourceNode(int id) {
-		super(id);
-	}
-	
-	@Override
-	protected TupleBatch nextBatchDirect() throws BlockedException,
-			TeiidComponentException, TeiidProcessingException {
-		return getChildren()[0].nextBatch();
-	}
-
-	@Override
-	public Object clone() {
-		SourceNode clone = new SourceNode();
-		clone.copy(this, clone);
-		return clone;
-	}
-}
\ No newline at end of file



More information about the teiid-commits mailing list