[teiid-commits] teiid SVN: r2411 - in trunk: client/src/main/java/org/teiid/adminapi and 19 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Wed Aug 4 00:00:13 EDT 2010


Author: shawkins
Date: 2010-08-04 00:00:09 -0400 (Wed, 04 Aug 2010)
New Revision: 2411

Removed:
   trunk/engine/src/main/java/org/teiid/dqp/internal/process/CodeTableCache.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCodeTableCache.java
Modified:
   trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
   trunk/client/src/main/java/org/teiid/adminapi/Admin.java
   trunk/console/src/main/resources/META-INF/rhq-plugin.xml
   trunk/documentation/caching-guide/
   trunk/documentation/caching-guide/pom.xml
   trunk/engine/src/main/java/org/teiid/common/buffer/STree.java
   trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java
   trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
   trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java
   trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
   trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataAdapter.java
   trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataID.java
   trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java
   trunk/engine/src/main/java/org/teiid/query/processor/ProcessorDataManager.java
   trunk/engine/src/main/java/org/teiid/query/sql/lang/Query.java
   trunk/engine/src/main/java/org/teiid/query/tempdata/TempTable.java
   trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
   trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableStore.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestSessionAwareCache.java
   trunk/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java
   trunk/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestProcedureRelational.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
   trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java
   trunk/engine/src/test/java/org/teiid/query/processor/relational/TestBatchedUpdateNode.java
   trunk/engine/src/test/java/org/teiid/query/processor/relational/TestProjectIntoNode.java
   trunk/engine/src/test/java/org/teiid/query/processor/xml/TestXMLProcessor.java
   trunk/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java
   trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestXMLTypeTranslations.java
   trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
   trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestSystemVirtualModel.java
Log:
TEIID-168 minor updates to caching logic TEIID-829 changing code tables to use temp tables rather than being a separate cache

Modified: trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
===================================================================
--- trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml	2010-08-04 04:00:09 UTC (rev 2411)
@@ -78,12 +78,6 @@
         <property name="lobChunkSizeInKB">100</property>
         <!-- The maximum number of query plans that are cached. Note: this is a memory based cache. (default 250)  -->
         <property name="preparedPlanCacheMaxCount">250</property>
-        <!-- Maximum number of cached lookup tables. Note: this is a memory based cache and should be set to a value of at least 10 to accomidate system usage. (default 200) -->
-        <property name="codeTablesMaxCount">200</property>
-        <!-- Maximum number of records in a single lookup table (default 10000) -->
-        <property name="codeTablesMaxRowsPerTable">10000</property>
-        <!-- Maximum number of records in all lookup tables (default 200000) -->
-        <property name="codeTablesMaxRows">200000</property>
         <!-- Max Entries allowed for ResultSet Cache -->
         <property name="resultSetCacheMaxEntries">1024</property>
         <!-- Enable Resultset Caching -->

Modified: trunk/client/src/main/java/org/teiid/adminapi/Admin.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Admin.java	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/client/src/main/java/org/teiid/adminapi/Admin.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -29,7 +29,7 @@
 
 public interface Admin {
 
-	public enum Cache {CODE_TABLE_CACHE,PREPARED_PLAN_CACHE, QUERY_SERVICE_RESULT_SET_CACHE};
+	public enum Cache {PREPARED_PLAN_CACHE, QUERY_SERVICE_RESULT_SET_CACHE};
     
     /**
      * Assign a {@link Translator} and Data source to a {@link VDB}'s Model

Modified: trunk/console/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- trunk/console/src/main/resources/META-INF/rhq-plugin.xml	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/console/src/main/resources/META-INF/rhq-plugin.xml	2010-08-04 04:00:09 UTC (rev 2411)
@@ -267,10 +267,6 @@
 					displayName="Max Rows Fetch Size"
 					description="The maximum number of result set cache entries. 0 indicates no limit. (default 1024)"
 					required="false" readOnly="false" />
-				<c:simple-property name="codeTablesMaxRows"
-					displayName="Code Tables Max Rows"
-					description="Maximum number of records in all lookup tables (default 200000)"
-					required="false" readOnly="false" />
 				<c:simple-property name="processName" displayName="Process Name"
 					description="Name that uniquely identifies this process" required="false"
 					readOnly="false" />
@@ -289,18 +285,10 @@
 					displayName="Lob Chunk Size In KB"
 					description="The max lob chunk size in KB transferred each time when processing blobs, clobs(100KB default)"
 					required="false" readOnly="false" />
-				<c:simple-property name="codeTablesMaxCount"
-					displayName="Code Tables Max Count"
-					description="The max lob chunk size in KB transferred each time when processing blobs, clobs(100KB default)"
-					required="false" readOnly="false" />
 				<c:simple-property name="resultSetCacheEnabled"
 					displayName="Result Set Cache Enabled"
 					description="Denotes whether or not result set caching is enabled. (default true)"
 					required="false" readOnly="false" type="boolean" />
-				<c:simple-property name="codeTablesMaxRowsPerTable"
-					displayName="Code Tables Max Rows Per Table"
-					description="Maximum number of records in all lookup tables (default 200000)"
-					required="false" readOnly="false" />
 				<c:simple-property name="activeSessionsCount"
 					displayName="Active Session Count" description="Count of active sessions"
 					required="false" readOnly="false" />


Property changes on: trunk/documentation/caching-guide
___________________________________________________________________
Name: svn:ignore
   + target


Modified: trunk/documentation/caching-guide/pom.xml
===================================================================
--- trunk/documentation/caching-guide/pom.xml	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/documentation/caching-guide/pom.xml	2010-08-04 04:00:09 UTC (rev 2411)
@@ -46,7 +46,7 @@
             <format>
               <formatName>pdf</formatName>
               <stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
-              <finalName>caching_guide.pdf</finalName>
+              <finalName>teiid_caching_guide.pdf</finalName>
             </format>
             <!-- <format>
               <formatName>html_single</formatName>

Modified: trunk/engine/src/main/java/org/teiid/common/buffer/STree.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/STree.java	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/STree.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -56,6 +56,7 @@
     protected int keyLength;
     protected String[] types;
     protected String[] keytypes;
+    protected boolean preferMemory;
     
     protected ReentrantLock updateLock = new ReentrantLock();
     
@@ -351,4 +352,8 @@
 		return keyLength;
 	}
 	
+	public void setPreferMemory(boolean preferMemory) {
+		this.preferMemory = preferMemory;
+	}
+	
 }
\ No newline at end of file

Deleted: trunk/engine/src/main/java/org/teiid/dqp/internal/process/CodeTableCache.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/CodeTableCache.java	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/CodeTableCache.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -1,291 +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.dqp.internal.process;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.teiid.core.TeiidComponentException;
-import org.teiid.core.TeiidProcessingException;
-import org.teiid.core.util.HashCodeUtil;
-import org.teiid.dqp.DQPPlugin;
-import org.teiid.logging.LogManager;
-import org.teiid.query.util.CommandContext;
-import org.teiid.vdb.runtime.VDBKey;
-
-
-/**
- * Code table cache.  Heavily synchronized in-memory cache of code tables.  There is no purging policy for this cache.  Once the limits have been reached exceptions will occur.
- */
-class CodeTableCache {
-	
-	private static class CodeTable {
-		Map<Object, Object> codeMap;
-		Set<Object> waitingRequests = new HashSet<Object>();
-	}
-	
-    // Max number of code tables that can be loaded
-	private int maxCodeTables;
-	
-	// Max number of code records that can be loaded
-	private int maxCodeRecords;
-	
-	private int maxCodeTableRecords;
-	
-	private int rowCount;
-	
-    // Cache itself - key is CacheKey, value is Map (which is the key value -> return value for the code table)
-    private Map<CacheKey, CodeTable> codeTableCache = new HashMap<CacheKey, CodeTable>();
-
-    public enum CacheState {
-		CACHE_EXISTS,
-		CACHE_LOADING,
-		CACHE_NOT_EXIST,
-		CACHE_OVERLOAD
-    }
-    
-    /**
-     * Construct a code table cache 
-     */
-    public CodeTableCache(int maxCodeTables, int maxCodeRecords, int maxCodeTableRecords) {
-    	this.maxCodeRecords = maxCodeRecords;   
-    	this.maxCodeTables = maxCodeTables; 	    
-    	this.maxCodeTableRecords = maxCodeTableRecords;
-    }
-     
-    /**
-     * Return the state of cache.
-     * @param codeTable code table name
-     * @param returnElement return element name
-     * @param keyElement key element name
-     * @param context context in processing
-     * @param keyValye key value cached in data map
-     * @return int of cache states
-     */  
-    public synchronized CacheState cacheExists(String codeTable, String returnElement, String keyElement, CommandContext context) {
-        // Check whether CacheKey exist in cacheKeyDone:
-        // If yes, return CACHE_EXISTS         
-        // If no, does it exist in loadingCaches?
-        //   If yes, add to additional contexts and return CACHE_LOADING
-        //   If no, can we add another cache?
-        //     If yes, add to loadingCaches as primary context, return CACHE_NOT_EXIST
-        //     If no, return CACHE_OVERLOAD
-        
-        // Create a CacheKey
-        CacheKey cacheKey = new CacheKey(codeTable, returnElement, keyElement, context.getVdbName(), context.getVdbVersion());
-        CodeTable table = this.codeTableCache.get(cacheKey);
-        if (table == null) {
-        	if(codeTableCache.size() >= maxCodeTables) { 
-    			// In this case we already have some number of existing + loading caches
-    			// that are >= the max number we are allowed to have.  Thus, we cannot load
-    			// another cache.
-    			return CacheState.CACHE_OVERLOAD;
-    		}
-        	table = new CodeTable();
-        	table.waitingRequests.add(context.getProcessorID());
-        	this.codeTableCache.put(cacheKey, table);
-        	return CacheState.CACHE_NOT_EXIST;
-        }
-		if (table.waitingRequests == null) { // CacheKey exists in codeTableCache
-			return CacheState.CACHE_EXISTS;
-		}
-		// Add context to additional contexts
-		table.waitingRequests.add(context.getProcessorID());
-		return CacheState.CACHE_LOADING;
-	}
-
-    /**
-     * Set request ID for request key to cache key mapping. 
-     * <Map: requestKey(requestID, nodeID) --> cacheKey(codeTable, returnElement, keyElement) >
-     * @param codeTable Code table name
-     * @param returnElement Return element name
-     * @param keyElement Key element name
-     * @param requestID Request ID
-     * @param nodeID Plan Node ID
-     */
-    public CacheKey createCacheRequest(String codeTable, String returnElement, String keyElement, CommandContext context) {
-		return new CacheKey(codeTable, returnElement, keyElement, context.getVdbName(), context.getVdbVersion());
-    }
-    
-    /**
-     * Load all rows from the tuple source. Each row contains: keyElement and returnElement.
-     * @param requestID Part of RequestKey
-     * @param nodeID Part of RequestKey
-     * @param results QueryResults of <List<List<keyValue, returnValue>>
-     * @throws TeiidProcessingException 
-     */
-    public synchronized void loadTable(CacheKey cacheKey, List<List> records) throws TeiidProcessingException {
-		// Lookup the existing data  
-		// Map of data: keyValue --> returnValue;
-		CodeTable table = codeTableCache.get(cacheKey);
-		if(table.codeMap == null) {
-			table.codeMap = new HashMap<Object, Object>();
-		}
-		
-		// Determine whether the results should be added to code table cache
-    	// Depends on size of results and available memory and system parameters
-		int potentialSize = table.codeMap.size() + records.size();
-    	if (potentialSize > maxCodeTableRecords) {
-    		throw new TeiidProcessingException("ERR.018.005.0100", DQPPlugin.Util.getString("ERR.018.005.0100", "maxCodeTables")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$                  
-    	}
-    	
-    	if (potentialSize + rowCount > maxCodeRecords) {
-    		throw new TeiidProcessingException("ERR.018.005.0100", DQPPlugin.Util.getString("ERR.018.005.0100", "maxCodeTableRecords")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    	}
-		
-        // Add data: <List<List<keyValue, returnValue>> from results to the code table cache
-    	for (List<Object> record : records) {
-      		// each record or row
-      		Object keyValue = record.get(0);
-      		Object returnValue = record.get(1);
-      		Object existing = table.codeMap.put(keyValue, returnValue);
-      		if (existing != null) {
-      			throw new TeiidProcessingException(DQPPlugin.Util.getString("CodeTableCache.duplicate_key", cacheKey.getCodeTable(), cacheKey.getKeyElement(), keyValue)); //$NON-NLS-1$
-      		}
-      	}      	 
-    }
-    
-    /**
-     * Look up return value in code table cache given the key value.
-     * @param codeTable Code Table name
-     * @param returnElement Return element name
-     * @param keyElement Key element name
-     * @param keyValue Input key value
-     * @return Object of return value in code table cache
-     */ 
-    public synchronized Object lookupValue(String codeTable, String returnElement, String keyElement, Object keyValue, CommandContext context) throws TeiidComponentException {
-        // Create CacheKey
-        CacheKey cacheKey = new CacheKey(codeTable, returnElement, keyElement, context.getVdbName(), context.getVdbVersion());
-
-        // Find the corresponding data map in cache for the cache key
-        CodeTable table = codeTableCache.get(cacheKey);
-        if(table == null || table.codeMap == null) {
-            throw new TeiidComponentException(DQPPlugin.Util.getString("CodeTableCache.No_code_table", cacheKey.codeTable,cacheKey.keyElement,cacheKey.returnElement)); //$NON-NLS-1$
-        }
-		return table.codeMap.get(keyValue);
-    }
-   
-    /**
-     * Notifies the CodeTableCache that this code is done.  If the table had an error, it removes any temporary results.
-     * @return the set of waiting requests
-     */
-    public synchronized Set<Object> markCacheDone(CacheKey cacheKey, boolean success) {
-        if (!success) {
-            // Remove any results already cached
-            CodeTable table = codeTableCache.remove(cacheKey);
-            if (table != null) {
-            	return table.waitingRequests;
-            }
-            return null;
-        }
-    	CodeTable table = codeTableCache.get(cacheKey);
-    	if (table == null || table.codeMap == null) {
-    		return null; //can only happen if cache was cleared between load and now
-    	}
-        rowCount += table.codeMap.size();
-        Set<Object> waiting = table.waitingRequests;
-        table.waitingRequests = null;
-        return waiting;
-    }
-   
-    public synchronized void clearAll() {
-        // Look through the loaded caches and clear them - this is safe because
-        // these are done.  There is a window where cacheExists() can be called and
-        // return CACHE_EXISTS but then clearAll() could be called before lookValue()
-        // is called.  We accept this as a possibility such that this is a risk when
-        // clearing the cache - we need to throw an exception in this case to ensure the 
-        // query fails (rather than return the wrong result).
-        
-        // Walk through every key in the done cache and remove it 
-        int removedTables = 0;
-        int removedRecords = this.rowCount;
-        for (Iterator<CodeTable> iter = codeTableCache.values().iterator(); iter.hasNext();) {
-        	CodeTable table = iter.next();
-        	if (table.waitingRequests == null) {
-                removedTables++;
-                iter.remove();
-        	}
-        }
-        
-        // Clear the cacheKeyDone
-        this.rowCount = 0;
-        // Log status
-        LogManager.logInfo(org.teiid.logging.LogConstants.CTX_DQP, DQPPlugin.Util.getString("CodeTableCache.Cleared_code_tables", removedTables, removedRecords)); //$NON-NLS-1$
-    }
-        
-	/**
-	 * Cache Key consists: codeTable, returnElement and keyElement. 
-	 */
-    static class CacheKey {
-        private String codeTable;
-        private String returnElement;
-        private String keyElement;
-        private VDBKey vdbKey;
-        
-        private int hashCode;
-        
-        public CacheKey(String codeTable, String returnElement, String keyElement, String vdbName, int vdbVersion) {
-            this.codeTable = codeTable;
-            this.returnElement = returnElement;
-            this.keyElement = keyElement;
-            this.vdbKey = new VDBKey(vdbName, vdbVersion);
-            
-            // Compute hash code and cache it
-            hashCode = HashCodeUtil.hashCode(codeTable.toUpperCase().hashCode(), returnElement.toUpperCase(), 
-            		keyElement.toUpperCase(), vdbKey);
-        }
-        
-        public String getCodeTable() {
-        	return this.codeTable;
-        }
-        
-        public String getKeyElement() {
-        	return this.keyElement;	
-        }
-        
-        public int hashCode() {
-            return hashCode;
-        }
-        
-        public boolean equals(Object obj) {
-            if(this == obj) {
-                return true;                
-            }
-            if(obj instanceof CacheKey) {
-                CacheKey other = (CacheKey) obj;
-                
-                return (other.hashCode() == hashCode() &&
-                    this.codeTable.equalsIgnoreCase(other.codeTable) &&
-                    this.returnElement.equalsIgnoreCase(other.returnElement) && 
-                    this.keyElement.equalsIgnoreCase(other.keyElement) &&
-                    this.vdbKey.equals(other.vdbKey));
-            }
-            return false;
-        }
-    }
-   
-}

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -29,9 +29,6 @@
 public class DQPConfiguration{
 	
     //Constants
-    static final int DEFAULT_MAX_CODE_TABLE_RECORDS = 10000;
-    static final int DEFAULT_MAX_CODE_TABLES = 200;
-    static final int DEFAULT_MAX_CODE_RECORDS = 200000;
     static final int DEFAULT_FETCH_SIZE = RequestMessage.DEFAULT_FETCH_SIZE * 10;
     static final int DEFAULT_PROCESSOR_TIMESLICE = 2000;
     static final int DEFAULT_MAX_RESULTSET_CACHE_ENTRIES = 1024;
@@ -46,9 +43,6 @@
 	private int maxRowsFetchSize = DEFAULT_FETCH_SIZE;
 	private int lobChunkSizeInKB = 100;
 	private int preparedPlanCacheMaxCount = SessionAwareCache.DEFAULT_MAX_SIZE_TOTAL;
-	private int codeTablesMaxCount = DEFAULT_MAX_CODE_TABLES;
-	private int codeTablesMaxRowsPerTable = DEFAULT_MAX_CODE_TABLE_RECORDS;
-	private int codeTablesMaxRows = DEFAULT_MAX_CODE_RECORDS;
 	private boolean resultSetCacheEnabled = true;
 	private int maxResultSetCacheEntries = DQPConfiguration.DEFAULT_MAX_RESULTSET_CACHE_ENTRIES;
 	private boolean useEntitlements = false;
@@ -111,33 +105,6 @@
 		this.preparedPlanCacheMaxCount = preparedPlanCacheMaxCount;
 	}
 
-	@ManagementProperty(description="Maximum number of cached lookup tables. Note: this is a memory based cache. (default 200)")
-	public int getCodeTablesMaxCount() {
-		return this.codeTablesMaxCount;
-	}
-
-	public void setCodeTablesMaxCount(int codeTablesMaxCount) {
-		this.codeTablesMaxCount = codeTablesMaxCount;
-	}
-
-	@ManagementProperty(description="Maximum number of records in a single lookup table (default 10000)")
-	public int getCodeTablesMaxRowsPerTable() {
-		return codeTablesMaxRowsPerTable;
-	}
-
-	public void setCodeTablesMaxRowsPerTable(int codeTablesMaxRowsPerTable) {
-		this.codeTablesMaxRowsPerTable = codeTablesMaxRowsPerTable;
-	}
-
-	@ManagementProperty(description="Maximum number of records in all lookup tables (default 200000)")
-	public int getCodeTablesMaxRows() {
-		return this.codeTablesMaxRows;
-	}
-
-	public void setCodeTablesMaxRows(int codeTablesMaxRows) {
-		this.codeTablesMaxRows = codeTablesMaxRows;
-	}
-
 	@ManagementProperty(description="The maximum number of result set cache entries. 0 indicates no limit. (default 1024)")
 	public int getResultSetCacheMaxEntries() {
 		return this.maxResultSetCacheEntries;

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -176,11 +176,6 @@
 	
 	private ThreadReuseExecutor processWorkerPool;
     
-    // System properties for Code Table
-    private int maxCodeTableRecords = DQPConfiguration.DEFAULT_MAX_CODE_TABLE_RECORDS;
-    private int maxCodeTables = DQPConfiguration.DEFAULT_MAX_CODE_TABLES;
-    private int maxCodeRecords = DQPConfiguration.DEFAULT_MAX_CODE_RECORDS;
-    
     private int maxFetchSize = DQPConfiguration.DEFAULT_FETCH_SIZE;
     private int queryThreshold = DQPConfiguration.DEFAULT_QUERY_THRESHOLD;
     
@@ -541,11 +536,6 @@
         this.prepPlanCache.clearAll();
     }
 
-    private void clearCodeTableCache(){
-        LogManager.logInfo(LogConstants.CTX_DQP, DQPPlugin.Util.getString("DQPCore.Clearing_code_table_cache")); //$NON-NLS-1$
-        this.dataTierMgr.clearCodeTables();
-    }
-    
 	private void clearResultSetCache() {
 		//clear cache in server
 		if(rsCache != null){
@@ -556,7 +546,6 @@
 	
     public Collection<String> getCacheTypes(){
     	ArrayList<String> caches = new ArrayList<String>();
-    	caches.add(Admin.Cache.CODE_TABLE_CACHE.toString());
     	caches.add(Admin.Cache.PREPARED_PLAN_CACHE.toString());
     	caches.add(Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE.toString());
     	return caches;
@@ -565,9 +554,6 @@
 	public void clearCache(String cacheType) {
 		Admin.Cache cache = Admin.Cache.valueOf(cacheType);
 		switch (cache) {
-		case CODE_TABLE_CACHE:
-			clearCodeTableCache();
-			break;
 		case PREPARED_PLAN_CACHE:
 			clearPlanCache();
 			break;
@@ -636,9 +622,6 @@
 	public void start(DQPConfiguration config) {
 		this.processorTimeslice = config.getTimeSliceInMilli();
         this.maxFetchSize = config.getMaxRowsFetchSize();
-        this.maxCodeTableRecords = config.getCodeTablesMaxRowsPerTable();
-        this.maxCodeTables = config.getCodeTablesMaxCount();
-        this.maxCodeRecords = config.getCodeTablesMaxRows();
         this.useEntitlements = config.useEntitlements();
         this.queryThreshold = config.getQueryThresholdInSecs();
         this.maxSourceRows = config.getMaxSourceRows();
@@ -663,10 +646,7 @@
         
         dataTierMgr = new TempTableDataManager(new DataTierManagerImpl(this,
                                             this.connectorManagerRepository,
-                                            this.bufferService,
-                                            this.maxCodeTables,
-                                            this.maxCodeRecords,
-                                            this.maxCodeTableRecords), this.bufferManager); 
+                                            this.bufferService), this.bufferManager); 
 	}
 	
 	public void setBufferService(BufferService service) {

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -26,7 +26,6 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
@@ -37,7 +36,6 @@
 import org.teiid.client.RequestMessage;
 import org.teiid.client.util.ResultsFuture;
 import org.teiid.common.buffer.BlockedException;
-import org.teiid.common.buffer.TupleBatch;
 import org.teiid.common.buffer.TupleSource;
 import org.teiid.core.CoreConstants;
 import org.teiid.core.TeiidComponentException;
@@ -53,11 +51,9 @@
 import org.teiid.dqp.internal.datamgr.ConnectorManager;
 import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
 import org.teiid.dqp.internal.datamgr.ConnectorWork;
-import org.teiid.dqp.internal.process.CodeTableCache.CacheKey;
 import org.teiid.dqp.message.AtomicRequestMessage;
 import org.teiid.dqp.message.RequestID;
 import org.teiid.dqp.service.BufferService;
-import org.teiid.language.SQLConstants.Reserved;
 import org.teiid.metadata.AbstractMetadataRecord;
 import org.teiid.metadata.Column;
 import org.teiid.metadata.Datatype;
@@ -71,7 +67,6 @@
 import org.teiid.query.metadata.TransformationMetadata;
 import org.teiid.query.processor.CollectionTupleSource;
 import org.teiid.query.processor.ProcessorDataManager;
-import org.teiid.query.processor.QueryProcessor;
 import org.teiid.query.sql.lang.Command;
 import org.teiid.query.sql.lang.Query;
 import org.teiid.query.sql.lang.StoredProcedure;
@@ -112,14 +107,10 @@
     private BufferService bufferService;
     private ConnectorManagerRepository connectorManagerRepository;
 
-	// Processor state
-    private CodeTableCache codeTableCache;
-    
-    public DataTierManagerImpl(DQPCore requestMgr, ConnectorManagerRepository connectorRepo, BufferService bufferService, int maxCodeTables, int maxCodeRecords, int maxCodeTableRecords) {
+    public DataTierManagerImpl(DQPCore requestMgr, ConnectorManagerRepository connectorRepo, BufferService bufferService) {
 		this.requestMgr = requestMgr;
         this.connectorManagerRepository = connectorRepo;
         this.bufferService = bufferService;
-        this.codeTableCache = new CodeTableCache(maxCodeTables, maxCodeRecords, maxCodeTableRecords);
 	}
     
     private ConnectorManager getCM(String connectorName) {
@@ -353,22 +344,6 @@
 		return aqr;
 	}
 	
-    /** 
-     * Notify each waiting request that the code table data is now available.
-     * @param requests
-     * @since 4.2
-     */
-    private void notifyWaitingCodeTableRequests(Collection requests) {
-        if (requests != null) {
-            for (Iterator reqIter = requests.iterator(); reqIter.hasNext();) {
-                RequestWorkItem workItem = requestMgr.safeGetWorkItem(reqIter.next());
-                if (workItem != null) {
-                	workItem.moreWork();
-                }
-            }
-        }
-    }        
-    
     public Object lookupCodeValue(
         CommandContext context,
         String codeTableName,
@@ -376,52 +351,9 @@
         String keyElementName,
         Object keyValue)
         throws BlockedException, TeiidComponentException, TeiidProcessingException {
-
-        switch (this.codeTableCache.cacheExists(codeTableName, returnElementName, keyElementName, context)) {
-        	case CACHE_NOT_EXIST:
-	        	registerCodeTableRequest(context, codeTableName, returnElementName, keyElementName);
-        	case CACHE_EXISTS:
-	        	return this.codeTableCache.lookupValue(codeTableName, returnElementName, keyElementName, keyValue, context);
-	        case CACHE_OVERLOAD:
-	        	throw new TeiidProcessingException("ERR.018.005.0100", DQPPlugin.Util.getString("ERR.018.005.0100", "maxCodeTables")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-	        default:
-	            throw BlockedException.INSTANCE;
-        }
+    	throw new UnsupportedOperationException();
     }
 
-    void registerCodeTableRequest(
-        final CommandContext context,
-        final String codeTableName,
-        String returnElementName,
-        String keyElementName)
-        throws TeiidComponentException, TeiidProcessingException {
-
-        String query = Reserved.SELECT + ' ' + keyElementName + " ," + returnElementName + ' ' + Reserved.FROM + ' ' + codeTableName; //$NON-NLS-1$ 
-        
-        final CacheKey codeRequestId = this.codeTableCache.createCacheRequest(codeTableName, returnElementName, keyElementName, context);
-
-        boolean success = false;
-        try {
-        	QueryProcessor processor = context.getQueryProcessorFactory().createQueryProcessor(query, codeTableName.toUpperCase(), context);
-        	processor.setNonBlocking(true); //process lookup as fully blocking
-            while (true) {
-            	TupleBatch batch = processor.nextBatch();
-            	codeTableCache.loadTable(codeRequestId, batch.getTuples());	
-            	if (batch.getTerminationFlag()) {
-            		break;
-            	}
-            }
-        	success = true;
-        } finally {
-        	Collection requests = codeTableCache.markCacheDone(codeRequestId, success);
-        	notifyWaitingCodeTableRequests(requests);
-        }
-    }
-
-    public void clearCodeTables() {
-        this.codeTableCache.clearAll();
-    }
-    
     <T> ResultsFuture<T> addWork(Callable<T> callable, int priority) {
     	return requestMgr.addWork(callable, priority);
     }

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -36,6 +36,7 @@
 import org.teiid.common.buffer.BufferManager;
 import org.teiid.core.util.EquivalenceUtil;
 import org.teiid.core.util.HashCodeUtil;
+import org.teiid.query.function.metadata.FunctionMethod;
 import org.teiid.query.parser.ParseInfo;
 import org.teiid.vdb.runtime.VDBKey;
 
@@ -115,12 +116,12 @@
 	/**
 	 * Create PreparedPlan for the given clientConn and SQl query
 	 */
-	public void put(CacheID id, boolean sessionSpecific, boolean userSpecific, T t){
+	public void put(CacheID id, int determinismLevel, T t){
 		if (!id.cachable) {
 			return;
 		}
 		
-		if (sessionSpecific) {
+		if (determinismLevel >= FunctionMethod.SESSION_DETERMINISTIC) {
 			id.setSessionId(id.originalSessionId);
 			this.localCache.put(id, t);
 		} 
@@ -130,7 +131,7 @@
 			
 			id.setSessionId(null);
 			
-			if (userSpecific) {
+			if (determinismLevel == FunctionMethod.USER_DETERMINISTIC) {
 				id.setUserName(id.originalUserName);
 			}
 			else {

Modified: trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataAdapter.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataAdapter.java	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataAdapter.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -250,7 +250,7 @@
         }
         
         if(groupID instanceof TempMetadataID && !(actualMetadata instanceof TempMetadataAdapter)) {
-            return null;
+        	return ((TempMetadataID)groupID).getQueryNode();
         }            
    		return this.actualMetadata.getVirtualPlan(groupID);
 	}

Modified: trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataID.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataID.java	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataID.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -28,6 +28,7 @@
 import java.util.List;
 
 import org.teiid.core.util.LRUCache;
+import org.teiid.query.mapping.relational.QueryNode;
 
 
 /**
@@ -53,6 +54,7 @@
     private LRUCache<Object, Object> localCache;
     private boolean scalarGroup;
     private List<TempMetadataID> primaryKey;
+    private QueryNode queryNode;
     
     /**
      * Constructor for group form of metadata ID.
@@ -268,5 +270,13 @@
 	public void setPosition(int position) {
 		this.position = position;
 	}
+	
+	public QueryNode getQueryNode() {
+		return queryNode;
+	}
+	
+	public void setQueryNode(QueryNode queryNode) {
+		this.queryNode = queryNode;
+	}
 		
 }

Modified: trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -170,7 +170,7 @@
 		if (columnIndex == -1) {
 			throw new QueryMetadataException(elementName+TransformationMetadata.NOT_EXISTS_MESSAGE);
 		}
-		Table table = this.store.findGroup(elementName.substring(0, columnIndex));
+		Table table = this.store.findGroup(elementName.substring(0, columnIndex).toLowerCase());
 		String shortElementName = elementName.substring(columnIndex + 1);
 		for (Column column : (List<Column>)getElementIDsInGroupID(table)) {
 			if (column.getName().equalsIgnoreCase(shortElementName)) {

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-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -96,6 +96,7 @@
 import org.teiid.query.sql.symbol.AllSymbol;
 import org.teiid.query.sql.symbol.GroupSymbol;
 import org.teiid.query.sql.symbol.Reference;
+import org.teiid.query.sql.symbol.SelectSymbol;
 import org.teiid.query.sql.symbol.SingleElementSymbol;
 import org.teiid.query.sql.util.SymbolMap;
 import org.teiid.query.sql.visitor.AggregateSymbolCollectorVisitor;
@@ -912,36 +913,7 @@
         	boolean isGlobal = matMetadataId == null;
             if (isGlobal) {
         		matTableName = MAT_PREFIX + groupName;
-        		TempMetadataStore store = context.getGlobalTableStore().getMetadataStore();
-        		TempMetadataID id = store.getTempGroupID(matTableName);
-        		//define the table preserving the primary key
-        		if (id == null) {
-        			synchronized (store) {
-        				id = store.getTempGroupID(matTableName);
-        				if (id == null) {
-		        			//this is really just temporary and will be replaced by the real table
-							id = store.addTempGroup(matTableName, ResolverUtil.resolveElementsInGroup(virtualGroup, metadata), false, true);
-							
-							id.setCardinality(metadata.getCardinality(metadataID));
-							
-							Object pk = metadata.getPrimaryKey(virtualGroup.getMetadataID());
-							//primary key
-							if (pk != null) {
-								List cols = metadata.getElementIDsInKey(pk);
-								ArrayList<TempMetadataID> primaryKey = new ArrayList<TempMetadataID>(cols.size());
-								for (Object coldId : cols) {
-									int pos = metadata.getPosition(coldId) - 1;
-									primaryKey.add(id.getElements().get(pos));
-								}
-								id.setPrimaryKey(primaryKey);
-							}
-							//version column?
-							
-							//add timestamp?
-        				}
-        			}
-        		}
-				matMetadataId = id;
+        		matMetadataId = getGlobalTempTableMetadataId(virtualGroup, matTableName);
             } else {
             	matTableName = metadata.getFullName(matMetadataId);
             }
@@ -953,12 +925,7 @@
         		recordMaterializationTableAnnotation(virtualGroup, analysisRecord, matTableName, "SimpleQueryResolver.materialized_table_not_used"); //$NON-NLS-1$
         	}else{
         		qnode = new QueryNode(groupName, null);
-        		Query query = new Query();
-        		query.setSelect(new Select(Arrays.asList(new AllSymbol())));
-        		GroupSymbol gs = new GroupSymbol(matTableName);
-        		gs.setGlobalTable(isGlobal);
-        		gs.setMetadataID(matMetadataId);
-        		query.setFrom(new From(Arrays.asList(new UnaryFromClause(gs))));
+        		Query query = createMatViewQuery(matMetadataId, matTableName, Arrays.asList(new AllSymbol()), isGlobal);
         		qnode.setCommand(query);
                 cacheString = "matview"; //$NON-NLS-1$
                 recordMaterializationTableAnnotation(virtualGroup, analysisRecord, matTableName, "SimpleQueryResolver.Query_was_redirected_to_Mat_table"); //$NON-NLS-1$                
@@ -971,7 +938,51 @@
         Command result = getCommand(virtualGroup, qnode, cacheString, metadata);   
         return QueryRewriter.rewrite(result, metadata, context);
     }
+    
+	public static Query createMatViewQuery(Object matMetadataId, String matTableName, List<? extends SelectSymbol> select, boolean isGlobal) {
+		Query query = new Query();
+		query.setSelect(new Select(select));
+		GroupSymbol gs = new GroupSymbol(matTableName);
+		gs.setGlobalTable(isGlobal);
+		gs.setMetadataID(matMetadataId);
+		query.setFrom(new From(Arrays.asList(new UnaryFromClause(gs))));
+		return query;
+	}
 
+	private Object getGlobalTempTableMetadataId(GroupSymbol table, String matTableName)
+			throws QueryMetadataException, TeiidComponentException {
+		TempMetadataStore store = context.getGlobalTableStore().getMetadataStore();
+		TempMetadataID id = store.getTempGroupID(matTableName);
+		//define the table preserving the primary key
+		if (id == null) {
+			synchronized (store) {
+				id = store.getTempGroupID(matTableName);
+				if (id == null) {
+					//this is really just temporary and will be replaced by the real table
+					id = store.addTempGroup(matTableName, ResolverUtil.resolveElementsInGroup(table, metadata), false, true);
+					id.setQueryNode(metadata.getVirtualPlan(table.getMetadataID()));
+					id.setCardinality(metadata.getCardinality(table.getMetadataID()));
+					
+					Object pk = metadata.getPrimaryKey(table.getMetadataID());
+					//primary key
+					if (pk != null) {
+						List cols = metadata.getElementIDsInKey(pk);
+						ArrayList<TempMetadataID> primaryKey = new ArrayList<TempMetadataID>(cols.size());
+						for (Object coldId : cols) {
+							int pos = metadata.getPosition(coldId) - 1;
+							primaryKey.add(id.getElements().get(pos));
+						}
+						id.setPrimaryKey(primaryKey);
+					}
+					//version column?
+					
+					//add timestamp?
+				}
+			}
+		}
+		return id;
+	}
+
 	private Command getCommand(GroupSymbol virtualGroup, QueryNode qnode,
 			String cacheString, QueryMetadataInterface qmi) throws TeiidComponentException,
 			QueryMetadataException, QueryResolverException,

Modified: trunk/engine/src/main/java/org/teiid/query/processor/ProcessorDataManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/ProcessorDataManager.java	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/main/java/org/teiid/query/processor/ProcessorDataManager.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -47,6 +47,5 @@
                                            String keyElementName,
                                            Object keyValue) throws BlockedException,
                                                            TeiidComponentException, TeiidProcessingException;
-    
-    void clearCodeTables();
+
 }

Modified: trunk/engine/src/main/java/org/teiid/query/sql/lang/Query.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/lang/Query.java	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/Query.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -24,15 +24,14 @@
 
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.List;
 
 import org.teiid.core.types.DataTypeManager;
 import org.teiid.core.util.EquivalenceUtil;
 import org.teiid.core.util.HashCodeUtil;
+import org.teiid.query.sql.LanguageObject;
 import org.teiid.query.sql.LanguageVisitor;
 import org.teiid.query.sql.symbol.ElementSymbol;
-import org.teiid.query.sql.symbol.SelectSymbol;
 import org.teiid.query.sql.symbol.SingleElementSymbol;
 
 /**
@@ -75,7 +74,7 @@
     private Into into;
     
     /** xml projected symbols */
-    private List selectList;
+    private List<SingleElementSymbol> selectList;
 	
     // =========================================================================
     //                         C O N S T R U C T O R S
@@ -291,7 +290,7 @@
 	 * single column.
 	 * @return Ordered list of SingleElementSymbol
 	 */
-	public List getProjectedSymbols() {
+	public List<SingleElementSymbol> getProjectedSymbols() {
 		if (!getIsXML()) {
 			if(getSelect() != null) { 
                 if(getInto() != null){
@@ -300,10 +299,10 @@
                 }
 				return getSelect().getProjectedSymbols();
 			}
-			return Collections.EMPTY_LIST;
+			return Collections.emptyList();
 		}
 		if(selectList == null){
-			selectList = new ArrayList(1);
+			selectList = new ArrayList<SingleElementSymbol>(1);
 			ElementSymbol xmlElement = new ElementSymbol("xml"); //$NON-NLS-1$
 	        xmlElement.setType(DataTypeManager.DefaultDataClasses.XML);
 			selectList.add(xmlElement);
@@ -343,7 +342,7 @@
 		}	
 
         if(getOrderBy() != null) {
-            copy.setOrderBy( (OrderBy) getOrderBy().clone());
+            copy.setOrderBy(getOrderBy().clone());
         }
 
         if(getLimit() != null) {
@@ -354,11 +353,7 @@
         copy.setIsXML(getIsXML());
         
         if(selectList != null){
-        	copy.selectList = new ArrayList();
-            Iterator iter = selectList.iterator();
-            while(iter.hasNext()) {
-            	copy.selectList.add(((SelectSymbol)iter.next()).clone());
-            }
+        	copy.selectList = LanguageObject.Util.deepClone(selectList, SingleElementSymbol.class);
         }
         
         if (into != null) {

Modified: trunk/engine/src/main/java/org/teiid/query/tempdata/TempTable.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/tempdata/TempTable.java	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/main/java/org/teiid/query/tempdata/TempTable.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -216,6 +216,7 @@
 				bm.releaseBuffers(reserved);
 				try {
 					if (!success) {
+						undoLog.setFinal(true);
 						TupleSource undoTs = undoLog.createIndexedTupleSource();
 						List<?> tuple = null;
 						while ((tuple = undoTs.nextTuple()) != null) {
@@ -530,5 +531,9 @@
 			throw new AssertionError("Update failed"); //$NON-NLS-1$
 		}
 	}
+	
+	void setPreferMemory(boolean preferMemory) {
+		this.tree.setPreferMemory(preferMemory);
+	}
 
 }
\ No newline at end of file

Modified: trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -34,9 +34,13 @@
 import org.teiid.common.buffer.TupleSource;
 import org.teiid.core.TeiidComponentException;
 import org.teiid.core.TeiidProcessingException;
+import org.teiid.core.types.DataTypeManager;
+import org.teiid.language.SQLConstants.Reserved;
 import org.teiid.query.eval.Evaluator;
 import org.teiid.query.execution.QueryExecPlugin;
+import org.teiid.query.mapping.relational.QueryNode;
 import org.teiid.query.metadata.QueryMetadataInterface;
+import org.teiid.query.metadata.TempMetadataID;
 import org.teiid.query.optimizer.relational.RelationalPlanner;
 import org.teiid.query.processor.BatchCollector;
 import org.teiid.query.processor.CollectionTupleSource;
@@ -44,6 +48,7 @@
 import org.teiid.query.processor.QueryProcessor;
 import org.teiid.query.resolver.util.ResolverUtil;
 import org.teiid.query.sql.lang.Command;
+import org.teiid.query.sql.lang.CompareCriteria;
 import org.teiid.query.sql.lang.Create;
 import org.teiid.query.sql.lang.Criteria;
 import org.teiid.query.sql.lang.Delete;
@@ -53,6 +58,7 @@
 import org.teiid.query.sql.lang.Query;
 import org.teiid.query.sql.lang.Update;
 import org.teiid.query.sql.navigator.PostOrderNavigator;
+import org.teiid.query.sql.symbol.Constant;
 import org.teiid.query.sql.symbol.ElementSymbol;
 import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.symbol.GroupSymbol;
@@ -61,15 +67,13 @@
 import org.teiid.query.tempdata.TempTableStore.MatTableInfo;
 import org.teiid.query.util.CommandContext;
 
-
 /**
  * This proxy ProcessorDataManager is used to handle temporary tables.
  */
 public class TempTableDataManager implements ProcessorDataManager {
 	
-
-
-    private ProcessorDataManager processorDataManager;
+    private static final String CODE_PREFIX = "#CODE_"; //$NON-NLS-1$
+	private ProcessorDataManager processorDataManager;
     private BufferManager bufferManager;
 
     /**
@@ -104,7 +108,7 @@
     	TempTableStore contextStore = context.getTempTableStore();
         if (command instanceof Query) {
             Query query = (Query)command;
-            return registerQuery(context, command, contextStore, query);
+            return registerQuery(context, contextStore, query);
         }
         if (command instanceof ProcedureContainer) {
         	GroupSymbol group = ((ProcedureContainer)command).getGroup();
@@ -158,7 +162,7 @@
         return null;
     }
 
-	private TupleSource registerQuery(CommandContext context, Command command,
+	private TupleSource registerQuery(CommandContext context,
 			TempTableStore contextStore, Query query)
 			throws TeiidComponentException, QueryMetadataException,
 			TeiidProcessingException, ExpressionEvaluationException,
@@ -185,13 +189,13 @@
 					}
 				}
 				table = tts.addTempTable(tableName, create, bufferManager);
+				table.setPreferMemory(tableName.startsWith(CODE_PREFIX));
 				boolean success = false;
 				try {
-					String actualViewName = tableName.substring(RelationalPlanner.MAT_PREFIX.length());
-					Object id = metadata.getGroupID(actualViewName);
 					//TODO: order by primary key nulls first - then have an insert ordered optimization
-					String transformation = metadata.getVirtualPlan(id).getQuery();
-		    		QueryProcessor qp = context.getQueryProcessorFactory().createQueryProcessor(transformation, actualViewName, context);
+					//TODO: use the getCommand logic in RelationalPlanner to reuse commands for this.
+					String transformation = metadata.getVirtualPlan(group.getMetadataID()).getQuery();
+		    		QueryProcessor qp = context.getQueryProcessorFactory().createQueryProcessor(transformation, group.getCanonicalName(), context);
 		    		qp.setNonBlocking(true);
 		    		TupleSource ts = new BatchCollector.BatchProducerTupleSource(qp);
 		    		//TODO: if this insert fails, it's unnecessary to do the undo processing
@@ -199,16 +203,15 @@
 		    		success = true;
 				} finally {
 					if (!success) {
-						table.remove();
 						tts.removeTempTableByName(tableName);
 					}
 					info.setState(success?MatState.LOADED:MatState.FAILED_LOAD);
 				}
 			} else {
-				table = tts.getOrCreateTempTable(tableName, command, bufferManager, false);
+				table = tts.getOrCreateTempTable(tableName, query, bufferManager, false);
 			}
 		} else {
-			table = contextStore.getOrCreateTempTable(tableName, command, bufferManager, true);
+			table = contextStore.getOrCreateTempTable(tableName, query, bufferManager, true);
 		}
 		//convert to the actual table symbols (this is typically handled by the languagebridgefactory
 		ExpressionMappingVisitor emv = new ExpressionMappingVisitor(null) {
@@ -222,23 +225,38 @@
 			}
 		};
 		PostOrderNavigator.doVisit(query, emv);
-		return table.createTupleSource(command.getProjectedSymbols(), query.getCriteria(), query.getOrderBy());
+		return table.createTupleSource(query.getProjectedSymbols(), query.getCriteria(), query.getOrderBy());
 	}
 
-    public Object lookupCodeValue(
-        CommandContext context,
-        String codeTableName,
-        String returnElementName,
-        String keyElementName,
-        Object keyValue)
-        throws BlockedException, TeiidComponentException, TeiidProcessingException {
-            
-        return this.processorDataManager.lookupCodeValue(context, codeTableName, returnElementName, keyElementName, keyValue);
+	public Object lookupCodeValue(CommandContext context, String codeTableName,
+			String returnElementName, String keyElementName, Object keyValue)
+			throws BlockedException, TeiidComponentException,
+			TeiidProcessingException {
+    	ElementSymbol keyElement = new ElementSymbol(keyElementName);
+    	ElementSymbol returnElement = new ElementSymbol(returnElementName);
+    	
+    	QueryMetadataInterface metadata = context.getMetadata();
+    	
+    	keyElement.setType(DataTypeManager.getDataTypeClass(metadata.getElementType(metadata.getElementID(codeTableName + ElementSymbol.SEPARATOR + keyElementName))));
+    	returnElement.setType(DataTypeManager.getDataTypeClass(metadata.getElementType(metadata.getElementID(codeTableName + ElementSymbol.SEPARATOR + returnElementName))));
+    	
+    	String matTableName = CODE_PREFIX + (codeTableName + ElementSymbol.SEPARATOR + keyElementName + ElementSymbol.SEPARATOR + returnElementName).toUpperCase(); 
+    	TempMetadataID id = context.getGlobalTableStore().getMetadataStore().addTempGroup(matTableName, Arrays.asList(keyElement, returnElement), false, true);
+    	String queryString = Reserved.SELECT + ' ' + keyElementName + " ," + returnElementName + ' ' + Reserved.FROM + ' ' + codeTableName; //$NON-NLS-1$ 
+    	id.setQueryNode(new QueryNode(matTableName, queryString));
+    	id.setPrimaryKey(id.getElements().subList(0, 1));
+    	
+    	Query query = RelationalPlanner.createMatViewQuery(id, matTableName, Arrays.asList(returnElement), true);
+    	query.setCriteria(new CompareCriteria(keyElement, CompareCriteria.EQ, new Constant(keyValue)));
+    	
+    	TupleSource ts = registerQuery(context, context.getTempTableStore(), query);
+    	List<?> row = ts.nextTuple();
+    	Object result = null;
+    	if (row != null) {
+    		result = row.get(0);
+    	}
+    	ts.closeSource();
+    	return result;
     }
-    
-    @Override
-    public void clearCodeTables() {
-    	this.processorDataManager.clearCodeTables();
-    }
-    
+
 }

Modified: trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableStore.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableStore.java	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableStore.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -86,6 +86,10 @@
 			return updateTime;
 		}
 		
+		public MatState getState() {
+			return state;
+		}
+		
 	}
 	
 	private ConcurrentHashMap<String, MatTableInfo> matTables = new ConcurrentHashMap<String, MatTableInfo>();

Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -51,7 +51,7 @@
 		}
 
 		@Override
-		public ManagedBatch createManagedBatch(final TupleBatch batch)
+		public ManagedBatch createManagedBatch(final TupleBatch batch, boolean softCache)
 				throws TeiidComponentException {
 			return new ManagedBatch() {
 				

Deleted: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCodeTableCache.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCodeTableCache.java	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCodeTableCache.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -1,249 +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.dqp.internal.process;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.teiid.core.TeiidComponentException;
-import org.teiid.core.TeiidProcessingException;
-import org.teiid.dqp.internal.process.CodeTableCache;
-import org.teiid.dqp.internal.process.CodeTableCache.CacheKey;
-import org.teiid.dqp.internal.process.CodeTableCache.CacheState;
-import org.teiid.query.util.CommandContext;
-
-import junit.framework.TestCase;
-
-
-/**
- */
-public class TestCodeTableCache extends TestCase {
-
-	private static CommandContext TEST_CONTEXT = new CommandContext("pid", "1", null, "test",  1); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$  
-	private static CommandContext TEST_CONTEXT_1 = new CommandContext("pid", "1", null, "test", 2); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-	
-	public TestCodeTableCache(String name) {
-		super(name);
-	}
-	
-	private static List[] exampleResultObject() {
-		List record1 = Arrays.asList("US", "USA"); //$NON-NLS-1$ //$NON-NLS-2$
-		List record2 = Arrays.asList("Germany", "GM"); //$NON-NLS-1$ //$NON-NLS-2$
-
-        List[] records = new List[] { 
-            record1, record2
-        };
-				
-		return records;    
-	}
-
-	private CodeTableCache setUpSampleCodeTable(boolean setDone) {
-		CodeTableCache ctc = new CodeTableCache(10, 10, 10);
-		assertEquals(CacheState.CACHE_NOT_EXIST, ctc.cacheExists("countrycode", "code", "country", TEST_CONTEXT)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-		// must set the requestToCacheKeyMap first 
-		CacheKey nodeId = ctc.createCacheRequest("countrycode", "code", "country", TEST_CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-		List[] results = exampleResultObject();
-		
-		//  table/countrycode (keyElem/country, returnElem/code);
-		//   r1--> 'US', 'USA'
-		//   r2--> 'Germany', 'GM'
-		
-		try {
-			ctc.loadTable(nodeId, Arrays.asList(results));
-		} catch (TeiidProcessingException e) {
-			throw new RuntimeException(e);
-		}
-		ctc.markCacheDone(nodeId, setDone);
-		return ctc;	
-	}
-
-	// Max = 1 and 1 table is set up
-	private CodeTableCache setUpSampleCodeTable2() {
-		CodeTableCache ctc = new CodeTableCache(1, 10, 10);
-		assertEquals(CacheState.CACHE_NOT_EXIST, ctc.cacheExists("countrycode", "code", "country", TEST_CONTEXT)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-		// must set the requestToCacheKeyMap first 
-		CacheKey nodeId = ctc.createCacheRequest("countrycode", "code", "country", TEST_CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        List[] results = exampleResultObject();
-		
-		//  table/countrycode (keyElem/country, returnElem/code);
-		//   r1--> 'US', 'USA'
-		//   r2--> 'Germany', 'GM'
-		
-		try {
-			ctc.loadTable(nodeId, Arrays.asList(results));
-		} catch (TeiidProcessingException e) {
-			throw new RuntimeException(e);
-		}
-		ctc.markCacheDone(nodeId, true);
-		return ctc;	
-	}
-
-    public void testLookupValue() throws Exception {
-		CodeTableCache ctc = setUpSampleCodeTable(true);
-		String code = (String) ctc.lookupValue("countrycode", "code", "country", "Germany", TEST_CONTEXT);	 //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-		assertEquals("Actual lookup value doesn't match with expected: ", code, "GM"); //$NON-NLS-1$ //$NON-NLS-2$
-	}
-
-	/** state = 0; exists*/
-	public void testCacheExists1() {
-		// load code table
-		CodeTableCache ctc = setUpSampleCodeTable(true);
-
-		CacheState actualState = ctc.cacheExists("countrycode", "code", "country", TEST_CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-		assertEquals("Actual cache state doesn't match with expected: ", CacheState.CACHE_EXISTS, actualState);	 //$NON-NLS-1$
-		
-		//test case insensitive
-		actualState = ctc.cacheExists("countryCODE", "code", "Country", TEST_CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-		assertEquals("Actual cache state doesn't match with expected: ", CacheState.CACHE_EXISTS, actualState);	 //$NON-NLS-1$
-	}
-
-	/** state = 1; loading state */
-	public void testCacheExists2() {
-		CodeTableCache ctc = new CodeTableCache(10, 10, 10);
-		
-		ctc.cacheExists("countrycode", "code", "country", TEST_CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-		CacheState actualState = ctc.cacheExists("countrycode", "code", "country", TEST_CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-		assertEquals("Actual cache state doesn't match with expected: ", CacheState.CACHE_LOADING, actualState);	 //$NON-NLS-1$
-	}	
-
-	/** state = 2; not exist */
-	public void testCacheExists3() {
-		CodeTableCache ctc = setUpSampleCodeTable(true);
-		
-		CacheState actualState = ctc.cacheExists("countrycode1", "code1", "country1", TEST_CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-		assertEquals("Actual cache state doesn't match with expected: ", CacheState.CACHE_NOT_EXIST, actualState);	 //$NON-NLS-1$
-	}	
-		
-	/** state = 2; not exist */
-	public void testCacheExists3a() {
-		CodeTableCache ctc = setUpSampleCodeTable(false);
-		
-		CacheState actualState = ctc.cacheExists("countrycode", "code", "country", TEST_CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-		assertEquals("Actual cache state doesn't match with expected: ", CacheState.CACHE_NOT_EXIST, actualState);	 //$NON-NLS-1$
-	}	
-
-	/** state = 4; overload */
-	public void testCacheOverload1() {
-		CodeTableCache ctc = setUpSampleCodeTable2();
-		
-		CacheState actualState = ctc.cacheExists("countrycode", "something", "country", TEST_CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-		assertEquals("Actual cache state doesn't match with expected: ", CacheState.CACHE_OVERLOAD, actualState);	 //$NON-NLS-1$
-	}	
-
-    /** test load, then clearAll, then cacheExists */
-    public void testClearAllLoaded() {
-        // load code table
-        CodeTableCache ctc = setUpSampleCodeTable(true);
-
-        // clear all code tables
-        ctc.clearAll();
-
-        // check state
-        CacheState actualState = ctc.cacheExists("countrycode", "code", "country", TEST_CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        assertEquals("Actual cache state doesn't match with expected: ", CacheState.CACHE_NOT_EXIST, actualState);   //$NON-NLS-1$
-    }
-
-    /** load table, cacheExists, clearAll, then lookupValue - this should throw an exception */
-    public void testClearAllLoading() {
-        // load code table
-        CodeTableCache ctc = setUpSampleCodeTable(true);
-        
-        // check state
-        CacheState actualState = ctc.cacheExists("countrycode", "code", "country", TEST_CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        assertEquals("Actual cache state doesn't match with expected: ", CacheState.CACHE_EXISTS, actualState);  //$NON-NLS-1$
-
-        // clear all code tables before it can be read
-        ctc.clearAll();
-
-        // lookup a value - this should throw an exception
-        try {
-            ctc.lookupValue("countrycode", "code", "country", "US", TEST_CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-            fail("Expected exception during lookup"); //$NON-NLS-1$
-        } catch(TeiidComponentException e) {
-            // expected this
-        }
-    }
-    
-    public void testVdbSpecificCaching() {
-		// load code table
-		CodeTableCache ctc = setUpSampleCodeTable(true);
-
-		CacheState actualState = ctc.cacheExists("countrycode", "code", "country", TEST_CONTEXT_1); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-		assertEquals("Actual cache state doesn't match with expected: ", CacheState.CACHE_NOT_EXIST, actualState);	 //$NON-NLS-1$
-    }
-    
-    public void testDuplicateKeyException() {
-    	CodeTableCache ctc = new CodeTableCache(1, 10, 10);
-    	assertEquals(CacheState.CACHE_NOT_EXIST, ctc.cacheExists("table", "key", "value", TEST_CONTEXT)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-		// must set the requestToCacheKeyMap first 
-    	CacheKey nodeId = ctc.createCacheRequest("table", "key", "value", TEST_CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        List[] results = new List[] {
-        		Arrays.asList(1, 2),
-        		Arrays.asList(1, 3),
-        }; 
-		
-		try {
-			ctc.loadTable(nodeId, Arrays.asList(results));
-			fail("expected exception"); //$NON-NLS-1$
-		} catch (TeiidProcessingException e) {
-			assertEquals("Duplicate code table 'table' key 'value' value '1'", e.getMessage()); //$NON-NLS-1$
-		}
-    }
-    
-    public void testMaxRecords() {
-    	CodeTableCache ctc = new CodeTableCache(1, 1, 10);
-    	assertEquals(CacheState.CACHE_NOT_EXIST, ctc.cacheExists("table", "key", "value", TEST_CONTEXT)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-		// must set the requestToCacheKeyMap first 
-    	CacheKey nodeId = ctc.createCacheRequest("table", "key", "value", TEST_CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        List[] results = new List[] {
-        		Arrays.asList(1, 2),
-        		Arrays.asList(2, 3),
-        }; 
-		
-		try {
-			ctc.loadTable(nodeId, Arrays.asList(results));
-			fail("expected exception"); //$NON-NLS-1$
-		} catch (TeiidProcessingException e) {
-			assertEquals("Error Code:ERR.018.005.0100 Message:Unable to load code table for because result sizes exceeds the allowed parameter - maxCodeTableRecords.", e.getMessage()); //$NON-NLS-1$
-		}
-    }
-    
-    public void testMaxRecordsPerTable() {
-    	CodeTableCache ctc = new CodeTableCache(10, 10, 1);
-    	assertEquals(CacheState.CACHE_NOT_EXIST, ctc.cacheExists("table", "key", "value", TEST_CONTEXT)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-		// must set the requestToCacheKeyMap first 
-    	CacheKey nodeId = ctc.createCacheRequest("table", "key", "value", TEST_CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        List[] results = new List[] {
-        		Arrays.asList(1, 2),
-        		Arrays.asList(2, 3),
-        }; 
-		
-		try {
-			ctc.loadTable(nodeId, Arrays.asList(results));
-			fail("expected exception"); //$NON-NLS-1$
-		} catch (TeiidProcessingException e) {
-			assertEquals("Error Code:ERR.018.005.0100 Message:Unable to load code table for because result sizes exceeds the allowed parameter - maxCodeTables.", e.getMessage()); //$NON-NLS-1$
-		}
-    }
-
-}

Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -29,7 +29,6 @@
 import org.teiid.cache.DefaultCacheFactory;
 import org.teiid.client.RequestMessage;
 import org.teiid.common.buffer.BlockedException;
-import org.teiid.core.TeiidException;
 import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
 import org.teiid.dqp.internal.datamgr.FakeTransactionService;
 import org.teiid.dqp.message.AtomicRequestMessage;
@@ -84,10 +83,7 @@
         
         dtm = new DataTierManagerImpl(rm,
                                   repo,
-                                  bs,
-                                  20,
-                                  1000,
-                                  1000);
+                                  bs);
         command = helpGetCommand(sql, metadata);
         
         RequestMessage original = new RequestMessage();
@@ -130,18 +126,6 @@
     	assertNull(info.nextTuple());
     }
     
-    @Test public void testCodeTableResponseException() throws Exception {
-    	helpSetup(3);
-    	this.connectorManager.throwExceptionOnExecute = true;
-        
-        try {
-            dtm.lookupCodeValue(context, "BQT1.SmallA", "IntKey", "StringKey", "49");  //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-            fail("processor should have failed"); //$NON-NLS-1$
-        } catch (TeiidException e) {
-            assertEquals("Connector Exception", e.getMessage()); //$NON-NLS-1$
-        }
-    }
-    
     @Test public void testNoRowsException() throws Exception {
     	helpSetup(3);
     	this.connectorManager.setRows(0);
@@ -155,11 +139,4 @@
     	}
     }
     
-    @Test public void testCodeTableResponseDataNotAvailable() throws Exception {
-    	helpSetup(3);
-    	this.connectorManager.dataNotAvailable = 5;
-        
-        assertNull(dtm.lookupCodeValue(context, "BQT1.SmallA", "IntKey", "StringKey", "49"));  //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-    }
-    
 }

Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestSessionAwareCache.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestSessionAwareCache.java	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestSessionAwareCache.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -28,6 +28,7 @@
 import org.teiid.cache.Cache;
 import org.teiid.common.buffer.BufferManager;
 import org.teiid.dqp.internal.process.SessionAwareCache.CacheID;
+import org.teiid.query.function.metadata.FunctionMethod;
 import org.teiid.query.parser.ParseInfo;
 import static org.mockito.Mockito.*;
 import static org.junit.Assert.*;
@@ -46,7 +47,7 @@
 		Cachable result = Mockito.mock(Cachable.class);
 		
 		id = new CacheID(buildWorkContext(), new ParseInfo(), "SELECT * FROM FOO");
-		cache.put(id, true, false, result);
+		cache.put(id, FunctionMethod.SESSION_DETERMINISTIC, result);
 		
 		// make sure that in the case of session specific; we do not call prepare
 		// as session is local only call for distributed
@@ -70,7 +71,7 @@
 		Mockito.stub(result.prepare((Cache)anyObject(), (BufferManager)anyObject())).toReturn(true);
 		Mockito.stub(result.restore((Cache)anyObject(), (BufferManager)anyObject())).toReturn(true);
 				
-		cache.put(id, false, true, result);
+		cache.put(id, FunctionMethod.USER_DETERMINISTIC, result);
 		
 		// make sure that in the case of session specific; we do not call prepare
 		// as session is local only call for distributed
@@ -96,7 +97,7 @@
 		Mockito.stub(result.prepare((Cache)anyObject(), (BufferManager)anyObject())).toReturn(true);
 		Mockito.stub(result.restore((Cache)anyObject(), (BufferManager)anyObject())).toReturn(true);		
 		
-		cache.put(id, false, false, result);
+		cache.put(id, FunctionMethod.VDB_DETERMINISTIC, result);
 		
 		// make sure that in the case of session specific; we do not call prepare
 		// as session is local only call for distributed

Modified: trunk/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -39,18 +39,36 @@
 import org.teiid.core.types.DataTypeManager;
 import org.teiid.metadata.Datatype;
 import org.teiid.metadata.MetadataFactory;
+import org.teiid.metadata.Table;
 import org.teiid.query.metadata.CompositeMetadataStore;
 import org.teiid.query.metadata.TransformationMetadata;
 import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.translator.TranslatorException;
 
-
+ at SuppressWarnings("nls")
 public class TestTransformationMetadata {
 
 	@Test public void testAmbiguousProc() throws Exception {
+		TransformationMetadata tm = exampleTransformationMetadata();
+
+		try {
+			tm.getStoredProcedureInfoForProcedure("y"); //$NON-NLS-1$
+			fail("expected exception"); //$NON-NLS-1$
+		} catch (QueryMetadataException e) {
+			assertEquals("Procedure 'y' is ambiguous, use the fully qualified name instead", e.getMessage()); //$NON-NLS-1$
+		}
+	}
+
+	private TransformationMetadata exampleTransformationMetadata()
+			throws TranslatorException {
 		Map<String, Datatype> datatypes = new HashMap<String, Datatype>();
         datatypes.put(DataTypeManager.DefaultDataTypes.STRING, new Datatype());
 		MetadataFactory mf = new MetadataFactory("x", datatypes, new Properties()); //$NON-NLS-1$
 		mf.addProcedure("y"); //$NON-NLS-1$
+		
+		Table t = mf.addTable("foo");
+		mf.addColumn("col", DataTypeManager.DefaultDataTypes.STRING, t);
+		
 		MetadataFactory mf1 = new MetadataFactory("x1", datatypes, new Properties()); //$NON-NLS-1$
 		mf1.addProcedure("y"); //$NON-NLS-1$
 		CompositeMetadataStore cms = new CompositeMetadataStore(Arrays.asList(mf.getMetadataStore(), mf1.getMetadataStore()));
@@ -62,14 +80,7 @@
 		vdb.addModel(buildModel("x"));
 		vdb.addModel(buildModel("x1"));
 		
-		TransformationMetadata tm = new TransformationMetadata(vdb, cms, null, null);
-
-		try {
-			tm.getStoredProcedureInfoForProcedure("y"); //$NON-NLS-1$
-			fail("expected exception"); //$NON-NLS-1$
-		} catch (QueryMetadataException e) {
-			assertEquals("Procedure 'y' is ambiguous, use the fully qualified name instead", e.getMessage()); //$NON-NLS-1$
-		}
+		return new TransformationMetadata(vdb, cms, null, null);
 	}
 	
 	ModelMetaData buildModel(String name) {
@@ -115,4 +126,9 @@
 		assertEquals(1, result.size());
 	}
 	
+	@Test public void testElementId() throws Exception {
+		TransformationMetadata tm = exampleTransformationMetadata();
+		tm.getElementID("x.FoO.coL");
+	}
+	
 }

Modified: trunk/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -364,9 +364,6 @@
         blockOnce = true;
     }
     
-    @Override
-    public void clearCodeTables() {/* does nothing */}
-
     /**
      * Are commands/queries that are registered with the data manager being 
      * recorded?

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -31,6 +31,7 @@
 import org.junit.Before;
 import org.junit.Test;
 import org.teiid.common.buffer.BufferManagerFactory;
+import org.teiid.core.TeiidProcessingException;
 import org.teiid.dqp.internal.process.SimpleQueryProcessorFactory;
 import org.teiid.query.metadata.TempMetadataAdapter;
 import org.teiid.query.optimizer.capabilities.CapabilitiesFinder;
@@ -56,10 +57,12 @@
 		metadata = new TempMetadataAdapter(RealMetadataFactory.exampleMaterializedView(), tempStore.getMetadataStore());
 		hdm = new HardcodedDataManager();
 		hdm.addData("SELECT matsrc.x FROM matsrc", new List[] {Arrays.asList((String)null), Arrays.asList("one"), Arrays.asList("two"), Arrays.asList("three")});
+		hdm.addData("SELECT mattable.info.e1, mattable.info.e2 FROM mattable.info", new List[] {Arrays.asList("a", 1), Arrays.asList("a", 2)});
+		hdm.addData("SELECT mattable.info.e2, mattable.info.e1 FROM mattable.info", new List[] {Arrays.asList(1, "a"), Arrays.asList(2, "a")});
 		dataManager = new TempTableDataManager(hdm, BufferManagerFactory.getStandaloneBufferManager());
 	}
 	
-	private void execute(String sql, List[] expectedResults) throws Exception {
+	private void execute(String sql, List... expectedResults) throws Exception {
 		CommandContext cc = TestProcessor.createCommandContext();
 		cc.setTempTableStore(tempStore);
 		cc.setGlobalTableStore(globalStore);
@@ -71,10 +74,22 @@
 	}
 
 	@Test public void testPopulate() throws Exception {
-		execute("SELECT * from vgroup3 where x = 'one'", new List[] {Arrays.asList("one", "zne")});
+		execute("SELECT * from vgroup3 where x = 'one'", Arrays.asList("one", "zne"));
 		assertEquals(1, hdm.getCommandHistory().size());
-		execute("SELECT * from vgroup3 where x is null", new List[] {Arrays.asList(null, null)});
+		execute("SELECT * from vgroup3 where x is null", Arrays.asList(null, null));
 		assertEquals(1, hdm.getCommandHistory().size());
 	}
 	
+    @Test(expected=TeiidProcessingException.class) public void testCodeTableResponseException() throws Exception {
+    	//duplicate key
+    	execute("select lookup('mattable.info', 'e2', 'e1', 'a')");
+    }
+    
+    @Test public void testCodeTable() throws Exception {
+    	execute("select lookup('mattable.info', 'e1', 'e2', 5)", Arrays.asList((String)null));
+    	assertEquals(1, hdm.getCommandHistory().size());
+    	execute("select lookup('mattable.info', 'e1', 'e2', 1)", Arrays.asList("a"));
+    	assertEquals(1, hdm.getCommandHistory().size());
+    }
+    
 }

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestProcedureRelational.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestProcedureRelational.java	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestProcedureRelational.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -544,7 +544,7 @@
         // Plan query 
         ProcessorPlan plan = TestProcedureProcessor.getProcedurePlan(sql, metadata);        
         // Run query 
-        TestProcedureProcessor.helpTestProcess(plan, expected, new FakeDataManager());  
+        TestProcedureProcessor.helpTestProcess(plan, expected, new FakeDataManager(), metadata);  
                
     }
 
@@ -742,7 +742,7 @@
         	}
         };
         
-        TestProcedureProcessor.helpTestProcess(plan, expected, dataManager);  
+        TestProcedureProcessor.helpTestProcess(plan, expected, dataManager, metadata);  
                
     }
     

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -32,11 +32,9 @@
 import java.util.Arrays;
 import java.util.Calendar;
 import java.util.Collection;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
 import java.util.StringTokenizer;
@@ -54,6 +52,7 @@
 import org.teiid.core.TeiidRuntimeException;
 import org.teiid.core.types.DataTypeManager;
 import org.teiid.core.types.XMLType;
+import org.teiid.dqp.internal.process.SimpleQueryProcessorFactory;
 import org.teiid.query.analysis.AnalysisRecord;
 import org.teiid.query.function.FunctionLibrary;
 import org.teiid.query.function.FunctionTree;
@@ -61,6 +60,8 @@
 import org.teiid.query.function.UDFSource;
 import org.teiid.query.mapping.relational.QueryNode;
 import org.teiid.query.metadata.QueryMetadataInterface;
+import org.teiid.query.metadata.TempMetadataAdapter;
+import org.teiid.query.metadata.TempMetadataStore;
 import org.teiid.query.optimizer.FakeFunctionMetadataSource;
 import org.teiid.query.optimizer.QueryOptimizer;
 import org.teiid.query.optimizer.TestOptimizer;
@@ -149,7 +150,11 @@
     static ProcessorPlan helpGetPlan(Command command, QueryMetadataInterface metadata, CapabilitiesFinder capFinder, CommandContext context) throws TeiidException {
 		if(DEBUG) System.out.println("\n####################################\n" + command); //$NON-NLS-1$
 		AnalysisRecord analysisRecord = new AnalysisRecord(false, DEBUG);
-		try {
+		if (!(metadata instanceof TempMetadataAdapter)) {
+			metadata = new TempMetadataAdapter(metadata, new TempMetadataStore());
+		}
+		context.setMetadata(metadata);
+        try {
 			QueryResolver.resolveCommand(command, metadata);
         
 			ValidatorReport repo  = Validator.validate(command, metadata);
@@ -158,7 +163,7 @@
 	        if (failures.size() > 0){
 	            fail("Exception during validation (" + repo); //$NON-NLS-1$
 	        }        
-			command = QueryRewriter.rewrite(command, metadata, createCommandContext());
+			command = QueryRewriter.rewrite(command, metadata, context);
 	        ProcessorPlan process = QueryOptimizer.optimizePlan(command, metadata, null, capFinder, analysisRecord, context);
 			if(DEBUG) System.out.println("\n" + process); //$NON-NLS-1$
 	        //per defect 10022, clone this plan before processing, just to make sure
@@ -231,8 +236,14 @@
         if (context.getTempTableStore() == null) {
         	context.setTempTableStore(new TempTableStore(context.getConnectionID()));
         }
+        if (context.getGlobalTableStore() == null) {
+        	context.setGlobalTableStore(new TempTableStore("SYSTEM"));
+        }
         if (!(dataManager instanceof TempTableDataManager)) {
         	dataManager = new TempTableDataManager(dataManager, bufferMgr);
+        }        
+        if (context.getQueryProcessorFactory() == null) {
+        	context.setQueryProcessorFactory(new SimpleQueryProcessorFactory(bufferMgr, dataManager, new DefaultCapabilitiesFinder(), null, context.getMetadata()));
         }
         TupleBuffer id = null;
         try {
@@ -335,74 +346,11 @@
     }                    
     
     private void sampleData2(FakeDataManager dataMgr) {
-        FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
-    
-        try { 
-            // Group pm1.g1
-            FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g1"); //$NON-NLS-1$
-            List elementIDs = metadata.getElementIDsInGroupID(groupID);
-            List elementSymbols = FakeDataStore.createElements(elementIDs);
-        
-            dataMgr.registerTuples(
-                groupID,
-                elementSymbols,
-                
-                new List[] { 
-                    Arrays.asList(new Object[] { "a",   new Integer(0),     Boolean.FALSE,  new Double(2.0) }), //$NON-NLS-1$
-                    Arrays.asList(new Object[] { "b",   new Integer(1),     Boolean.TRUE,   null }), //$NON-NLS-1$
-                    Arrays.asList(new Object[] { "c",   new Integer(2),     Boolean.FALSE,  new Double(0.0) }), //$NON-NLS-1$
-                    } );       
-
-            // Group pm1.g2
-            groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g2"); //$NON-NLS-1$
-            elementIDs = metadata.getElementIDsInGroupID(groupID);
-            elementSymbols = FakeDataStore.createElements(elementIDs);
-        
-            dataMgr.registerTuples(
-                groupID,
-                elementSymbols,
-                
-                new List[] { 
-                    Arrays.asList(new Object[] { "a",   new Integer(1),     Boolean.TRUE,   new Double(2.0) }), //$NON-NLS-1$
-                    Arrays.asList(new Object[] { "b",   new Integer(0),     Boolean.FALSE,  new Double(0.0) }), //$NON-NLS-1$
-                    Arrays.asList(new Object[] { "b",   new Integer(5),     Boolean.TRUE,   new Double(2.0) }), //$NON-NLS-1$
-                    Arrays.asList(new Object[] { "b",   new Integer(2),     Boolean.FALSE,  null }), //$NON-NLS-1$
-                    Arrays.asList(new Object[] { "d",   new Integer(2),     Boolean.FALSE,  new Double(1.0) }), //$NON-NLS-1$
-                    } ); 
-                
-            // Group pm2.g1
-            groupID = (FakeMetadataObject) metadata.getGroupID("pm2.g1"); //$NON-NLS-1$
-            elementIDs = metadata.getElementIDsInGroupID(groupID);
-            elementSymbols = FakeDataStore.createElements(elementIDs);
-        
-            dataMgr.registerTuples(
-                groupID,
-                elementSymbols,
-                
-                new List[] { 
-                    Arrays.asList(new Object[] { "b",   new Integer(0),     Boolean.FALSE,  new Double(2.0) }), //$NON-NLS-1$
-                    Arrays.asList(new Object[] { "d",   new Integer(3),     Boolean.TRUE,   new Double(7.0) }), //$NON-NLS-1$
-                    Arrays.asList(new Object[] { "e",   new Integer(1),     Boolean.TRUE,   null }), //$NON-NLS-1$
-                    } );      
-                                     
-            // Group pm1.table1
-            groupID = (FakeMetadataObject) metadata.getGroupID("pm1.table1"); //$NON-NLS-1$
-            elementIDs = metadata.getElementIDsInGroupID(groupID);
-            elementSymbols = FakeDataStore.createElements(elementIDs);
-        
-            dataMgr.registerTuples(
-                groupID,
-                elementSymbols,
-                
-                new List[] { 
-                    Arrays.asList(new Object[] { "a",   new Integer(0),     Boolean.FALSE,  new Double(2.0) }), //$NON-NLS-1$
-                    Arrays.asList(new Object[] { "b",   new Integer(1),     Boolean.TRUE,   null }), //$NON-NLS-1$
-                    Arrays.asList(new Object[] { "c",   new Integer(2),     Boolean.FALSE,  new Double(0.0) }), //$NON-NLS-1$
-                    } );                                     
-                                     
-        } catch(TeiidException e) { 
-        	throw new RuntimeException(e);
-        }
+		try {
+			FakeDataStore.sampleData2(dataMgr);
+		} catch (Exception e) {
+			throw new RuntimeException(e);
+		}
     }                  
 
     private void sampleData2a(FakeDataManager dataMgr) {
@@ -6756,24 +6704,19 @@
         capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
 
         // Plan query
-        String sql = "SELECT e1 FROM pm1.g2 WHERE LOOKUP('pm1.g1','e1', 'e2', 1) = e1";//$NON-NLS-1$
+        String sql = "SELECT e1 FROM pm1.g2 WHERE LOOKUP('pm1.g1','e1', 'e2', 0) = e1";//$NON-NLS-1$
         QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
         Command command = TestProcessor.helpParse(sql);   
         CommandContext context = createCommandContext();
-        context.setMetadata(metadata);
         ProcessorPlan plan = helpGetPlan(command, metadata, capFinder, context);
         
         // Run query
         List[] expected = new List[] {
-            Arrays.asList(new Object[] { "b"}), //$NON-NLS-1$
+            Arrays.asList(new Object[] { "a"}), //$NON-NLS-1$
         };
         
         FakeDataManager dataManager = new FakeDataManager();
-        sampleData1(dataManager);
-        Map valueMap = new HashMap();
-        valueMap.put(1, "b"); //$NON-NLS-1$ //$NON-NLS-2$
-        dataManager.defineCodeTable("pm1.g1", "e2", "e1", valueMap); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        dataManager.setThrowBlocked(true);
+        FakeDataStore.sampleData2(dataManager);
         
         helpProcess(plan, context, dataManager, expected);
     } 

Modified: trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -26,9 +26,7 @@
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import org.junit.Test;
 import org.teiid.api.exception.query.QueryMetadataException;
@@ -40,12 +38,15 @@
 import org.teiid.query.analysis.AnalysisRecord;
 import org.teiid.query.mapping.relational.QueryNode;
 import org.teiid.query.metadata.QueryMetadataInterface;
+import org.teiid.query.metadata.TempMetadataAdapter;
+import org.teiid.query.metadata.TempMetadataStore;
 import org.teiid.query.optimizer.QueryOptimizer;
 import org.teiid.query.optimizer.TestOptimizer;
 import org.teiid.query.optimizer.capabilities.CapabilitiesFinder;
 import org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder;
 import org.teiid.query.parser.QueryParser;
 import org.teiid.query.processor.FakeDataManager;
+import org.teiid.query.processor.FakeDataStore;
 import org.teiid.query.processor.ProcessorDataManager;
 import org.teiid.query.processor.ProcessorPlan;
 import org.teiid.query.processor.TestProcessor;
@@ -64,7 +65,7 @@
 import org.teiid.query.validator.ValidatorFailure;
 import org.teiid.query.validator.ValidatorReport;
 
- at SuppressWarnings("unchecked")
+ at SuppressWarnings({"unchecked", "nls"})
 public class TestProcedureProcessor {
 	
     public static ProcessorPlan getProcedurePlan(String userQuery, FakeMetadataFacade metadata) throws Exception {
@@ -95,43 +96,30 @@
         }
     }
     
-    static void helpTestProcess(ProcessorPlan procPlan, int rowsUpdated, List[] expectedResults, boolean shouldFail, ProcessorDataManager dataMgr, QueryMetadataInterface metadata) throws Exception {
+    public static void helpTestProcess(ProcessorPlan procPlan, List[] expectedResults, ProcessorDataManager dataMgr, QueryMetadataInterface metadata) throws Exception {
         CommandContext context = new CommandContext("pID", null, null, null, 1); //$NON-NLS-1$
-        context.getNextRand(0);
+        if (!(metadata instanceof TempMetadataAdapter)) {
+        	metadata = new TempMetadataAdapter(metadata, new TempMetadataStore());
+        }
         context.setMetadata(metadata);        	
         
-        if (expectedResults == null) {
-        	expectedResults = new List[] {Arrays.asList(rowsUpdated)};
-        }
-
     	TestProcessor.helpProcess(procPlan, context, dataMgr, expectedResults);
-    	if (shouldFail) {
-    		fail("Expected processing to fail"); //$NON-NLS-1$
-    	}
+    	assertNotNull("Expected processing to fail", expectedResults);
     }
 
     private void helpTestProcessFailure(ProcessorPlan procPlan, FakeDataManager dataMgr, 
-                                 String failMessage) throws Exception {
+                                 String failMessage, QueryMetadataInterface metadata) throws Exception {
         try {
-            helpTestProcess(procPlan, new List[] {}, dataMgr, true);
+            helpTestProcess(procPlan, null, dataMgr, metadata);
         } catch(TeiidException ex) {
             assertEquals(failMessage, ex.getMessage());
         }
     }
     
-    public static void helpTestProcess(ProcessorPlan procPlan, List[] expectedResults, ProcessorDataManager dataMgr) throws Exception {
-        helpTestProcess(procPlan, expectedResults, dataMgr, false);
+    private void helpTestProcess(ProcessorPlan procPlan, int expectedRows, FakeDataManager dataMgr, QueryMetadataInterface metadata) throws Exception {
+    	helpTestProcess(procPlan, new List[] {Arrays.asList(expectedRows)}, dataMgr, metadata);
     }
     
-    private void helpTestProcess(ProcessorPlan procPlan, int expectedRows, FakeDataManager dataMgr) throws Exception {
-        helpTestProcess(procPlan, expectedRows, null, false, dataMgr, null);
-    }
-    
-    static void helpTestProcess(ProcessorPlan procPlan, List[] expectedResults, ProcessorDataManager dataMgr, 
-    		boolean shouldFail) throws Exception {
-        helpTestProcess(procPlan, 0, expectedResults, shouldFail, dataMgr, null);
-    }
-
     // Helper to create a list of elements - used in creating sample data
     private static List createElements(List elementIDs) { 
         List elements = new ArrayList();
@@ -277,7 +265,7 @@
 
 		ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
 									 
-		helpTestProcess(plan, 0, dataMgr);									 
+		helpTestProcess(plan, 0, dataMgr, metadata);									 
     }
 
 	// testing if statement    
@@ -300,7 +288,7 @@
 
 		ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
 									 
-		helpTestProcess(plan, 5, dataMgr);
+		helpTestProcess(plan, 5, dataMgr, metadata);
     }
     
     // testing if statement    
@@ -324,7 +312,7 @@
 
         ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
                                      
-        helpTestProcess(plan, 5, dataMgr);
+        helpTestProcess(plan, 5, dataMgr, metadata);
     }
 
 	// testing rows updated incremented, Input and assignment statements
@@ -345,7 +333,7 @@
 
 		ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
 									 
-		helpTestProcess(plan, 45, dataMgr);									 
+		helpTestProcess(plan, 45, dataMgr, metadata);									 
     }
     
     // if/else test
@@ -375,7 +363,7 @@
 
 		ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
 									 
-		helpTestProcess(plan, 5, dataMgr);									 
+		helpTestProcess(plan, 5, dataMgr, metadata);									 
     }
     
     @Test public void testProcedureProcessor4WithBlockedException() throws Exception {
@@ -405,7 +393,7 @@
 
         ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
                                      
-        helpTestProcess(plan, 5, dataMgr);                                     
+        helpTestProcess(plan, 5, dataMgr, metadata);                                     
     }
 
     // if/else test    
@@ -432,7 +420,7 @@
 
 		ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
 									 
-		helpTestProcess(plan, 50, dataMgr);									 
+		helpTestProcess(plan, 50, dataMgr, metadata);									 
     }
     
     // more rows than expected
@@ -450,7 +438,7 @@
 
 		ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
 									 
-        helpTestProcessFailure(plan, dataMgr, "Error Code:ERR.015.006.0058 Message:Unable to evaluate (SELECT pm1.g1.e2 FROM pm1.g1): Error Code:ERR.015.006.0058 Message:The command of this scalar subquery returned more than one value: SELECT pm1.g1.e2 FROM pm1.g1"); //$NON-NLS-1$ 
+        helpTestProcessFailure(plan, dataMgr, "Error Code:ERR.015.006.0058 Message:Unable to evaluate (SELECT pm1.g1.e2 FROM pm1.g1): Error Code:ERR.015.006.0058 Message:The command of this scalar subquery returned more than one value: SELECT pm1.g1.e2 FROM pm1.g1", metadata); //$NON-NLS-1$ 
     }
 
     // error statement
@@ -487,7 +475,7 @@
 
         ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
                                      
-        helpTestProcessFailure(plan, dataMgr, ErrorInstruction.ERROR_PREFIX + "5MY ERROR"); //$NON-NLS-1$ 
+        helpTestProcessFailure(plan, dataMgr, ErrorInstruction.ERROR_PREFIX + "5MY ERROR", metadata); //$NON-NLS-1$ 
     }
 
     private void helpTestErrorStatment(String errorValue, String expected) throws Exception {
@@ -507,7 +495,7 @@
 
 		ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
 									 
-        helpTestProcessFailure(plan, dataMgr, ErrorInstruction.ERROR_PREFIX + expected); 
+        helpTestProcessFailure(plan, dataMgr, ErrorInstruction.ERROR_PREFIX + expected, metadata); 
     }
     
 	/** test if statement's if block with lookup in if condition */
@@ -515,7 +503,7 @@
 		String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
 		procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
 		procedure = procedure + "DECLARE integer var2;\n"; //$NON-NLS-1$
-		procedure = procedure + "if('xyz' = lookup('pm1.g1','e1', 'e2', 5))\n"; //$NON-NLS-1$
+		procedure = procedure + "if('a' = lookup('pm1.g1','e1', 'e2', 0))\n"; //$NON-NLS-1$
 		procedure = procedure + "BEGIN\n";         //$NON-NLS-1$
 		procedure = procedure + "var2 = INPUT.e2;\n"; //$NON-NLS-1$
 		procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED +1;\n"; //$NON-NLS-1$
@@ -531,13 +519,10 @@
 		 
 		FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
 		FakeDataManager dataMgr = new FakeDataManager();
-		
-		Map valueMap = new HashMap();
-		valueMap.put( new Integer(5), "xyz"); //$NON-NLS-1$
-		dataMgr.defineCodeTable("pm1.g1", "e2", "e1", valueMap); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		FakeDataStore.sampleData2(dataMgr);
 
 		ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);                         
-		helpTestProcess(plan, 1, dataMgr);        
+		helpTestProcess(plan, 1, dataMgr, metadata);        
 
 	}
 	
@@ -546,7 +531,7 @@
 		String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
 		procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
 		procedure = procedure + "DECLARE integer var2;\n"; //$NON-NLS-1$
-		procedure = procedure + "if('xy' = lookup('pm1.g1','e1', 'e2', 5))\n"; //$NON-NLS-1$
+		procedure = procedure + "if('a' = lookup('pm1.g1','e1', 'e2', 5))\n"; //$NON-NLS-1$
 		procedure = procedure + "BEGIN\n";         //$NON-NLS-1$
 		procedure = procedure + "var2 = INPUT.e2;\n"; //$NON-NLS-1$
 		procedure = procedure + "ROWS_UPDATED = ROWS_UPDATED +1;\n"; //$NON-NLS-1$
@@ -562,13 +547,10 @@
 		 
 		FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
 		FakeDataManager dataMgr = new FakeDataManager();
+		FakeDataStore.sampleData2(dataMgr);
 		
-		Map valueMap = new HashMap();
-		valueMap.put( new Integer(5), "xyz"); //$NON-NLS-1$
-		dataMgr.defineCodeTable("pm1.g1", "e2", "e1", valueMap); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-		
 		ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);                         
-		helpTestProcess(plan, 12, dataMgr);        
+		helpTestProcess(plan, 12, dataMgr, metadata);        
 	}
 
     @Test public void testVirtualProcedure() throws Exception {
@@ -585,7 +567,7 @@
             Arrays.asList(new Object[] { "First"}),  //$NON-NLS-1$
             Arrays.asList(new Object[] { "Second"}),  //$NON-NLS-1$
             Arrays.asList(new Object[] { "Third"})};         //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testVirtualProcedureWithBlockedException() throws Exception {
@@ -603,7 +585,7 @@
             Arrays.asList(new Object[] { "First"}),  //$NON-NLS-1$
             Arrays.asList(new Object[] { "Second"}),  //$NON-NLS-1$
             Arrays.asList(new Object[] { "Third"})};         //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testVirtualProcedure2() throws Exception {
@@ -618,7 +600,7 @@
         // Create expected results
         List[] expected = new List[] {
             Arrays.asList(new Object[] { "Third"})};         //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testVirtualProcedure3() throws Exception {
@@ -633,7 +615,7 @@
         // Create expected results
         List[] expected = new List[] {
             Arrays.asList(new Object[] { "First"})};         //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
         
     @Test public void testVirtualProcedure4() throws Exception {
@@ -648,7 +630,7 @@
         // Create expected results
         List[] expected = new List[] {
             Arrays.asList(new Object[] { "First"})};         //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testVirtualProcedure5() throws Exception {
@@ -663,7 +645,7 @@
         // Create expected results
         List[] expected = new List[] {
             Arrays.asList(new Object[] { "Second"})};         //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
        
     @Test public void testVirtualProcedure6() throws Exception {
@@ -678,7 +660,7 @@
         // Create expected results
         List[] expected = new List[] {
             Arrays.asList(new Object[] { "Second"})};         //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
           
     @Test public void testVirtualProcedure7() throws Exception {
@@ -693,7 +675,7 @@
         // Create expected results
         List[] expected = new List[] {
             Arrays.asList(new Object[] { "Third"})};         //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
               
     @Test public void testVirtualProcedure8() throws Exception {
@@ -708,7 +690,7 @@
         // Create expected results
         List[] expected = new List[] {
             Arrays.asList(new Object[] { "Third"})};         //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
              
     @Test public void testVirtualProcedure9() throws Exception {
@@ -722,7 +704,7 @@
                 
         // Create expected results
         List[] expected = new List[] {};        
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
 
               
@@ -738,7 +720,7 @@
         // Create expected results
         List[] expected = new List[] {
             Arrays.asList(new Object[] { "Third", new Integer(5)})};         //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testVirtualProcedure11() throws Exception {
@@ -754,7 +736,7 @@
             Arrays.asList(new Object[] { "First"}),  //$NON-NLS-1$
             Arrays.asList(new Object[] { "Second"}),  //$NON-NLS-1$
             Arrays.asList(new Object[] { "Third"})};           //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testVirtualProcedure12() throws Exception {
@@ -782,7 +764,7 @@
         List[] expected = new List[] {
             Arrays.asList(new Object[] { "First"}),  //$NON-NLS-1$
             Arrays.asList(new Object[] { "Third"})};           //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     //Defect17447_testVirtualProcedure13
@@ -812,7 +794,7 @@
         List[] expected = new List[] {
             Arrays.asList(new Object[] { "First"}),  //$NON-NLS-1$
             Arrays.asList(new Object[] { "Third"})};           //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     		
     @Test public void testVirtualProcedure14() throws Exception {
@@ -826,7 +808,7 @@
         // Create expected results
         List[] expected = new List[] {
             Arrays.asList(new Object[] { "Third"})};           //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
 
     @Test public void testVirtualProcedure15() throws Exception {
@@ -846,7 +828,7 @@
             Arrays.asList(new Object[] { "First"}),  //$NON-NLS-1$
             Arrays.asList(new Object[] { "Second"}),  //$NON-NLS-1$
             Arrays.asList(new Object[] { "Third"})};           //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testVirtualProcedure16() throws Exception {
@@ -883,7 +865,7 @@
             Arrays.asList(new Object[] { "Second", new Integer(15)}),  //$NON-NLS-1$
             Arrays.asList(new Object[] { "Third", new Integer(51)}),  //$NON-NLS-1$
             Arrays.asList(new Object[] { "Fourth", new Integer(7)})};           //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testVirtualProcedure18() throws Exception {
@@ -898,7 +880,7 @@
         List[] expected = new List[] {
             Arrays.asList(new Object[] { "Second", new Integer(15)}),  //$NON-NLS-1$
             Arrays.asList(new Object[] { "Third", new Integer(51)}) }; //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testVirtualProcedure19() throws Exception {
@@ -912,7 +894,7 @@
         // Create expected results
         List[] expected = new List[] {
             Arrays.asList(new Object[] { "Second", new Integer(15)})}; //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testVirtualProcedure19WithBlockedException() throws Exception {
@@ -925,7 +907,7 @@
         // Create expected results
         List[] expected = new List[] {
             Arrays.asList(new Object[] { "Second", new Integer(15)})}; //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
 
     @Test public void testVirtualProcedureNoDataInTempTable() throws Exception {
@@ -939,7 +921,7 @@
         
         // Create expected results
         List[] expected = new List[] {};           
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     //procedure with Has Criteria and Translate Criteria 
@@ -965,7 +947,7 @@
 
 		ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
 									 
-		helpTestProcess(plan, 5, dataMgr);
+		helpTestProcess(plan, 5, dataMgr, metadata);
     }
     
     @Test public void testVirtualProcedure30() throws Exception {
@@ -982,7 +964,7 @@
             Arrays.asList(new Object[] { "First" }),  //$NON-NLS-1$
             Arrays.asList(new Object[] { "Second"}),  //$NON-NLS-1$
             Arrays.asList(new Object[] { "Third"}) }; //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
 
     @Test public void testVirtualProcedure31() throws Exception {
@@ -996,7 +978,7 @@
         // Create expected results
         List[] expected = new List[] {
             Arrays.asList(new Object[] { "Third"}) }; //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
 
     @Test public void testVirtualProcedureDefect14282() throws Exception {
@@ -1011,7 +993,7 @@
         // Create expected results
         List[] expected = new List[] {
             Arrays.asList(new Object[] { "Second"})};         //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }    
     
     @Test public void testDefect16193() throws Exception {
@@ -1025,7 +1007,7 @@
         // Create expected results
         List[] expected = new List[] {
             Arrays.asList(new Object[] { "Third"}) }; //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testVirtualProcedure16602() throws Exception {
@@ -1051,7 +1033,7 @@
         // Create expected results
         List[] expected = new List[] {
             Arrays.asList(new Object[] { new Integer(1)})};           
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testDefect16649_1() throws Exception {
@@ -1065,7 +1047,7 @@
         // Create expected results
         List[] expected = new List[] {
             Arrays.asList(new Object[] { "Second"}) }; //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testDefect16649_2() throws Exception {
@@ -1079,7 +1061,7 @@
         // Create expected results
         List[] expected = new List[] {
             Arrays.asList(new Object[] { "Second"}) }; //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testDefect16694() throws Exception {
@@ -1093,7 +1075,7 @@
         // Create expected results
         List[] expected = new List[] {
             Arrays.asList(new Object[] { "Second"}) }; //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testDefect16707() throws Exception {
@@ -1109,7 +1091,7 @@
                 Arrays.asList(new Object[] { "First"}),  //$NON-NLS-1$
 	            Arrays.asList(new Object[] { "Second"}),  //$NON-NLS-1$
 	            Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testDefect16707_1() throws Exception {
@@ -1125,7 +1107,7 @@
                 Arrays.asList(new Object[] { "First"}),  //$NON-NLS-1$
 	            Arrays.asList(new Object[] { "Second"}),  //$NON-NLS-1$
 	            Arrays.asList(new Object[] { "Third"})}; //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testDefect17451() throws Exception {
@@ -1154,7 +1136,7 @@
         List[] expected = new List[] {
             Arrays.asList(new Object[] { "First"}),  //$NON-NLS-1$
             Arrays.asList(new Object[] { "Third"})};           //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     //Defect 17447
@@ -1172,7 +1154,7 @@
             Arrays.asList(new Object[] { "First"}),  //$NON-NLS-1$
             Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
             Arrays.asList(new Object[] { "Third"})};           //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testDefect17650() throws Exception {
@@ -1200,7 +1182,7 @@
 
         ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
                                      
-        helpTestProcess(plan, 5, dataMgr);
+        helpTestProcess(plan, 5, dataMgr, metadata);
     }
     
     @Test public void testDefect19982() throws Exception {
@@ -1216,7 +1198,7 @@
             Arrays.asList(new Object[] { "First", new Integer(5)}),  //$NON-NLS-1$
             Arrays.asList(new Object[] { "Second", new Integer(5)}), //$NON-NLS-1$
             Arrays.asList(new Object[] { "Third", new Integer(5)})};           //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     } 
     
     @Test public void testCase3521() throws Exception {
@@ -1234,7 +1216,7 @@
             Arrays.asList(new Object[] { "Second"}),  //$NON-NLS-1$
 //            Arrays.asList(new Object[] { "Third"}),   //$NON-NLS-1$
         };        
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
 
     //procedure with Has Criteria and Translate Criteria and changing
@@ -1261,7 +1243,7 @@
 
 		ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
 									 
-		helpTestProcess(plan, 5, dataMgr);
+		helpTestProcess(plan, 5, dataMgr, metadata);
     }
     
     @Test public void testDynamicCommandWithIntoExpression() throws Exception {
@@ -1290,7 +1272,7 @@
         List[] expected = new List[] {
             Arrays.asList(new Object[] { "First" }),  //$NON-NLS-1$
             };           
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
       }
     
     @Test public void testDynamicCommandWithIntoAndLoop() throws Exception {
@@ -1332,7 +1314,7 @@
         List[] expected = new List[] {
             Arrays.asList(new Object[] { new Integer(66)}),  
             };           
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
       }
     
     @Test public void testDynamicCommandWithParameter() throws Exception {
@@ -1360,7 +1342,7 @@
         List[] expected = new List[] {
                 Arrays.asList(new Object[] { "First", new Integer(5) }),  //$NON-NLS-1$
         };        
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testDynamicCommandWithUsing() throws Exception {
@@ -1388,7 +1370,7 @@
         List[] expected = new List[] {
                 Arrays.asList(new Object[] { "First", new Integer(5) }),  //$NON-NLS-1$
         };        
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testDynamicCommandWithVariable() throws Exception {
@@ -1416,7 +1398,7 @@
         List[] expected = new List[] {
                 Arrays.asList(new Object[] { "First", new Integer(5) }),  //$NON-NLS-1$
         };        
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
 
     @Test public void testDynamicCommandWithSingleSelect() throws Exception {
@@ -1443,7 +1425,7 @@
         List[] expected = new List[] {
                 Arrays.asList(new Object[] { "26" }),  //$NON-NLS-1$
         };        
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
 
     
@@ -1473,7 +1455,7 @@
          List[] expected = new List[] {
                  Arrays.asList(new Object[] { "5" }),  //$NON-NLS-1$
          };        
-         helpTestProcess(plan, expected, dataMgr);
+         helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testDynamicCommandRecursion() throws Exception {
@@ -1503,7 +1485,7 @@
 
         helpTestProcessFailure(plan,
                                dataMgr,
-                               "Couldn't execute the dynamic SQL command \"EXECUTE STRING 'EXEC pm1.sq2(''First'')' AS e1 string, e2 integer\" with the SQL statement \"'EXEC pm1.sq2(''First'')'\" due to: There is a recursive invocation of group 'PM1.SQ2'. Please correct the SQL."); //$NON-NLS-1$
+                               "Couldn't execute the dynamic SQL command \"EXECUTE STRING 'EXEC pm1.sq2(''First'')' AS e1 string, e2 integer\" with the SQL statement \"'EXEC pm1.sq2(''First'')'\" due to: There is a recursive invocation of group 'PM1.SQ2'. Please correct the SQL.", metadata); //$NON-NLS-1$
     }
     
     @Test public void testDynamicCommandIncorrectProjectSymbolCount() throws Exception {
@@ -1533,7 +1515,7 @@
 
         ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
     	
-        helpTestProcessFailure(plan, dataMgr, "Couldn't execute the dynamic SQL command \"EXECUTE STRING 'EXEC pm1.sq1(''First'')' AS e1 string, e2 integer\" with the SQL statement \"'EXEC pm1.sq1(''First'')'\" due to: The dynamic sql string contains an incorrect number of elements."); //$NON-NLS-1$
+        helpTestProcessFailure(plan, dataMgr, "Couldn't execute the dynamic SQL command \"EXECUTE STRING 'EXEC pm1.sq1(''First'')' AS e1 string, e2 integer\" with the SQL statement \"'EXEC pm1.sq1(''First'')'\" due to: The dynamic sql string contains an incorrect number of elements.", metadata); //$NON-NLS-1$
      }
     
     @Test public void testDynamicCommandPositional() throws Exception {
@@ -1560,7 +1542,7 @@
     	
         helpTestProcess(plan, new List[] {Arrays.asList("First", "5"), //$NON-NLS-1$ //$NON-NLS-2$
         		Arrays.asList("Second", "15"), //$NON-NLS-1$ //$NON-NLS-2$
-        		Arrays.asList("Third", "51")}, dataMgr); //$NON-NLS-1$ //$NON-NLS-2$
+        		Arrays.asList("Third", "51")}, dataMgr, metadata); //$NON-NLS-1$ //$NON-NLS-2$
      }
     
     @Test public void testDynamicCommandIncorrectProjectSymbolDatatypes() throws Exception {
@@ -1585,7 +1567,7 @@
 
         ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
     	
-        helpTestProcessFailure(plan, dataMgr, "Couldn't execute the dynamic SQL command \"EXECUTE STRING 'select e1 from pm1.g1'\" with the SQL statement \"'select e1 from pm1.g1'\" due to: The datatype 'string' for element 'E1' in the dynamic SQL cannot be implicitly converted to 'integer'."); //$NON-NLS-1$
+        helpTestProcessFailure(plan, dataMgr, "Couldn't execute the dynamic SQL command \"EXECUTE STRING 'select e1 from pm1.g1'\" with the SQL statement \"'select e1 from pm1.g1'\" due to: The datatype 'string' for element 'E1' in the dynamic SQL cannot be implicitly converted to 'integer'.", metadata); //$NON-NLS-1$
      }
      
     @Test public void testDynamicCommandWithTwoDynamicStatements() throws Exception {
@@ -1615,7 +1597,7 @@
             Arrays.asList(new Object[] { "Second", new Integer(15)}), //$NON-NLS-1$
             Arrays.asList(new Object[] { "Third", new Integer(51)})};           //$NON-NLS-1$      
        
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
      }
     
     @Test public void testAssignmentWithCase() throws Exception {
@@ -1652,7 +1634,7 @@
         List[] expected = new List[] {
                 Arrays.asList(new Object[] { new Integer(3) }),  
         };        
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testDynamicCommandInsertIntoTempTableWithDifferentDatatypeFromSource() throws Exception {
@@ -1682,7 +1664,7 @@
             Arrays.asList(new Object[] { "Second", new Integer(15)}), //$NON-NLS-1$
             Arrays.asList(new Object[] { "Third", new Integer(51)})};           //$NON-NLS-1$      
        
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
      }
     
     @Test public void testDynamicCommandWithVariableOnly() throws Exception {
@@ -1709,7 +1691,7 @@
         // Create expected results
         List[] expected = new List[] { Arrays.asList(new Object[] { "First", new Short((short)5)})};           //$NON-NLS-1$      
         
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
      }
     
     @Test public void testVirtualProcedureWithCreate() throws Exception{
@@ -1726,7 +1708,7 @@
             Arrays.asList(new Object[] { "First"}),  //$NON-NLS-1$
             Arrays.asList(new Object[] { "Second"}),  //$NON-NLS-1$
             Arrays.asList(new Object[] { "Third"})};         //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testVirtualProcedureWithCreateAndDrop() throws Exception{
@@ -1743,7 +1725,7 @@
             Arrays.asList(new Object[] { "First"}),  //$NON-NLS-1$
             Arrays.asList(new Object[] { "Second"}),  //$NON-NLS-1$
             Arrays.asList(new Object[] { "Third"})};         //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testVirtualProcedureWithCreateAndSelectInto() throws Exception{
@@ -1760,7 +1742,7 @@
             Arrays.asList(new Object[] { "First"}),  //$NON-NLS-1$
             Arrays.asList(new Object[] { "Second"}),  //$NON-NLS-1$
             Arrays.asList(new Object[] { "Third"})};         //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testDifferentlyScopedTempTables() throws Exception {
@@ -1803,7 +1785,7 @@
         List[] expected = new List[] {
             Arrays.asList(new Object[] { new Integer(3)}),  
             };           
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testLoopsWithBreak() throws Exception {
@@ -1845,7 +1827,7 @@
         List[] expected = new List[] {
             Arrays.asList(new Object[] { new Integer(76)}),  
             };           
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testCreateWithoutDrop() throws Exception {
@@ -1875,7 +1857,7 @@
 
         ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
         
-        helpTestProcessFailure(plan, dataMgr, "Temporary table \"T1\" already exists."); //$NON-NLS-1$
+        helpTestProcessFailure(plan, dataMgr, "Temporary table \"T1\" already exists.", metadata); //$NON-NLS-1$
     }
     
     /**
@@ -1910,7 +1892,7 @@
 
         ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
         
-        helpTestProcess(plan, new List[] {Arrays.asList(1)}, dataMgr); 
+        helpTestProcess(plan, new List[] {Arrays.asList(1)}, dataMgr, metadata); 
     }
     
     /**
@@ -1949,7 +1931,7 @@
         // Plan query 
         ProcessorPlan plan = getProcedurePlan(sql, metadata);        
         // Run query 
-        helpTestProcess(plan, expected, new FakeDataManager());
+        helpTestProcess(plan, expected, new FakeDataManager(), metadata);
     }
     
     /**
@@ -1979,7 +1961,7 @@
         
         ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
                                      
-        helpTestProcess(plan, 4, new FakeDataManager());
+        helpTestProcess(plan, 4, new FakeDataManager(), metadata);
     }
     
     /**
@@ -2017,7 +1999,7 @@
         ProcessorPlan plan = getProcedurePlan(sql, metadata);
 
         // Run query
-        helpTestProcess(plan, expected, dataManager);
+        helpTestProcess(plan, expected, dataManager, metadata);
     }
     
     @Test public void testInsertAfterCreate() throws Exception {
@@ -2049,7 +2031,7 @@
         
         helpTestProcess(plan, new List[] {
             Arrays.asList(new Object[] {null}),  
-            Arrays.asList(new Object[] {"b"})}, dataMgr); //$NON-NLS-1$
+            Arrays.asList(new Object[] {"b"})}, dataMgr, metadata); //$NON-NLS-1$
         
     }
     
@@ -2071,7 +2053,7 @@
 
         ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
                                      
-        helpTestProcess(plan, 1, dataMgr);
+        helpTestProcess(plan, 1, dataMgr, metadata);
         
         assertTrue(plan.requiresTransaction(false));
     }
@@ -2100,7 +2082,7 @@
 
         ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
                                      
-        helpTestProcess(plan, 1, dataMgr);
+        helpTestProcess(plan, 1, dataMgr, metadata);
     }
     
     @Test public void testEvaluatableSelectWithOrderBy() throws Exception {
@@ -2129,7 +2111,7 @@
         ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
         
         helpTestProcess(plan, new List[] {
-            Arrays.asList(new Object[] {"1"})}, dataMgr); //$NON-NLS-1$
+            Arrays.asList(new Object[] {"1"})}, dataMgr, metadata); //$NON-NLS-1$
         
     }
     
@@ -2161,7 +2143,7 @@
         helpTestProcess(plan, new List[] {
             Arrays.asList(new Object[] {"1"}), //$NON-NLS-1$
             Arrays.asList(new Object[] {"First"}), //$NON-NLS-1$
-            }, dataMgr); 
+            }, dataMgr, metadata); 
         
     }
     
@@ -2195,9 +2177,9 @@
         ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
         
         
-        helpTestProcess(plan, 0, new List[] {
+        helpTestProcess(plan, new List[] {
             Arrays.asList(new Object[] {new Integer(240)}),
-            Arrays.asList(new Object[] {new Integer(637)})}, false, dataMgr, metadata);
+            Arrays.asList(new Object[] {new Integer(637)})}, dataMgr, metadata);
     }
 
     private FakeMetadataFacade createProcedureMetadata(String procedure) {
@@ -2236,7 +2218,7 @@
         
         helpTestProcess(plan, new List[] {
             Arrays.asList(new Object[] {"5"}), //$NON-NLS-1$
-            }, dataMgr);
+            }, dataMgr, metadata);
     }
     
     /**
@@ -2268,7 +2250,7 @@
         List[] expected = new List[] {
                 Arrays.asList(new Object[] { expectedDoc }),
         };        
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testXMLWithExternalCriteria_InXMLVar() throws Exception {
@@ -2297,7 +2279,7 @@
         List[] expected = new List[] {
                 Arrays.asList(new Object[] { expectedDoc }),
         };        
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     /**
@@ -2364,7 +2346,7 @@
         List[] expected = new List[] {
                 Arrays.asList(new Object[] { expectedDoc }),
         };        
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testCase174806() throws Exception{
@@ -2379,7 +2361,7 @@
         // Create expected results
         List[] expected = new List[] {
             Arrays.asList(new Object[] { "c"})};         //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testJoinProcAndPhysicalModel() throws Exception {
@@ -2396,7 +2378,7 @@
             Arrays.asList(new Object[] { "First"}),  //$NON-NLS-1$
             Arrays.asList(new Object[] { "Second"}), //$NON-NLS-1$
             Arrays.asList(new Object[] { "Third"})};           //$NON-NLS-1$
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
 
     /**
@@ -2443,7 +2425,7 @@
         ProcessorPlan plan = getProcedurePlan(userQuery, metadata);
 
         List[] expected = new List[] {Arrays.asList(new Object[] {new Integer(3)})};
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testDefect8693() throws Exception {
@@ -2462,7 +2444,7 @@
         FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
         FakeDataManager dataMgr = exampleDataManager(metadata);
 		ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-		helpTestProcess(plan, 5, dataMgr);									 
+		helpTestProcess(plan, 5, dataMgr, metadata);									 
     }
     
     @Test public void testWhileWithSubquery() throws Exception {
@@ -2480,7 +2462,7 @@
         FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
         FakeDataManager dataMgr = exampleDataManager(metadata);
 		ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-		helpTestProcess(plan, 0, dataMgr);									 
+		helpTestProcess(plan, 0, dataMgr, metadata);									 
     }
     
     @Test public void testDefect18404() throws Exception {
@@ -2495,7 +2477,7 @@
         FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
         FakeDataManager dataMgr = exampleDataManager(metadata);
 		ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-		helpTestProcess(plan, 8, dataMgr);									 
+		helpTestProcess(plan, 8, dataMgr, metadata);									 
     }
 
     /**
@@ -2538,7 +2520,7 @@
                 Arrays.asList( new Object[] { "Second", null, new Integer(15), null} ), //$NON-NLS-1$
                 Arrays.asList( new Object[] { "Third", null, new Integer(51), null} ) //$NON-NLS-1$
         };
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
         
         assertTrue(!plan.requiresTransaction(false));
     }
@@ -2584,7 +2566,7 @@
                 Arrays.asList( new Object[] { "Second", null, new Integer(15), null} ), //$NON-NLS-1$
                 Arrays.asList( new Object[] { "Third", null, new Integer(51), null} ) //$NON-NLS-1$
         };
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testUpdateDeleteTemp() throws Exception {
@@ -2604,7 +2586,7 @@
         List[] expected = new List[] {
                 Arrays.asList( new Object[] { String.valueOf(1) } ), 
         };
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     @Test public void testTempSubqueryInput() throws Exception {
@@ -2623,7 +2605,7 @@
         List[] expected = new List[] {
                 Arrays.asList( 51 ),
         };
-        helpTestProcess(plan, expected, dataMgr);
+        helpTestProcess(plan, expected, dataMgr, metadata);
     }
     
     private static final boolean DEBUG = false;

Modified: trunk/engine/src/test/java/org/teiid/query/processor/relational/TestBatchedUpdateNode.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/relational/TestBatchedUpdateNode.java	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/test/java/org/teiid/query/processor/relational/TestBatchedUpdateNode.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -219,10 +219,6 @@
             actualCommands.add(command);
             return new FakeTupleSource(numExecutedCommands);
         }
-        @Override
-        public void clearCodeTables() {
-        	
-        }
     }
     private static final class FakeTupleSource implements TupleSource {
         private int currentTuple = 0;

Modified: trunk/engine/src/test/java/org/teiid/query/processor/relational/TestProjectIntoNode.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/relational/TestProjectIntoNode.java	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/test/java/org/teiid/query/processor/relational/TestProjectIntoNode.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -184,10 +184,6 @@
             Object val = row.get(0);
             assertEquals(new Integer(value), val);
         }
-        @Override
-        public void clearCodeTables() {
-        	
-        }
     }
     
     private static final class FakeDataTupleSource implements TupleSource {

Modified: trunk/engine/src/test/java/org/teiid/query/processor/xml/TestXMLProcessor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/xml/TestXMLProcessor.java	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/test/java/org/teiid/query/processor/xml/TestXMLProcessor.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -55,6 +55,8 @@
 import org.teiid.query.mapping.xml.MappingSequenceNode;
 import org.teiid.query.mapping.xml.Namespace;
 import org.teiid.query.metadata.QueryMetadataInterface;
+import org.teiid.query.metadata.TempMetadataAdapter;
+import org.teiid.query.metadata.TempMetadataStore;
 import org.teiid.query.optimizer.QueryOptimizer;
 import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
 import org.teiid.query.optimizer.capabilities.CapabilitiesFinder;
@@ -2943,7 +2945,7 @@
 
         try {
             CommandContext planningContext = new CommandContext(); //this should be the same as the processing context, but that's not easy to do
-            
+            planningContext.setMetadata(new TempMetadataAdapter(metadata, new TempMetadataStore()));
             ProcessorPlan plan = QueryOptimizer.optimizePlan(command, metadata, null, capFinder, analysisRecord, planningContext);
             
             if(DEBUG) {
@@ -5492,11 +5494,6 @@
         FakeMetadataFacade metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         
-        dataMgr.setThrowBlocked(true);
-        Map values = new HashMap();
-        values.put("x", "y"); //$NON-NLS-1$ //$NON-NLS-2$
-        dataMgr.defineCodeTable("stock.items", "itemName", "itemNum", values); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        
         String expectedDoc = 
             "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" +  //$NON-NLS-1$
             "<Catalogs>\r\n" + //$NON-NLS-1$

Modified: trunk/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -280,6 +280,11 @@
         Schema physModel = createPhysicalModel("MatTable", metadataStore); //$NON-NLS-1$
         Schema physModel_virtSrc = createPhysicalModel("MatSrc", metadataStore); //$NON-NLS-1$
         
+        Table physTable = createPhysicalGroup("info", physModel); //$NON-NLS-1$
+        createElements(physTable,
+                                      new String[] { "e1", "e2", "e3"}, //$NON-NLS-1$
+                                      new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING});
+        
         Table physGroup = createPhysicalGroup("MatTable", physModel); //$NON-NLS-1$
         createElements(physGroup,
                                       new String[] { "e1" }, //$NON-NLS-1$

Modified: trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestXMLTypeTranslations.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestXMLTypeTranslations.java	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestXMLTypeTranslations.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -113,7 +113,7 @@
         Mockito.stub(rwi.getDqpWorkContext()).toReturn(workContext);
         
         Mockito.stub(core.getRequestWorkItem((RequestID)Mockito.anyObject())).toReturn(rwi);
-        DataTierManagerImpl dataMgr = new DataTierManagerImpl(core, null, null, 0, 0, 0);
+        DataTierManagerImpl dataMgr = new DataTierManagerImpl(core, null, null);
         doProcess(metadata,  
                 sql, 
                 finder, dataMgr , new List[] {Arrays.asList(new String(ObjectConverterUtil.convertToByteArray(new FileInputStream(UnitTestUtil.getTestDataFile("test-schema.xsd")))))}, DEBUG); //$NON-NLS-1$

Modified: trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -82,6 +82,7 @@
         });
         
         this.dqp.setConnectorManagerRepository(cmr);
+        this.dqp.setCacheFactory(new DefaultCacheFactory());
         this.dqp.start(new DQPConfiguration());
         this.sessionService.setDqp(this.dqp);
         

Modified: trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestSystemVirtualModel.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestSystemVirtualModel.java	2010-08-04 03:22:15 UTC (rev 2410)
+++ trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestSystemVirtualModel.java	2010-08-04 04:00:09 UTC (rev 2411)
@@ -143,12 +143,6 @@
 		checkResult("testReferenceKeyColumns", "select* FROM SYS.ReferenceKeyColumns order by PKTABLE_NAME"); //$NON-NLS-1$ //$NON-NLS-2$
 	}
 	
-	@Test public void testVirtualLookup() {
-		String[] expected = { "expr[string]", "null"}; //$NON-NLS-1$ //$NON-NLS-2$
-		executeAndAssertResults(
-				"select lookup('SYS.KeyColumns', 'RefKeyUID', 'KeyName', 'PK_PARTS')", expected); //$NON-NLS-1$
-		
-	}
 	
 	@Test public void test_UID_OID_are_Equal()  throws Exception {
 		execute("select distinct(UID) FROM SYS.Schemas"); //$NON-NLS-1$



More information about the teiid-commits mailing list