[teiid-commits] teiid SVN: r3740 - in trunk: build/kits/jboss-as7/docs/teiid and 58 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Wed Dec 14 17:19:19 EST 2011


Author: shawkins
Date: 2011-12-14 17:19:17 -0500 (Wed, 14 Dec 2011)
New Revision: 3740

Added:
   trunk/engine/src/main/java/org/teiid/query/sql/symbol/DerivedExpression.java
Removed:
   trunk/engine/src/main/java/org/teiid/query/sql/symbol/SelectSymbol.java
   trunk/engine/src/main/java/org/teiid/query/sql/symbol/SingleElementSymbol.java
Modified:
   trunk/api/src/main/java/org/teiid/metadata/AbstractMetadataRecord.java
   trunk/api/src/main/java/org/teiid/metadata/BaseColumn.java
   trunk/api/src/main/java/org/teiid/metadata/MetadataStore.java
   trunk/api/src/main/java/org/teiid/metadata/Schema.java
   trunk/build/kits/jboss-as7/docs/teiid/teiid-releasenotes.html
   trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/netezza/TestNetezzaConvertModifier.java
   trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java
   trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java
   trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java
   trunk/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java
   trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
   trunk/engine/src/main/java/org/teiid/dqp/internal/process/multisource/MultiSourceMetadataWrapper.java
   trunk/engine/src/main/java/org/teiid/dqp/internal/process/multisource/MultiSourcePlanToProcessConverter.java
   trunk/engine/src/main/java/org/teiid/query/analysis/AnalysisRecord.java
   trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java
   trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingAttribute.java
   trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingBaseNode.java
   trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingDocument.java
   trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingNode.java
   trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingSourceNode.java
   trunk/engine/src/main/java/org/teiid/query/metadata/CompositeMetadataStore.java
   trunk/engine/src/main/java/org/teiid/query/metadata/GroupInfo.java
   trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataID.java
   trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataStore.java
   trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/QueryOptimizer.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/TriggerActionPlanner.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/AliasGenerator.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PartitionAnalyzer.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/FrameUtil.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/JoinUtil.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/NewCalculateCostUtil.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleAssignOutputElements.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleChooseJoinStrategy.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleCollapseSource.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleDecomposeJoin.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleImplementJoinStrategy.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleMergeCriteria.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleMergeVirtual.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePlanSorts.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushAggregates.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRaiseAccess.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRaiseNull.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/xml/CriteriaPlanner.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/xml/MarkExcludeVisitor.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/xml/QueryUtil.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/xml/SourceNodePlannerVisitor.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLNodeMappingVisitor.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLPlanToProcessVisitor.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLPlanner.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLPlannerEnvironment.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLProjectionMinimizer.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLQueryPlanner.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLStagaingQueryPlanner.java
   trunk/engine/src/main/java/org/teiid/query/parser/ParseInfo.java
   trunk/engine/src/main/java/org/teiid/query/parser/QueryParser.java
   trunk/engine/src/main/java/org/teiid/query/parser/SQLParserUtil.java
   trunk/engine/src/main/java/org/teiid/query/processor/proc/ExecDynamicSqlInstruction.java
   trunk/engine/src/main/java/org/teiid/query/processor/proc/ForEachRowPlan.java
   trunk/engine/src/main/java/org/teiid/query/processor/proc/LoopInstruction.java
   trunk/engine/src/main/java/org/teiid/query/processor/relational/AccessNode.java
   trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentCriteriaProcessor.java
   trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentValueSource.java
   trunk/engine/src/main/java/org/teiid/query/processor/relational/EnhancedSortMergeJoinStrategy.java
   trunk/engine/src/main/java/org/teiid/query/processor/relational/GroupingNode.java
   trunk/engine/src/main/java/org/teiid/query/processor/relational/NestedTableJoinStrategy.java
   trunk/engine/src/main/java/org/teiid/query/processor/relational/ProjectNode.java
   trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalNode.java
   trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalPlan.java
   trunk/engine/src/main/java/org/teiid/query/processor/relational/SortUtility.java
   trunk/engine/src/main/java/org/teiid/query/processor/xml/ExecSqlInstruction.java
   trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLContext.java
   trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLProcessorEnvironment.java
   trunk/engine/src/main/java/org/teiid/query/resolver/ProcedureContainerResolver.java
   trunk/engine/src/main/java/org/teiid/query/resolver/QueryResolver.java
   trunk/engine/src/main/java/org/teiid/query/resolver/command/DynamicCommandResolver.java
   trunk/engine/src/main/java/org/teiid/query/resolver/command/ExecResolver.java
   trunk/engine/src/main/java/org/teiid/query/resolver/command/InsertResolver.java
   trunk/engine/src/main/java/org/teiid/query/resolver/command/SetQueryResolver.java
   trunk/engine/src/main/java/org/teiid/query/resolver/command/SimpleQueryResolver.java
   trunk/engine/src/main/java/org/teiid/query/resolver/command/TempTableResolver.java
   trunk/engine/src/main/java/org/teiid/query/resolver/command/UpdateProcedureResolver.java
   trunk/engine/src/main/java/org/teiid/query/resolver/command/XMLQueryResolver.java
   trunk/engine/src/main/java/org/teiid/query/resolver/util/ResolverUtil.java
   trunk/engine/src/main/java/org/teiid/query/resolver/util/ResolverVisitor.java
   trunk/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java
   trunk/engine/src/main/java/org/teiid/query/sql/lang/Alter.java
   trunk/engine/src/main/java/org/teiid/query/sql/lang/Command.java
   trunk/engine/src/main/java/org/teiid/query/sql/lang/Criteria.java
   trunk/engine/src/main/java/org/teiid/query/sql/lang/Insert.java
   trunk/engine/src/main/java/org/teiid/query/sql/lang/OrderBy.java
   trunk/engine/src/main/java/org/teiid/query/sql/lang/OrderByItem.java
   trunk/engine/src/main/java/org/teiid/query/sql/lang/Query.java
   trunk/engine/src/main/java/org/teiid/query/sql/lang/Select.java
   trunk/engine/src/main/java/org/teiid/query/sql/lang/SetQuery.java
   trunk/engine/src/main/java/org/teiid/query/sql/lang/StoredProcedure.java
   trunk/engine/src/main/java/org/teiid/query/sql/proc/Block.java
   trunk/engine/src/main/java/org/teiid/query/sql/proc/CreateProcedureCommand.java
   trunk/engine/src/main/java/org/teiid/query/sql/proc/TriggerAction.java
   trunk/engine/src/main/java/org/teiid/query/sql/symbol/AggregateSymbol.java
   trunk/engine/src/main/java/org/teiid/query/sql/symbol/AliasSymbol.java
   trunk/engine/src/main/java/org/teiid/query/sql/symbol/CaseExpression.java
   trunk/engine/src/main/java/org/teiid/query/sql/symbol/Constant.java
   trunk/engine/src/main/java/org/teiid/query/sql/symbol/ElementSymbol.java
   trunk/engine/src/main/java/org/teiid/query/sql/symbol/Expression.java
   trunk/engine/src/main/java/org/teiid/query/sql/symbol/ExpressionSymbol.java
   trunk/engine/src/main/java/org/teiid/query/sql/symbol/Function.java
   trunk/engine/src/main/java/org/teiid/query/sql/symbol/GroupSymbol.java
   trunk/engine/src/main/java/org/teiid/query/sql/symbol/MultipleElementSymbol.java
   trunk/engine/src/main/java/org/teiid/query/sql/symbol/QueryString.java
   trunk/engine/src/main/java/org/teiid/query/sql/symbol/Reference.java
   trunk/engine/src/main/java/org/teiid/query/sql/symbol/ScalarSubquery.java
   trunk/engine/src/main/java/org/teiid/query/sql/symbol/SearchedCaseExpression.java
   trunk/engine/src/main/java/org/teiid/query/sql/symbol/Symbol.java
   trunk/engine/src/main/java/org/teiid/query/sql/symbol/TextLine.java
   trunk/engine/src/main/java/org/teiid/query/sql/symbol/WindowFunction.java
   trunk/engine/src/main/java/org/teiid/query/sql/symbol/XMLElement.java
   trunk/engine/src/main/java/org/teiid/query/sql/symbol/XMLForest.java
   trunk/engine/src/main/java/org/teiid/query/sql/symbol/XMLParse.java
   trunk/engine/src/main/java/org/teiid/query/sql/symbol/XMLQuery.java
   trunk/engine/src/main/java/org/teiid/query/sql/symbol/XMLSerialize.java
   trunk/engine/src/main/java/org/teiid/query/sql/util/SymbolMap.java
   trunk/engine/src/main/java/org/teiid/query/sql/visitor/EvaluatableVisitor.java
   trunk/engine/src/main/java/org/teiid/query/sql/visitor/ExpressionMappingVisitor.java
   trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java
   trunk/engine/src/main/java/org/teiid/query/tempdata/AlterTempTable.java
   trunk/engine/src/main/java/org/teiid/query/tempdata/IndexInfo.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/main/java/org/teiid/query/validator/UpdateValidator.java
   trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
   trunk/engine/src/main/java/org/teiid/query/validator/Validator.java
   trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj
   trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestScalarSubqueryImpl.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestMetaDataProcessor.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourceMetadataWrapper.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java
   trunk/engine/src/test/java/org/teiid/dqp/service/AutoGenDataService.java
   trunk/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/TestDependentJoins.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/TestInlineView.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/TestJoinOptimization.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/TestJoinWithFunction.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/TestRuleMergeVirtual.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/TestRuleRaiseNull.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/TestSubqueryPushdown.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/TestUnionPlanning.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/relational/TestAliasGenerator.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRulePushSelectCriteria.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/xml/TestXMLNodeMappingVisitor.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/xml/TestXMLPlanner.java
   trunk/engine/src/test/java/org/teiid/query/parser/TestParser.java
   trunk/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestCollectionTupleSource.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestInherintlyUpdatableViews.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestVirtualDepJoin.java
   trunk/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java
   trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java
   trunk/engine/src/test/java/org/teiid/query/processor/xml/FakeXMLProcessorEnvironment.java
   trunk/engine/src/test/java/org/teiid/query/processor/xml/TestInstructions.java
   trunk/engine/src/test/java/org/teiid/query/processor/xml/TestXMLPlanningEnhancements.java
   trunk/engine/src/test/java/org/teiid/query/processor/xml/TestXMLProcessor.java
   trunk/engine/src/test/java/org/teiid/query/processor/xml/XMLProgramUtil.java
   trunk/engine/src/test/java/org/teiid/query/resolver/CheckSymbolsAreResolvedVisitor.java
   trunk/engine/src/test/java/org/teiid/query/resolver/TestProcedureResolving.java
   trunk/engine/src/test/java/org/teiid/query/resolver/TestResolver.java
   trunk/engine/src/test/java/org/teiid/query/resolver/TestXMLResolver.java
   trunk/engine/src/test/java/org/teiid/query/rewriter/TestOrderByRewrite.java
   trunk/engine/src/test/java/org/teiid/query/rewriter/TestQueryRewriter.java
   trunk/engine/src/test/java/org/teiid/query/sql/lang/TestAliasSymbol.java
   trunk/engine/src/test/java/org/teiid/query/sql/symbol/TestCaseExpression.java
   trunk/engine/src/test/java/org/teiid/query/sql/symbol/TestConstant.java
   trunk/engine/src/test/java/org/teiid/query/sql/symbol/TestElementSymbol.java
   trunk/engine/src/test/java/org/teiid/query/sql/symbol/TestSearchedCaseExpression.java
   trunk/engine/src/test/java/org/teiid/query/sql/visitor/TestExpressionMappingVisitor.java
   trunk/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java
   trunk/engine/src/test/java/org/teiid/query/validator/TestUpdateValidator.java
   trunk/engine/src/test/java/org/teiid/query/validator/TestValidator.java
   trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestTPCR.java
   trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestVDBMerge.java
   trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestODBCProceduresSchema.java
   trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestResultSetMetadata.java
   trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestVirtualDocWithVirtualProc.java
   trunk/test-integration/common/src/test/resources/TestJDBCSocketTransport/testSelect.expected
   trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_ATTRIBUTE.expected
   trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_CLASS.expected
   trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_INDEX.expected
   trunk/test-integration/common/src/test/resources/TestODBCSocketTransport/testSelect.expected
   trunk/test-integration/common/src/test/resources/TestPartsDatabaseMetadata/testPrimaryKeys.expected
   trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testColumns.expected
   trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testKeyColumns.expected
   trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testKeys.expected
   trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testProcedureParams.expected
   trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testProcedures.expected
   trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testTables.expected
   trunk/test-integration/db/src/main/java/org/teiid/test/client/ctc/QueryResults.java
Log:
TEIID-1560 removing the canonical name concept and beginning to rationalize aggregate vs. non-aggregate functions

Modified: trunk/api/src/main/java/org/teiid/metadata/AbstractMetadataRecord.java
===================================================================
--- trunk/api/src/main/java/org/teiid/metadata/AbstractMetadataRecord.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/api/src/main/java/org/teiid/metadata/AbstractMetadataRecord.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -53,7 +53,6 @@
     
     private String uuid; //globally unique id
     private String name; //contextually unique name
-    private String canonicalName;
     
     private String nameInSource;
 	
@@ -102,11 +101,10 @@
 	
 	public void setName(String name) {
 		this.name = DataTypeManager.getCanonicalString(name);
-		this.canonicalName = DataTypeManager.getCanonicalString(name.toUpperCase());
 	}
 	
 	public String getCanonicalName() {
-		return canonicalName;
+		return name.toUpperCase();
 	}
 	
     public String toString() {

Modified: trunk/api/src/main/java/org/teiid/metadata/BaseColumn.java
===================================================================
--- trunk/api/src/main/java/org/teiid/metadata/BaseColumn.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/api/src/main/java/org/teiid/metadata/BaseColumn.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -123,7 +123,7 @@
 	}
 
 	public void setRuntimeType(String string) {
-		runtimeType = string;
+		runtimeType = DataTypeManager.getCanonicalString(string);
 	}
 
 	public void setDatatypeUUID(String string) {

Modified: trunk/api/src/main/java/org/teiid/metadata/MetadataStore.java
===================================================================
--- trunk/api/src/main/java/org/teiid/metadata/MetadataStore.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/api/src/main/java/org/teiid/metadata/MetadataStore.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -23,10 +23,12 @@
 package org.teiid.metadata;
 
 import java.io.Serializable;
+import java.util.ArrayList;
 import java.util.Collection;
-import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
+import java.util.List;
 import java.util.Map;
+import java.util.TreeMap;
 
 /**
  * Simple holder for metadata.
@@ -34,7 +36,8 @@
 public class MetadataStore implements Serializable {
 
 	private static final long serialVersionUID = -3130247626435324312L;
-	protected Map<String, Schema> schemas = new LinkedHashMap<String, Schema>();
+	protected Map<String, Schema> schemas = new TreeMap<String, Schema>(String.CASE_INSENSITIVE_ORDER);
+	protected List<Schema> schemaList = new ArrayList<Schema>(); //used for a stable ordering
 	protected Collection<Datatype> datatypes = new LinkedHashSet<Datatype>();
 	
 	public Map<String, Schema> getSchemas() {
@@ -42,9 +45,14 @@
 	}
 	
 	public void addSchema(Schema schema) {
-		this.schemas.put(schema.getCanonicalName(), schema);
+		this.schemas.put(schema.getName(), schema);
+		this.schemaList.add(schema);
 	}
 	
+	public List<Schema> getSchemaList() {
+		return schemaList;
+	}
+	
 	public void addDatatype(Datatype datatype) {
 		this.datatypes.add(datatype);
 	}

Modified: trunk/api/src/main/java/org/teiid/metadata/Schema.java
===================================================================
--- trunk/api/src/main/java/org/teiid/metadata/Schema.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/api/src/main/java/org/teiid/metadata/Schema.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -25,6 +25,7 @@
 import java.io.IOException;
 import java.util.LinkedHashMap;
 import java.util.Map;
+import java.util.TreeMap;
 
 import org.teiid.connector.DataPlugin;
 
@@ -36,27 +37,27 @@
     private boolean isVisible = true;
     private String primaryMetamodelUri = "http://www.metamatrix.com/metamodels/Relational"; //$NON-NLS-1$
     
-    private Map<String, Table> tables = new LinkedHashMap<String, Table>();
-	private Map<String, Procedure> procedures = new LinkedHashMap<String, Procedure>();
-	private Map<String, FunctionMethod> functions = new LinkedHashMap<String, FunctionMethod>();
+    private Map<String, Table> tables = new TreeMap<String, Table>(String.CASE_INSENSITIVE_ORDER);
+	private Map<String, Procedure> procedures = new TreeMap<String, Procedure>(String.CASE_INSENSITIVE_ORDER);
+	private Map<String, FunctionMethod> functions = new TreeMap<String, FunctionMethod>(String.CASE_INSENSITIVE_ORDER);
 	
 	public void addTable(Table table) {
 		table.setParent(this);
-		if (this.tables.put(table.getCanonicalName(), table) != null) {
+		if (this.tables.put(table.getName(), table) != null) {
 			throw new DuplicateRecordException(DataPlugin.Util.getString("Schema.duplicate_table", table.getName())); //$NON-NLS-1$
 		}
 	}
 	
 	public void addProcedure(Procedure procedure) {
 		procedure.setParent(this);
-		if (this.procedures.put(procedure.getCanonicalName(), procedure) != null) {
+		if (this.procedures.put(procedure.getName(), procedure) != null) {
 			throw new DuplicateRecordException(DataPlugin.Util.getString("Schema.duplicate_procedure", procedure.getName())); //$NON-NLS-1$
 		}
 	}
 	
 	public void addFunction(FunctionMethod function) {
 		function.setParent(this);
-		if (this.functions.put(function.getCanonicalName(), function) != null) {
+		if (this.functions.put(function.getName(), function) != null) {
 			throw new DuplicateRecordException(DataPlugin.Util.getString("Schema.duplicate_function", function.getName())); //$NON-NLS-1$
 		}
 	}	

Modified: trunk/build/kits/jboss-as7/docs/teiid/teiid-releasenotes.html
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/teiid-releasenotes.html	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/build/kits/jboss-as7/docs/teiid/teiid-releasenotes.html	2011-12-14 22:19:17 UTC (rev 3740)
@@ -56,6 +56,7 @@
   <li>BigDecimal division that returns a quotient that is equal to zero will have a scale of zero as well. Prior releases would typically return a zero value with a scale of 16.
   <li>The env function no longer returns the value for the session id, the session_id() function should be used instead.
   <li>The CommandContext no longer provides getEnvironmentProperties()
+  <li>Unaliased derived columns in the SELECT clause have different default names than prior releases.  The name will be exprX where X is the SELECT clause position.  
 </ul>
 
 <h4>from 7.5</h4>

Modified: trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/netezza/TestNetezzaConvertModifier.java
===================================================================
--- trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/netezza/TestNetezzaConvertModifier.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/netezza/TestNetezzaConvertModifier.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -22,29 +22,24 @@
 
 package org.teiid.translator.jdbc.netezza;
 
+import static org.junit.Assert.*;
+
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.util.Arrays;
 
-import junit.framework.TestCase;
-
+import org.junit.Test;
 import org.teiid.language.Expression;
 import org.teiid.language.Function;
 import org.teiid.language.LanguageFactory;
 import org.teiid.translator.TypeFacility;
 import org.teiid.translator.jdbc.SQLConversionVisitor;
 
+ at SuppressWarnings("nls")
+public class TestNetezzaConvertModifier {
 
-/**
- */
-public class TestNetezzaConvertModifier extends TestCase {
-
     private static final LanguageFactory LANG_FACTORY = new LanguageFactory();
 
-    public TestNetezzaConvertModifier(String name) {
-        super(name);
-    }
-
     public String helpGetString(Expression expr) throws Exception {
         NetezzaExecutionFactory trans = new NetezzaExecutionFactory();
         trans.start();
@@ -65,443 +60,440 @@
             expectedExpression, helpGetString(func)); 
     }
     
-    
-    
-
     // Source = STRING
-    public void testStringToChar() throws Exception {
+    @Test public void testStringToChar() throws Exception {
         helpTest(LANG_FACTORY.createLiteral("5", String.class), "char", "cast('5' AS char(1))"); 
     }
 
-    public void testStringToBoolean() throws Exception {
+    @Test public void testStringToBoolean() throws Exception {
         helpTest(LANG_FACTORY.createLiteral("5", String.class), "boolean", "CASE WHEN '5' IN ('false', '0') THEN '0' WHEN '5' IS NOT NULL THEN '1' END"); 
     }
 
-    public void testStringToByte() throws Exception {
+    @Test public void testStringToByte() throws Exception {
         helpTest(LANG_FACTORY.createLiteral("5", String.class), "byte", "cast('5' AS byteint)"); 
     }
 
-    public void testStringToShort() throws Exception {
+    @Test public void testStringToShort() throws Exception {
         helpTest(LANG_FACTORY.createLiteral("5", String.class), "short", "cast('5' AS smallint)"); 
     }
 
-    public void testStringToInteger() throws Exception {
+    @Test public void testStringToInteger() throws Exception {
         helpTest(LANG_FACTORY.createLiteral("5", String.class), "integer", "cast('5' AS integer)"); 
     }
 
-    public void testStringToLong() throws Exception {
+    @Test public void testStringToLong() throws Exception {
         helpTest(LANG_FACTORY.createLiteral("5", String.class), "long", "cast('5' AS bigint)"); 
     }
 
-    public void testStringToBigInteger() throws Exception {
+    @Test public void testStringToBigInteger() throws Exception {
         helpTest(LANG_FACTORY.createLiteral("5", String.class), "biginteger", "cast('5' AS numeric(38))");  //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
     }
 
-    public void testStringToFloat() throws Exception {
+    @Test public void testStringToFloat() throws Exception {
         helpTest(LANG_FACTORY.createLiteral("5", String.class), "float", "cast('5' AS float)");
     }
 
-    public void testStringToDouble() throws Exception {
+    @Test public void testStringToDouble() throws Exception {
         helpTest(LANG_FACTORY.createLiteral("5", String.class), "double", "cast('5' AS double)"); 
     }
 
-    public void testStringToDate() throws Exception {
+    @Test public void testStringToDate() throws Exception {
         helpTest(LANG_FACTORY.createLiteral("2004-06-29", String.class), "date", "to_date('2004-06-29', 'YYYY-MM-DD')"); 
     }
 
-    public void testStringToTime() throws Exception {
+    @Test public void testStringToTime() throws Exception {
         helpTest(LANG_FACTORY.createLiteral("23:59:59", String.class), "time", "to_timestamp('23:59:59', 'HH24:MI:SS')"); 
     }
 
-    public void testStringToTimestamp() throws Exception {
+    @Test public void testStringToTimestamp() throws Exception {
         helpTest(LANG_FACTORY.createLiteral("2004-06-29 23:59:59.987", String.class), "timestamp", "to_timestamp('2004-06-29 23:59:59.987', 'YYYY-MM-DD HH24:MI:SS.MS')"); 
     }
 
-    public void testStringToBigDecimal() throws Exception {
+    @Test public void testStringToBigDecimal() throws Exception {
         helpTest(LANG_FACTORY.createLiteral("5", String.class), "bigdecimal", "cast('5' AS numeric(38,18))"); 
     }
 
     // Source = CHAR
     
-    public void testCharToString() throws Exception {
+    @Test public void testCharToString() throws Exception {
         helpTest(LANG_FACTORY.createLiteral(new Character('5'), Character.class), "string", "'5'"); 
     }
 
     // Source = BOOLEAN
     
-    public void testBooleanToString() throws Exception {
+    @Test public void testBooleanToString() throws Exception {
         helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "string", "CASE WHEN 1 = '0' THEN 'false' WHEN 1 IS NOT NULL THEN 'true' END"); 
     }
 
-    public void testBooleanToByte() throws Exception {
+    @Test public void testBooleanToByte() throws Exception {
         helpTest(LANG_FACTORY.createLiteral(Boolean.FALSE, Boolean.class), "byte", "(CASE WHEN 0 IN ( '0', 'FALSE') THEN 0 WHEN 0 IS NOT NULL THEN 1 END)"); 
     }
 
-    public void testBooleanToShort() throws Exception {
+    @Test public void testBooleanToShort() throws Exception {
         helpTest(LANG_FACTORY.createLiteral(Boolean.FALSE, Boolean.class), "short", "(CASE WHEN 0 IN ( '0', 'FALSE') THEN 0 WHEN 0 IS NOT NULL THEN 1 END)"); 
     }
 
-    public void testBooleanToInteger() throws Exception {
+    @Test public void testBooleanToInteger() throws Exception {
         helpTest(LANG_FACTORY.createLiteral(Boolean.FALSE, Boolean.class), "integer", "(CASE WHEN 0 IN ( '0', 'FALSE') THEN 0 WHEN 0 IS NOT NULL THEN 1 END)"); 
     }
 
-    public void testBooleanToLong() throws Exception {
+    @Test public void testBooleanToLong() throws Exception {
         helpTest(LANG_FACTORY.createLiteral(Boolean.FALSE, Boolean.class), "long", "(CASE WHEN 0 IN ( '0', 'FALSE') THEN 0 WHEN 0 IS NOT NULL THEN 1 END)"); 
     }
 
-    public void testBooleanToBigInteger() throws Exception {
+    @Test public void testBooleanToBigInteger() throws Exception {
         helpTest(LANG_FACTORY.createLiteral(Boolean.FALSE, Boolean.class), "biginteger", "(CASE WHEN 0 IN ( '0', 'FALSE') THEN 0 WHEN 0 IS NOT NULL THEN 1 END)"); 
     }
 
-    public void testBooleanToFloat() throws Exception {
+    @Test public void testBooleanToFloat() throws Exception {
         helpTest(LANG_FACTORY.createLiteral(Boolean.FALSE, Boolean.class), "float", "(CASE WHEN 0 IN ( '0', 'FALSE') THEN 0 WHEN 0 IS NOT NULL THEN 1 END)"); 
     }
 
-    public void testBooleanToDouble() throws Exception {
+    @Test public void testBooleanToDouble() throws Exception {
         helpTest(LANG_FACTORY.createLiteral(Boolean.FALSE, Boolean.class), "double", "(CASE WHEN 0 IN ( '0', 'FALSE') THEN 0 WHEN 0 IS NOT NULL THEN 1 END)"); 
     }
 
-    public void testBooleanToBigDecimal() throws Exception {
+    @Test public void testBooleanToBigDecimal() throws Exception {
         helpTest(LANG_FACTORY.createLiteral(Boolean.FALSE, Boolean.class), "bigdecimal", "(CASE WHEN 0 IN ( '0', 'FALSE') THEN 0 WHEN 0 IS NOT NULL THEN 1 END)"); 
     }
     
     // Source = BYTE
     
-    public void testByteToString() throws Exception {
+    @Test public void testByteToString() throws Exception {
         helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "string", "cast(1 AS varchar(4000))"); 
     }
 
-    public void testByteToBoolean() throws Exception {
+    @Test public void testByteToBoolean() throws Exception {
         helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "boolean", "CASE WHEN 1 = 0 THEN '0' WHEN 1 IS NOT NULL THEN '1' END"); 
     }
 
-//    public void testByteToShort() throws Exception {
+//    @Test public void testByteToShort() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "short", "1"); 
 //    }
 //
-//    public void testByteToInteger() throws Exception {
+//    @Test public void testByteToInteger() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "integer", "integer(1)"); 
 //    }
 //
-//    public void testByteToLong() throws Exception {
+//    @Test public void testByteToLong() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "long", "bigint(1)"); 
 //    }
 //
-//    public void testByteToBigInteger() throws Exception {
+//    @Test public void testByteToBigInteger() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "biginteger", "cast(1 AS numeric(31,0))"); 
 //    }
 //
-//    public void testByteToFloat() throws Exception {
+//    @Test public void testByteToFloat() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "float", "cast(1 AS real)"); 
 //    }
 //
-//    public void testByteToDouble() throws Exception {
+//    @Test public void testByteToDouble() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "double", "double(1)"); 
 //    }
 //
-//    public void testByteToBigDecimal() throws Exception {
+//    @Test public void testByteToBigDecimal() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "bigdecimal", "cast(1 AS numeric(31,12))"); 
 //    }
 
     // Source = SHORT
     
-    public void testShortToString() throws Exception {
+    @Test public void testShortToString() throws Exception {
         helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "string", "cast(1 AS varchar(4000))"); 
     }
 
-    public void testShortToBoolean() throws Exception {
+    @Test public void testShortToBoolean() throws Exception {
         helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "boolean", "CASE WHEN 1 = 0 THEN '0' WHEN 1 IS NOT NULL THEN '1' END"); 
     }
 
-//    public void testShortToByte() throws Exception {
+//    @Test public void testShortToByte() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "byte", "1"); 
 //    }
 //
-//    public void testShortToInteger() throws Exception {
+//    @Test public void testShortToInteger() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "integer", "integer(1)"); 
 //    }
 //
-//    public void testShortToLong() throws Exception {
+//    @Test public void testShortToLong() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "long", "bigint(1)"); 
 //    }
 //
-//    public void testShortToBigInteger() throws Exception {
+//    @Test public void testShortToBigInteger() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "biginteger", "cast(1 AS numeric(31,0))"); 
 //    }
 //
-//    public void testShortToFloat() throws Exception {
+//    @Test public void testShortToFloat() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "float", "cast(1 AS real)"); 
 //    }
 //
-//    public void testShortToDouble() throws Exception {
+//    @Test public void testShortToDouble() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "double", "double(1)"); 
 //    }
 //
-//    public void testShortToBigDecimal() throws Exception {
+//    @Test public void testShortToBigDecimal() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "bigdecimal", "cast(1 AS numeric(31,12))"); 
 //    }
 
     // Source = INTEGER
     
-    public void testIntegerToString() throws Exception {
+    @Test public void testIntegerToString() throws Exception {
         helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "string", "cast(1 AS varchar(4000))"); 
     }
 
-    public void testIntegerToBoolean() throws Exception {
+    @Test public void testIntegerToBoolean() throws Exception {
         helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "boolean", "CASE WHEN 1 = 0 THEN '0' WHEN 1 IS NOT NULL THEN '1' END"); 
     }
 
-//    public void testIntegerToByte() throws Exception {
+//    @Test public void testIntegerToByte() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "byte", "smallint(1)"); 
 //    }
 //
-//    public void testIntegerToShort() throws Exception {
+//    @Test public void testIntegerToShort() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "short", "smallint(1)"); 
 //    }
 //
-//    public void testIntegerToLong() throws Exception {
+//    @Test public void testIntegerToLong() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "long", "bigint(1)"); 
 //    }
 //
-//    public void testIntegerToBigInteger() throws Exception {
+//    @Test public void testIntegerToBigInteger() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "biginteger", "cast(1 AS numeric(31,0))"); 
 //    }
 //
-//    public void testIntegerToFloat() throws Exception {
+//    @Test public void testIntegerToFloat() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "float", "cast(1 AS real)"); 
 //    }
 //
-//    public void testIntegerToDouble() throws Exception {
+//    @Test public void testIntegerToDouble() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "double", "double(1)"); 
 //    }
 //
-//    public void testIntegerToBigDecimal() throws Exception {
+//    @Test public void testIntegerToBigDecimal() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "bigdecimal", "cast(1 AS numeric(31,12))"); 
 //    }
 
     // Source = LONG
     
-    public void testLongToString() throws Exception {
+    @Test public void testLongToString() throws Exception {
         helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "string", "cast(1 AS varchar(4000))"); 
     }
 
-    public void testLongToBoolean() throws Exception {
+    @Test public void testLongToBoolean() throws Exception {
         helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "boolean", "CASE WHEN 1 = 0 THEN '0' WHEN 1 IS NOT NULL THEN '1' END"); 
     }
 
-//    public void testLongToByte() throws Exception {
+//    @Test public void testLongToByte() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "byte", "smallint(1)"); 
 //    }
 //
-//    public void testLongToShort() throws Exception {
+//    @Test public void testLongToShort() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "short", "smallint(1)"); 
 //    }
 //
-//    public void testLongToInteger() throws Exception {
+//    @Test public void testLongToInteger() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "integer", "integer(1)"); 
 //    }
 //
-//    public void testLongToBigInteger() throws Exception {
+//    @Test public void testLongToBigInteger() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "biginteger", "cast(1 AS numeric(31,0))"); 
 //    }
 //
-//    public void testLongToFloat() throws Exception {
+//    @Test public void testLongToFloat() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "float", "cast(1 AS real)"); 
 //    }
 //
-//    public void testLongToDouble() throws Exception {
+//    @Test public void testLongToDouble() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "double", "double(1)"); 
 //    }
 //
-//    public void testLongToBigDecimal() throws Exception {
+//    @Test public void testLongToBigDecimal() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "bigdecimal", "cast(1 AS numeric(31,12))"); 
 //    }
 
     // Source = BIGINTEGER
     
-    public void testBigIntegerToString() throws Exception {
+    @Test public void testBigIntegerToString() throws Exception {
         helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "string", "cast(1 AS varchar(4000))"); 
     }
 
-    public void testBigIntegerToBoolean() throws Exception {
+    @Test public void testBigIntegerToBoolean() throws Exception {
         helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "boolean", "CASE WHEN 1 = 0 THEN '0' WHEN 1 IS NOT NULL THEN '1' END"); 
     }
 
-//    public void testBigIntegerToByte() throws Exception {
+//    @Test public void testBigIntegerToByte() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "byte", "smallint(1)"); 
 //    }
 //
-//    public void testBigIntegerToShort() throws Exception {
+//    @Test public void testBigIntegerToShort() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "short", "smallint(1)"); 
 //    }
 //
-//    public void testBigIntegerToInteger() throws Exception {
+//    @Test public void testBigIntegerToInteger() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "integer", "integer(1)"); 
 //    }
 //
-//    public void testBigIntegerToLong() throws Exception {
+//    @Test public void testBigIntegerToLong() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "long", "bigint(1)"); 
 //    }
 //
-//    public void testBigIntegerToFloat() throws Exception {
+//    @Test public void testBigIntegerToFloat() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "float", "cast(1 AS real)"); 
 //    }
 //
-//    public void testBigIntegerToDouble() throws Exception {
+//    @Test public void testBigIntegerToDouble() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "double", "double(1)"); 
 //    }
 //
-//    public void testBigIntegerToBigDecimal() throws Exception {
+//    @Test public void testBigIntegerToBigDecimal() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "bigdecimal", "cast(1 AS numeric(31,12))"); 
 //    }
 
     // Source = FLOAT
     
-    public void testFloatToString() throws Exception {
+    @Test public void testFloatToString() throws Exception {
         helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "string", "cast(1.2 AS varchar(4000))"); 
     }
 
-    public void testFloatToBoolean() throws Exception {
+    @Test public void testFloatToBoolean() throws Exception {
         helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "boolean", "CASE WHEN 1.2 = 0 THEN '0' WHEN 1.2 IS NOT NULL THEN '1' END"); 
     }
 
-//    public void testFloatToByte() throws Exception {
+//    @Test public void testFloatToByte() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "byte", "smallint(1.2)"); 
 //    }
 //
-//    public void testFloatToShort() throws Exception {
+//    @Test public void testFloatToShort() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "short", "smallint(1.2)"); 
 //    }
 //
-//    public void testFloatToInteger() throws Exception {
+//    @Test public void testFloatToInteger() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "integer", "integer(1.2)"); 
 //    }
 //
-//    public void testFloatToLong() throws Exception {
+//    @Test public void testFloatToLong() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "long", "bigint(1.2)"); 
 //    }
 //
-//    public void testFloatToBigInteger() throws Exception {
+//    @Test public void testFloatToBigInteger() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "biginteger", "cast(1.2 AS numeric(31,0))"); 
 //    }
 //
-//    public void testFloatToDouble() throws Exception {
+//    @Test public void testFloatToDouble() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "double", "double(1.2)"); 
 //    }
 //
-//    public void testFloatToBigDecimal() throws Exception {
+//    @Test public void testFloatToBigDecimal() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "bigdecimal", "cast(1.2 AS numeric(31,12))"); 
 //    }
 
     // Source = DOUBLE
     
-    public void testDoubleToString() throws Exception {
+    @Test public void testDoubleToString() throws Exception {
         helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "string", "cast(1.2 AS varchar(4000))"); 
     }
 
-    public void testDoubleToBoolean() throws Exception {
+    @Test public void testDoubleToBoolean() throws Exception {
         helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "boolean", "CASE WHEN 1.2 = 0 THEN '0' WHEN 1.2 IS NOT NULL THEN '1' END"); 
     }
 
-//    public void testDoubleToByte() throws Exception {
+//    @Test public void testDoubleToByte() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "byte", "smallint(1.2)"); 
 //    }
 //
-//    public void testDoubleToShort() throws Exception {
+//    @Test public void testDoubleToShort() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "short", "smallint(1.2)"); 
 //    }
 //
-//    public void testDoubleToInteger() throws Exception {
+//    @Test public void testDoubleToInteger() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "integer", "integer(1.2)"); 
 //    }
 //
-//    public void testDoubleToLong() throws Exception {
+//    @Test public void testDoubleToLong() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "long", "bigint(1.2)"); 
 //    }
 //
-//    public void testDoubleToBigInteger() throws Exception {
+//    @Test public void testDoubleToBigInteger() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "biginteger", "cast(1.2 AS numeric(31,0))"); 
 //    }
 //
-//    public void testDoubleToFloat() throws Exception {
+//    @Test public void testDoubleToFloat() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "float", "cast(1.2 AS real)"); 
 //    }
 //
-//    public void testDoubleToBigDecimal() throws Exception {
+//    @Test public void testDoubleToBigDecimal() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "bigdecimal", "cast(1.2 AS numeric(31,12))"); 
 //    }
 
     // Source = BIGDECIMAL
     
-    public void testBigDecimalToString() throws Exception {
+    @Test public void testBigDecimalToString() throws Exception {
         helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "string", "cast(1.0 AS varchar(4000))"); 
     }
 
-    public void testBigDecimalToBoolean() throws Exception {
+    @Test public void testBigDecimalToBoolean() throws Exception {
         helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "boolean", "CASE WHEN 1.0 = 0 THEN '0' WHEN 1.0 IS NOT NULL THEN '1' END"); 
     }
 
-//    public void testBigDecimalToByte() throws Exception {
+//    @Test public void testBigDecimalToByte() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "byte", "smallint(1.0)"); 
 //    }
 //
-//    public void testBigDecimalToShort() throws Exception {
+//    @Test public void testBigDecimalToShort() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "short", "smallint(1.0)"); 
 //    }
 //
-//    public void testBigDecimalToInteger() throws Exception {
+//    @Test public void testBigDecimalToInteger() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "integer", "integer(1.0)"); 
 //    }
 //
-//    public void testBigDecimalToLong() throws Exception {
+//    @Test public void testBigDecimalToLong() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "long", "bigint(1.0)"); 
 //    }
 //
-//    public void testBigDecimalToBigInteger() throws Exception {
+//    @Test public void testBigDecimalToBigInteger() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "biginteger", "cast(1.0 AS numeric(31,0))"); 
 //    }
 //
-//    public void testBigDecimalToFloat() throws Exception {
+//    @Test public void testBigDecimalToFloat() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "float", "cast(1.0 AS real)"); 
 //    }
 //
-//    public void testBigDecimalToDouble() throws Exception {
+//    @Test public void testBigDecimalToDouble() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "double", "double(1.0)"); 
 //    }
 
 //    // Source = DATE
 //
-//    public void testDateToString() throws Exception {
+//    @Test public void testDateToString() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createDate(103, 10, 1), java.sql.Date.class), "string", "char({d '2003-11-01'})"); 
 //    }
 //
-//    public void testDateToTimestamp() throws Exception {
+//    @Test public void testDateToTimestamp() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createDate(103, 10, 1), java.sql.Date.class), "timestamp", "timestamp({d '2003-11-01'}, '00:00:00')"); 
 //    }
 //
 //    // Source = TIME
 //
-//    public void testTimeToString() throws Exception {
+//    @Test public void testTimeToString() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createTime(23, 59, 59), java.sql.Time.class), "string", "char({t '23:59:59'})"); 
 //    }
 //
-//    public void testTimeToTimestamp() throws Exception {
+//    @Test public void testTimeToTimestamp() throws Exception {
 //        helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createTime(23, 59, 59), java.sql.Time.class), "timestamp", "timestamp('1970-01-01', {t '23:59:59'})"); 
 //    }
 //
 //    // Source = TIMESTAMP
 //    
-//    public void testTimestampToString() throws Exception {
+//    @Test public void testTimestampToString() throws Exception {
 //        Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);        
 //        helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "string", "char({ts '2003-11-01 12:05:02.0'})"); 
 //    }
 //
-//    public void testTimestampToDate() throws Exception {
+//    @Test public void testTimestampToDate() throws Exception {
 //        Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);        
 //        helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "date", "date({ts '2003-11-01 12:05:02.0'})"); 
 //    }
 //
-//    public void testTimestampToTime() throws Exception {
+//    @Test public void testTimestampToTime() throws Exception {
 //        Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);        
 //        helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "time", "time({ts '2003-11-01 12:05:02.0'})"); 
 //    }

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -35,37 +35,10 @@
 import org.teiid.core.TeiidComponentException;
 import org.teiid.core.TeiidException;
 import org.teiid.core.TeiidRuntimeException;
-import org.teiid.language.AggregateFunction;
-import org.teiid.language.AndOr;
-import org.teiid.language.Argument;
-import org.teiid.language.BatchedUpdates;
-import org.teiid.language.Call;
-import org.teiid.language.ColumnReference;
-import org.teiid.language.Condition;
+import org.teiid.language.*;
 import org.teiid.language.DerivedColumn;
-import org.teiid.language.DerivedTable;
-import org.teiid.language.Exists;
-import org.teiid.language.ExpressionValueSource;
-import org.teiid.language.In;
-import org.teiid.language.InsertValueSource;
-import org.teiid.language.IsNull;
-import org.teiid.language.IteratorValueSource;
-import org.teiid.language.Join;
-import org.teiid.language.Like;
-import org.teiid.language.Literal;
-import org.teiid.language.NamedTable;
-import org.teiid.language.Not;
-import org.teiid.language.QueryExpression;
-import org.teiid.language.SearchedCase;
-import org.teiid.language.SearchedWhenClause;
 import org.teiid.language.Select;
-import org.teiid.language.SortSpecification;
-import org.teiid.language.SubqueryComparison;
-import org.teiid.language.SubqueryIn;
-import org.teiid.language.TableReference;
 import org.teiid.language.WindowSpecification;
-import org.teiid.language.With;
-import org.teiid.language.WithItem;
 import org.teiid.language.Argument.Direction;
 import org.teiid.language.Comparison.Operator;
 import org.teiid.language.SortSpecification.Ordering;
@@ -74,50 +47,20 @@
 import org.teiid.metadata.ProcedureParameter;
 import org.teiid.metadata.FunctionMethod.PushDown;
 import org.teiid.query.metadata.QueryMetadataInterface;
-import org.teiid.query.sql.lang.BatchedUpdateCommand;
+import org.teiid.query.sql.lang.*;
 import org.teiid.query.sql.lang.Command;
-import org.teiid.query.sql.lang.CompareCriteria;
-import org.teiid.query.sql.lang.CompoundCriteria;
-import org.teiid.query.sql.lang.Criteria;
 import org.teiid.query.sql.lang.Delete;
-import org.teiid.query.sql.lang.ExistsCriteria;
-import org.teiid.query.sql.lang.FromClause;
 import org.teiid.query.sql.lang.GroupBy;
 import org.teiid.query.sql.lang.Insert;
-import org.teiid.query.sql.lang.IsNullCriteria;
-import org.teiid.query.sql.lang.JoinPredicate;
-import org.teiid.query.sql.lang.JoinType;
 import org.teiid.query.sql.lang.Limit;
-import org.teiid.query.sql.lang.MatchCriteria;
-import org.teiid.query.sql.lang.NotCriteria;
 import org.teiid.query.sql.lang.OrderBy;
-import org.teiid.query.sql.lang.OrderByItem;
-import org.teiid.query.sql.lang.Query;
-import org.teiid.query.sql.lang.QueryCommand;
-import org.teiid.query.sql.lang.SPParameter;
 import org.teiid.query.sql.lang.SetClause;
-import org.teiid.query.sql.lang.SetClauseList;
-import org.teiid.query.sql.lang.SetCriteria;
 import org.teiid.query.sql.lang.SetQuery;
-import org.teiid.query.sql.lang.StoredProcedure;
-import org.teiid.query.sql.lang.SubqueryCompareCriteria;
-import org.teiid.query.sql.lang.SubqueryFromClause;
-import org.teiid.query.sql.lang.SubquerySetCriteria;
-import org.teiid.query.sql.lang.UnaryFromClause;
 import org.teiid.query.sql.lang.Update;
-import org.teiid.query.sql.lang.WithQueryCommand;
-import org.teiid.query.sql.symbol.AggregateSymbol;
-import org.teiid.query.sql.symbol.AliasSymbol;
-import org.teiid.query.sql.symbol.Constant;
-import org.teiid.query.sql.symbol.ElementSymbol;
+import org.teiid.query.sql.symbol.*;
 import org.teiid.query.sql.symbol.Expression;
-import org.teiid.query.sql.symbol.ExpressionSymbol;
 import org.teiid.query.sql.symbol.Function;
-import org.teiid.query.sql.symbol.GroupSymbol;
 import org.teiid.query.sql.symbol.ScalarSubquery;
-import org.teiid.query.sql.symbol.SearchedCaseExpression;
-import org.teiid.query.sql.symbol.SelectSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 import org.teiid.query.sql.symbol.WindowFunction;
 import org.teiid.translator.TranslatorException;
 
@@ -182,13 +125,13 @@
 
     /* Query */
     Select translate(Query query) {
-        List<SelectSymbol> symbols = query.getSelect().getSymbols();
+        List<Expression> symbols = query.getSelect().getSymbols();
         List<DerivedColumn> translatedSymbols = new ArrayList<DerivedColumn>(symbols.size());
-        for (Iterator<SelectSymbol> i = symbols.iterator(); i.hasNext();) {
-            SingleElementSymbol symbol = (SingleElementSymbol)i.next();
+        for (Iterator<Expression> i = symbols.iterator(); i.hasNext();) {
+            Expression symbol = i.next();
             String alias = null;
             if(symbol instanceof AliasSymbol) {
-                alias = symbol.getOutputName();
+                alias = ((AliasSymbol)symbol).getOutputName();
                 symbol = ((AliasSymbol)symbol).getSymbol();
             }
 
@@ -454,14 +397,14 @@
         List<OrderByItem> items = orderBy.getOrderByItems();
         List<SortSpecification> translatedItems = new ArrayList<SortSpecification>();
         for (int i = 0; i < items.size(); i++) {
-            SingleElementSymbol symbol = items.get(i).getSymbol();
+            Expression symbol = items.get(i).getSymbol();
             Ordering direction = items.get(i).isAscending() ? Ordering.ASC: Ordering.DESC;
             
             SortSpecification orderByItem = null;                                
             if(!set && (items.get(i).isUnrelated() || symbol instanceof ElementSymbol)){
             	orderByItem = new SortSpecification(direction, translate(symbol));                                
             } else {
-            	orderByItem = new SortSpecification(direction, new ColumnReference(null, SingleElementSymbol.getShortName(symbol.getOutputName()), null, symbol.getType()));
+            	orderByItem = new SortSpecification(direction, new ColumnReference(null, Symbol.getShortName(((Symbol)symbol).getOutputName()), null, symbol.getType()));
             }
             orderByItem.setNullOrdering(items.get(i).getNullOrdering());
             translatedItems.add(orderByItem);
@@ -475,6 +418,8 @@
         if (expr == null) return null;
         if (expr instanceof Constant) {
             return translate((Constant)expr);
+        } else if (expr instanceof AggregateSymbol) {
+            return translate((AggregateSymbol)expr);
         } else if (expr instanceof Function) {
             return translate((Function)expr);
         } else if (expr instanceof ScalarSubquery) {
@@ -483,8 +428,6 @@
             return translate((SearchedCaseExpression)expr);
         } else if (expr instanceof ElementSymbol) {
             return translate((ElementSymbol)expr);
-        } else if (expr instanceof AggregateSymbol) {
-            return translate((AggregateSymbol)expr);
         } else if (expr instanceof ExpressionSymbol) {
             return translate((ExpressionSymbol)expr);
         } else if (expr instanceof Criteria) {
@@ -536,7 +479,7 @@
         		name = function.getFunctionDescriptor().getMethod().getNameInSource();
         	}
         } else {
-        	name = SingleElementSymbol.getShortName(name);
+        	name = Symbol.getShortName(name);
         }
 
         //if there is any ambiguity in the function name it will be up to the translator logic to check the 
@@ -568,7 +511,7 @@
     }
 
     ColumnReference translate(ElementSymbol symbol) {
-        ColumnReference element = new ColumnReference(translate(symbol.getGroupSymbol()), SingleElementSymbol.getShortName(symbol.getOutputName()), null, symbol.getType());
+        ColumnReference element = new ColumnReference(translate(symbol.getGroupSymbol()), Symbol.getShortName(symbol.getOutputName()), null, symbol.getType());
         if (element.getTable().getMetadataObject() == null) {
             return element;
         }
@@ -746,7 +689,7 @@
 
 	private String removeSchemaName(String fullGroup) {
 		//remove the model name
-        int index = fullGroup.indexOf(ElementSymbol.SEPARATOR);
+        int index = fullGroup.indexOf(Symbol.SEPARATOR);
         if (index > 0) {
         	fullGroup = fullGroup.substring(index + 1);
         }

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	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -539,7 +539,7 @@
 	
 	private List<Schema> getVisibleSchemas(VDBMetaData vdb, CompositeMetadataStore metadata) {
 		ArrayList<Schema> result = new ArrayList<Schema>(); 
-		for (Schema schema : metadata.getSchemas().values()) {
+		for (Schema schema : metadata.getSchemaList()) {
 			if(vdb.isVisible(schema.getName())) {
 				result.add(schema);
 			}

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -63,8 +63,8 @@
 import org.teiid.query.sql.lang.BatchedUpdateCommand;
 import org.teiid.query.sql.lang.Command;
 import org.teiid.query.sql.lang.ProcedureContainer;
+import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 import org.teiid.translator.DataNotAvailableException;
 import org.teiid.translator.TranslatorException;
 
@@ -112,12 +112,12 @@
         this.cwi = cwi;
         this.dtm = dtm;
         this.limit = limit;
-		List<SingleElementSymbol> symbols = this.aqr.getCommand().getProjectedSymbols();
+		List<Expression> symbols = this.aqr.getCommand().getProjectedSymbols();
 		this.schema = new Class[symbols.size()];
         this.convertToDesiredRuntimeType = new boolean[symbols.size()];
 		this.convertToRuntimeType = new boolean[symbols.size()];
 		for (int i = 0; i < symbols.size(); i++) {
-			SingleElementSymbol symbol = symbols.get(i);
+			Expression symbol = symbols.get(i);
 			this.schema[i] = symbol.getType();
 			this.convertToDesiredRuntimeType[i] = true;
 			this.convertToRuntimeType[i] = true;

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -63,9 +63,10 @@
 import org.teiid.query.sql.symbol.Function;
 import org.teiid.query.sql.symbol.GroupSymbol;
 import org.teiid.query.sql.symbol.Reference;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Symbol;
 import org.teiid.query.sql.symbol.WindowFunction;
 import org.teiid.query.sql.symbol.AggregateSymbol.Type;
+import org.teiid.query.sql.util.SymbolMap;
 import org.teiid.query.sql.visitor.ReferenceCollectorVisitor;
 import org.teiid.query.tempdata.TempTableStore;
 
@@ -186,7 +187,7 @@
 					ex = ((Function)ex).getArg(0);
 				}
 				if (ex instanceof Reference) {
-					paramMap.put((Reference)ex, SingleElementSymbol.getShortName(spParameter.getName()));
+					paramMap.put((Reference)ex, Symbol.getShortName(spParameter.getName()));
 				}
 			}
         }
@@ -203,19 +204,19 @@
     private Map[] createProjectedSymbolMetadata(Command originalCommand) throws TeiidComponentException {
         Map[] columnMetadata;
         // Allow command to use temporary metadata
-        Map tempMetadata = originalCommand.getTemporaryMetadata();
-        if(tempMetadata != null && tempMetadata.size() > 0) {
-            TempMetadataAdapter tempFacade = new TempMetadataAdapter(this.metadata, new TempMetadataStore(tempMetadata));
+        TempMetadataStore tempMetadata = originalCommand.getTemporaryMetadata();
+        if(tempMetadata != null && tempMetadata.getData().size() > 0) {
+            TempMetadataAdapter tempFacade = new TempMetadataAdapter(this.metadata, tempMetadata);
             this.metadata = tempFacade; 
         }
         
-        List<SingleElementSymbol> projectedSymbols = originalCommand.getProjectedSymbols();
+        List<Expression> projectedSymbols = originalCommand.getProjectedSymbols();
         columnMetadata = new Map[projectedSymbols.size()];
         
-        Iterator<SingleElementSymbol> symbolIter = projectedSymbols.iterator();
+        Iterator<Expression> symbolIter = projectedSymbols.iterator();
         for(int i=0; symbolIter.hasNext(); i++) {
-            SingleElementSymbol symbol = symbolIter.next();
-            String shortColumnName = SingleElementSymbol.getShortName(symbol.getOutputName());
+            Expression symbol = symbolIter.next();
+            String shortColumnName = Symbol.getShortName(Symbol.getOutputName(symbol));
             if(symbol instanceof AliasSymbol) {
                 symbol = ((AliasSymbol)symbol).getSymbol();
             }
@@ -255,14 +256,16 @@
         return xmlMetadata;
     }
 
-    private Map createColumnMetadata(String label, SingleElementSymbol symbol) throws QueryMetadataException, TeiidComponentException {
+    private Map createColumnMetadata(String label, Expression symbol) throws QueryMetadataException, TeiidComponentException {
         if(symbol instanceof ElementSymbol) {
             return createElementMetadata(label, (ElementSymbol) symbol);        
-        } else if(symbol instanceof AggregateSymbol) {
-            return createAggregateMetadata(label, (AggregateSymbol) symbol);
-        } else if (symbol instanceof WindowFunction) {
-        	return createAggregateMetadata(label, ((WindowFunction) symbol).getFunction());
         }
+        symbol = SymbolMap.getExpression(symbol);
+    	if (symbol instanceof AggregateSymbol) {
+    		return createAggregateMetadata(label, (AggregateSymbol)symbol);
+    	} else if (symbol instanceof WindowFunction) {
+    		return createAggregateMetadata(label, ((WindowFunction)symbol).getFunction());        		
+    	}
         return createTypedMetadata(label, symbol);            
     }
     
@@ -339,13 +342,13 @@
         Type function = symbol.getAggregateFunction();
         if(function == Type.MIN || function == Type.MAX){
             if(expression instanceof ElementSymbol) {
-                return createColumnMetadata(shortColumnName, (ElementSymbol)expression);
+                return createColumnMetadata(shortColumnName, expression);
             }
         }
         return createTypedMetadata(shortColumnName, symbol);
     }
 
-    private Map createTypedMetadata(String shortColumnName, SingleElementSymbol symbol) {
+    private Map createTypedMetadata(String shortColumnName, Expression symbol) {
         return getDefaultColumn(null, shortColumnName, symbol.getType());
     }
     

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -76,7 +76,8 @@
 import org.teiid.query.sql.lang.Command;
 import org.teiid.query.sql.lang.SPParameter;
 import org.teiid.query.sql.lang.StoredProcedure;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Expression;
+import org.teiid.query.sql.symbol.Symbol;
 import org.teiid.query.util.CommandContext;
 
 public class RequestWorkItem extends AbstractWorkItem implements PrioritizedRunnable {
@@ -696,13 +697,13 @@
         return result;
 	}
     
-    public ResultsMessage createResultsMessage(List<? extends List<?>> batch, List columnSymbols) {
+    public ResultsMessage createResultsMessage(List<? extends List<?>> batch, List<? extends Expression> columnSymbols) {
         String[] columnNames = new String[columnSymbols.size()];
         String[] dataTypes = new String[columnSymbols.size()];
 
         for(int i=0; i<columnSymbols.size(); i++) {
-            SingleElementSymbol symbol = (SingleElementSymbol) columnSymbols.get(i);
-            columnNames[i] = SingleElementSymbol.getShortName(symbol.getOutputName());
+            Expression symbol = columnSymbols.get(i);
+            columnNames[i] = Symbol.getShortName(Symbol.getOutputName(symbol));
             dataTypes[i] = DataTypeManager.getDataTypeName(symbol.getType());
         }
         ResultsMessage result = new ResultsMessage(batch, columnNames, dataTypes);

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/multisource/MultiSourceMetadataWrapper.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/multisource/MultiSourceMetadataWrapper.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/multisource/MultiSourceMetadataWrapper.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -35,7 +35,7 @@
 import org.teiid.query.metadata.BasicQueryMetadataWrapper;
 import org.teiid.query.metadata.QueryMetadataInterface;
 import org.teiid.query.metadata.SupportConstants;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Symbol;
 
 
 /**
@@ -44,7 +44,7 @@
  */
 public class MultiSourceMetadataWrapper extends BasicQueryMetadataWrapper {
 	
-    private static final String SUFFIX = SingleElementSymbol.SEPARATOR + MultiSourceElement.MULTI_SOURCE_ELEMENT_NAME;
+    private static final String SUFFIX = Symbol.SEPARATOR + MultiSourceElement.MULTI_SOURCE_ELEMENT_NAME;
 	private Set<String> multiSourceModels;
     
     public MultiSourceMetadataWrapper(QueryMetadataInterface actualMetadata, Set<String> multiSourceModels){

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/multisource/MultiSourcePlanToProcessConverter.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/multisource/MultiSourcePlanToProcessConverter.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/multisource/MultiSourcePlanToProcessConverter.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -65,8 +65,7 @@
 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.ExpressionSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Symbol;
 import org.teiid.query.util.CommandContext;
 
 
@@ -178,7 +177,7 @@
                 	//should return a 0 update count
                 	ProjectNode pnode = new ProjectNode(getID());
                 	pnode.setElements(accessNode.getElements());
-                	pnode.setSelectSymbols(Arrays.asList(new ExpressionSymbol("x", new Constant(0)))); //$NON-NLS-1$
+                	pnode.setSelectSymbols(Arrays.asList(new Constant(0)));
                 	return pnode;
                 }
                 // Replace existing access node with a NullNode
@@ -208,8 +207,8 @@
             	if (RelationalNodeUtil.isUpdate(accessNode.getCommand())) {
             		update = true;
             		GroupingNode groupNode = new GroupingNode(getID());                    
-            		AggregateSymbol sumCount = new AggregateSymbol("SumCount", NonReserved.SUM, false, (Expression)accessNode.getElements().get(0)); //$NON-NLS-1$          		
-            		List<SingleElementSymbol> outputElements = new ArrayList<SingleElementSymbol>(1);            		
+            		AggregateSymbol sumCount = new AggregateSymbol("SumCount", NonReserved.SUM, false, accessNode.getElements().get(0)); //$NON-NLS-1$          		
+            		List<Expression> outputElements = new ArrayList<Expression>(1);            		
             		outputElements.add(sumCount); 
             		groupNode.setElements(outputElements);
             		groupNode.addChild(unionNode);
@@ -218,9 +217,8 @@
             		
             		Expression intSum = ResolverUtil.getConversion(sumCount, DataTypeManager.getDataTypeName(sumCount.getType()), DataTypeManager.DefaultDataTypes.INTEGER, false, metadata.getFunctionLibrary());
             		
-            		ExpressionSymbol rowCount = new ExpressionSymbol("RowCount", intSum); //$NON-NLS-1$            		
-            		outputElements = new ArrayList<SingleElementSymbol>(1);            		
-            		outputElements.add(rowCount);             		
+            		outputElements = new ArrayList<Expression>(1);            		
+            		outputElements.add(intSum);             		
             		projectNode.setElements(outputElements);
             		projectNode.setSelectSymbols(outputElements);
             		projectNode.addChild(groupNode);
@@ -240,7 +238,7 @@
 				if (param.getParameterType() != SPParameter.IN) {
 					continue;
 				}
-				String shortName = SingleElementSymbol.getShortName(param.getName());        
+				String shortName = Symbol.getShortName(param.getName());        
 			    if(shortName.equalsIgnoreCase(MultiSourceElement.MULTI_SOURCE_ELEMENT_NAME)) {
 		        	Constant source = (Constant)param.getExpression();
 		    		params.remove();

Modified: trunk/engine/src/main/java/org/teiid/query/analysis/AnalysisRecord.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/analysis/AnalysisRecord.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/analysis/AnalysisRecord.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -38,7 +38,8 @@
 import org.teiid.logging.MessageLevel;
 import org.teiid.query.sql.LanguageObject;
 import org.teiid.query.sql.lang.SubqueryContainer;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Expression;
+import org.teiid.query.sql.symbol.Symbol;
 import org.teiid.query.sql.visitor.ValueIteratorProviderCollectorVisitor;
 
 
@@ -208,12 +209,12 @@
 	 * @param projectedSymbols The list of SingleElementSymbol projected from a plan or node
 	 * @return List of output columns for sending to the client as part of the plan
 	 */                
-	public static List<String> getOutputColumnProperties(List<? extends SingleElementSymbol> projectedSymbols) {
+	public static List<String> getOutputColumnProperties(List<? extends Expression> projectedSymbols) {
 	    if(projectedSymbols != null) {
 	        List<String> outputCols = new ArrayList<String>(projectedSymbols.size());
 	        for(int i=0; i<projectedSymbols.size() ; i++) {
-	            SingleElementSymbol symbol = projectedSymbols.get(i);
-	            outputCols.add(symbol.getShortName() + " (" + DataTypeManager.getDataTypeName(symbol.getType()) + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+	            Expression symbol = projectedSymbols.get(i);
+	            outputCols.add(Symbol.getShortName(symbol) + " (" + DataTypeManager.getDataTypeName(symbol.getType()) + ")"); //$NON-NLS-1$ //$NON-NLS-2$
 	        }
 	        return outputCols;
 	    }

Modified: trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -54,16 +54,7 @@
 import org.teiid.core.TeiidComponentException;
 import org.teiid.core.TeiidProcessingException;
 import org.teiid.core.TeiidRuntimeException;
-import org.teiid.core.types.BlobType;
-import org.teiid.core.types.ClobImpl;
-import org.teiid.core.types.ClobType;
-import org.teiid.core.types.DataTypeManager;
-import org.teiid.core.types.InputStreamFactory;
-import org.teiid.core.types.SQLXMLImpl;
-import org.teiid.core.types.Sequencable;
-import org.teiid.core.types.Streamable;
-import org.teiid.core.types.TransformationException;
-import org.teiid.core.types.XMLType;
+import org.teiid.core.types.*;
 import org.teiid.core.types.XMLType.Type;
 import org.teiid.core.types.basic.StringToSQLXMLTransform;
 import org.teiid.core.util.EquivalenceUtil;
@@ -77,42 +68,8 @@
 import org.teiid.query.function.source.XMLSystemFunctions.XmlConcat;
 import org.teiid.query.processor.ProcessorDataManager;
 import org.teiid.query.sql.LanguageObject;
-import org.teiid.query.sql.lang.AbstractSetCriteria;
-import org.teiid.query.sql.lang.CollectionValueIterator;
-import org.teiid.query.sql.lang.CompareCriteria;
-import org.teiid.query.sql.lang.CompoundCriteria;
-import org.teiid.query.sql.lang.Criteria;
-import org.teiid.query.sql.lang.DependentSetCriteria;
-import org.teiid.query.sql.lang.ExistsCriteria;
-import org.teiid.query.sql.lang.ExpressionCriteria;
-import org.teiid.query.sql.lang.IsNullCriteria;
-import org.teiid.query.sql.lang.MatchCriteria;
-import org.teiid.query.sql.lang.NotCriteria;
-import org.teiid.query.sql.lang.SetCriteria;
-import org.teiid.query.sql.lang.SubqueryCompareCriteria;
-import org.teiid.query.sql.lang.SubqueryContainer;
-import org.teiid.query.sql.lang.SubquerySetCriteria;
-import org.teiid.query.sql.symbol.AggregateSymbol;
-import org.teiid.query.sql.symbol.CaseExpression;
-import org.teiid.query.sql.symbol.Constant;
-import org.teiid.query.sql.symbol.ContextReference;
-import org.teiid.query.sql.symbol.DerivedColumn;
-import org.teiid.query.sql.symbol.ElementSymbol;
-import org.teiid.query.sql.symbol.Expression;
-import org.teiid.query.sql.symbol.ExpressionSymbol;
-import org.teiid.query.sql.symbol.Function;
-import org.teiid.query.sql.symbol.QueryString;
-import org.teiid.query.sql.symbol.Reference;
-import org.teiid.query.sql.symbol.ScalarSubquery;
-import org.teiid.query.sql.symbol.SearchedCaseExpression;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
-import org.teiid.query.sql.symbol.TextLine;
-import org.teiid.query.sql.symbol.XMLElement;
-import org.teiid.query.sql.symbol.XMLForest;
-import org.teiid.query.sql.symbol.XMLNamespaces;
-import org.teiid.query.sql.symbol.XMLParse;
-import org.teiid.query.sql.symbol.XMLQuery;
-import org.teiid.query.sql.symbol.XMLSerialize;
+import org.teiid.query.sql.lang.*;
+import org.teiid.query.sql.symbol.*;
 import org.teiid.query.sql.symbol.XMLNamespaces.NamespaceItem;
 import org.teiid.query.sql.util.ValueIterator;
 import org.teiid.query.sql.util.ValueIteratorSource;
@@ -653,7 +610,7 @@
 	private Object internalEvaluate(Expression expression, List<?> tuple)
 	   throws ExpressionEvaluationException, BlockedException, TeiidComponentException {
 	
-	   if(expression instanceof SingleElementSymbol) {
+	   if(expression instanceof DerivedExpression) {
 		   if (elements != null) {
 		       // Try to evaluate by lookup in the elements map (may work for both ElementSymbol and ExpressionSymbol
 		       Integer index = (Integer) elements.get(expression);
@@ -663,7 +620,7 @@
 		   }
 		   
 	       // Otherwise this should be an ExpressionSymbol and we just need to dive in and evaluate the expression itself
-	       if (expression instanceof ExpressionSymbol && !(expression instanceof AggregateSymbol)) {            
+	       if (expression instanceof ExpressionSymbol) {            
 	           ExpressionSymbol exprSyb = (ExpressionSymbol) expression;
 	           Expression expr = exprSyb.getExpression();
 	           return internalEvaluate(expr, tuple);

Modified: trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingAttribute.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingAttribute.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingAttribute.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -105,10 +105,6 @@
         return "@" + super.getPathName(); //$NON-NLS-1$
     }
     
-    public String getCanonicalName() {
-        return getFullyQualifiedName().toUpperCase();
-    }
-
     /**
      * Namespace prefix
      * @return
@@ -185,4 +181,15 @@
         }
         return super.getSourceNode();
     }    
+    
+    public String getType() {
+        return (String)getProperty(MappingNodeConstants.Properties.BUILT_IN_TYPE);
+    }
+    
+    public MappingAttribute setType(String type) {
+        if (type != null) {
+            setProperty(MappingNodeConstants.Properties.BUILT_IN_TYPE, type);
+        }
+        return this;
+    }
 }

Modified: trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingBaseNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingBaseNode.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingBaseNode.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -71,7 +71,7 @@
         if (elem.isRecursive()) {
             MappingRecursiveElement recursiveElement = (MappingRecursiveElement)elem;
             MappingBaseNode recursiveRoot = getRecursiveRootNode(recursiveElement);
-            recursiveRoot.setRootRecursiveNode(true, recursiveElement.getMappingClass().toUpperCase());
+            recursiveRoot.setRootRecursiveNode(true, recursiveElement.getMappingClass());
             addChild(elem);
         }
         else {
@@ -139,10 +139,6 @@
         return null;
     }
     
-    public String getCanonicalName() {
-        return getFullyQualifiedName().toUpperCase();
-    }
-            
     public void removeChildNode(MappingBaseNode toRemove) {
         getChildren().remove(toRemove);
     }

Modified: trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingDocument.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingDocument.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingDocument.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -65,10 +65,6 @@
         return name;
     }
     
-    public String getCanonicalName() {
-        return name.toUpperCase();
-    }
-        
     public MappingBaseNode getRootNode() {
         return root;
     }

Modified: trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingNode.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingNode.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -66,35 +66,31 @@
     }
     
     public static MappingNode findNode(MappingNode root, String partialName) {
+    	return findNode(root, partialName, 0);
+    }
+    
+    public static MappingNode findNode(MappingNode root, String partialName, int start) {
         String canonicalName = root.getName();
         
         if (canonicalName != null) {
-            //@ is optional, so we need to check for it only with attributes
-            if (partialName.startsWith("@")) { //$NON-NLS-1$
-                canonicalName = "@" + canonicalName; //$NON-NLS-1$
-            }
+            int offset = partialName.charAt(start)=='@'?1:0;
             
-            canonicalName = canonicalName.toUpperCase();
-            
-            boolean abort = true;
-            
-            if (partialName.startsWith(canonicalName)) {
-                if (partialName.length() > canonicalName.length() + 1 && partialName.charAt(canonicalName.length()) == ElementSymbol.SEPARATOR.toCharArray()[0]) {
-                    partialName = partialName.substring(canonicalName.length() + 1);
-                    abort = false;
-                } else if (partialName.length() == canonicalName.length()) {
+            if (partialName.startsWith(canonicalName, start + offset)) { 
+                if (partialName.length() - start > canonicalName.length() + 1 && partialName.charAt(start + canonicalName.length()) == '.') {
+                    start += canonicalName.length() + 1;
+                } else if (partialName.length() - start == canonicalName.length() + offset) {
                     return root;
-                } 
+                } else {
+                	return null;
+                }
+            } else {
+            	return null;
             }
-            
-            if (abort) {
-                return null;
-            }
         }
         
         for (Iterator<MappingNode> i = root.getChildren().iterator(); i.hasNext();) {
             MappingNode child = i.next();
-            MappingNode found = findNode(child, partialName);
+            MappingNode found = findNode(child, partialName, start);
             if (found != null) {
                 return found;
             }

Modified: trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingSourceNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingSourceNode.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingSourceNode.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -25,6 +25,7 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import org.teiid.core.util.Assertion;
 import org.teiid.query.sql.symbol.ElementSymbol;
 import org.teiid.query.sql.symbol.GroupSymbol;
 
@@ -153,6 +154,8 @@
     public ElementSymbol getMappedSymbol(ElementSymbol symbol) {
         ElementSymbol mappedSymbol = (ElementSymbol)symbolMap.get(symbol);
         if (mappedSymbol == null) {
+        	Assertion.assertTrue(symbol.getGroupSymbol() == null || !symbolMap.containsKey(symbol.getGroupSymbol()), "invalid symbol " + symbol); //$NON-NLS-1$
+
             MappingSourceNode parentSourceNode = getParentSourceNode();
             if (parentSourceNode != null) {
                 return parentSourceNode.getMappedSymbol(symbol);

Modified: trunk/engine/src/main/java/org/teiid/query/metadata/CompositeMetadataStore.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/CompositeMetadataStore.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/CompositeMetadataStore.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -39,10 +39,8 @@
 
 /**
  * Aggregates the metadata from multiple stores.  
- * IMPORTANT: All strings queries should be in upper case.
  */
 public class CompositeMetadataStore extends MetadataStore {
-
 	
 	public CompositeMetadataStore(MetadataStore metadataStore) {
 		addMetadataStore(metadataStore);
@@ -56,6 +54,7 @@
 	
 	public void addMetadataStore(MetadataStore metadataStore) {
 		this.schemas.putAll(metadataStore.getSchemas());
+		this.schemaList.addAll(metadataStore.getSchemaList());
 		this.datatypes.addAll(metadataStore.getDatatypes());
 	}
 	

Modified: trunk/engine/src/main/java/org/teiid/query/metadata/GroupInfo.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/GroupInfo.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/GroupInfo.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -25,10 +25,10 @@
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.TreeMap;
 
 import org.teiid.query.sql.symbol.ElementSymbol;
 
@@ -45,10 +45,10 @@
 	
 	public GroupInfo(LinkedHashMap<Object, ElementSymbol> symbols) {
 		this.idToSymbolMap = symbols;
-		this.symbolList = Collections.unmodifiableList(new ArrayList(symbols.values()));
-		this.shortNameToSymbolMap = new HashMap<String, ElementSymbol>(symbolList.size());
+		this.symbolList = Collections.unmodifiableList(new ArrayList<ElementSymbol>(symbols.values()));
+		this.shortNameToSymbolMap = new TreeMap<String, ElementSymbol>(String.CASE_INSENSITIVE_ORDER);
 		for (ElementSymbol symbol : symbolList) {
-			shortNameToSymbolMap.put(symbol.getShortCanonicalName(), symbol);
+			shortNameToSymbolMap.put(symbol.getShortName(), symbol);
 		}
 	}
 	

Modified: trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataID.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataID.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataID.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -33,7 +33,7 @@
 import org.teiid.metadata.AbstractMetadataRecord.Modifiable;
 import org.teiid.query.mapping.relational.QueryNode;
 import org.teiid.query.sql.lang.CacheHint;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Symbol;
 
 /**
  * This class represents a temporary metadata ID.  A temporary metadata ID 
@@ -412,7 +412,7 @@
 
 	public String getName() {
 		if (this.name == null) {
-			this.name = SingleElementSymbol.getShortName(this.ID);
+			this.name = Symbol.getShortName(this.ID);
 		}
 		return this.name;
 	}

Modified: trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataStore.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataStore.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataStore.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -24,18 +24,17 @@
 
 import java.io.Serializable;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
+import java.util.NavigableMap;
+import java.util.TreeMap;
 
 import org.teiid.query.metadata.TempMetadataID.Type;
-import org.teiid.query.sql.symbol.AggregateSymbol;
 import org.teiid.query.sql.symbol.AliasSymbol;
 import org.teiid.query.sql.symbol.ElementSymbol;
 import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.symbol.ExpressionSymbol;
 import org.teiid.query.sql.symbol.Reference;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Symbol;
 
 
 /**
@@ -45,13 +44,13 @@
 
 	private static final long serialVersionUID = 4055072385672022478L;
 	// UPPER CASE TEMP GROUP NAME --> TempMetadataID for group
-    private Map<String, TempMetadataID> tempGroups;     
+    private NavigableMap<String, TempMetadataID> tempGroups;     
     
     /**
      * Constructor for TempMetadataStore.
      */
     public TempMetadataStore() {
-        this(new HashMap<String, TempMetadataID>());
+        this(new TreeMap<String, TempMetadataID>(String.CASE_INSENSITIVE_ORDER));
     }
 
     /**
@@ -59,19 +58,25 @@
      * the parameter is null, a new empty Map will beused instead.
      * @param data Map of upper case group name to group TempMetadataID object
      */
-    public TempMetadataStore(Map<String, TempMetadataID> data) {
+    public TempMetadataStore(NavigableMap<String, TempMetadataID> data) {
         if (data == null) {
-            tempGroups = new HashMap<String, TempMetadataID>();
+            tempGroups = new TreeMap<String, TempMetadataID>(String.CASE_INSENSITIVE_ORDER);
         } else {
             tempGroups = data;
         }
     }
+    
+    public TempMetadataStore clone() {
+    	TreeMap<String, TempMetadataID> clone = new TreeMap<String, TempMetadataID>(String.CASE_INSENSITIVE_ORDER);
+    	clone.putAll(tempGroups);
+    	return new TempMetadataStore(clone);
+    }
 
     /**
      * Get all temp group and element metadata
      * @param data Map of upper case group name to group TempMetadataID object
      */
-    public Map<String, TempMetadataID> getData() {
+    public NavigableMap<String, TempMetadataID> getData() {
         return this.tempGroups;
     }
    
@@ -103,27 +108,25 @@
      * @param isVirtual whether or not the group is a virtual group
      * @param isTempTable whether or not the group is a temporary table
      */
-    public TempMetadataID addTempGroup(String tempGroup, List<? extends SingleElementSymbol> tempSymbols, boolean isVirtual, boolean isTempTable) { 
+    public TempMetadataID addTempGroup(String tempGroup, List<? extends Expression> tempSymbols, boolean isVirtual, boolean isTempTable) { 
         // Add the temporary group
-        String tempName = tempGroup.toUpperCase();
-        
         List<TempMetadataID> elementIDs = new ArrayList<TempMetadataID>(tempSymbols.size());
         
-        for (SingleElementSymbol symbol : tempSymbols) {
-            TempMetadataID elementID = createElementSymbol(tempName, symbol, isTempTable);
+        for (Expression symbol : tempSymbols) {
+            TempMetadataID elementID = createElementSymbol(tempGroup, symbol, isTempTable);
         
             elementIDs.add(elementID);
         }
 
         // Create group ID
-        TempMetadataID groupID = new TempMetadataID(tempName, elementIDs, isVirtual?Type.VIRTUAL:Type.TEMP);
-        this.tempGroups.put(tempName, groupID);
+        TempMetadataID groupID = new TempMetadataID(tempGroup, elementIDs, isVirtual?Type.VIRTUAL:Type.TEMP);
+        this.tempGroups.put(tempGroup, groupID);
         return groupID;
     }
 
-    private TempMetadataID createElementSymbol(String tempName, SingleElementSymbol symbol, boolean isTempTable) {
+    private TempMetadataID createElementSymbol(String tempName, Expression symbol, boolean isTempTable) {
         // Create new element name
-        String elementName = tempName + SingleElementSymbol.SEPARATOR + symbol.getShortName();
+        String elementName = tempName + Symbol.SEPARATOR + Symbol.getShortName(symbol);
         
         Object metadataID = null;
         
@@ -132,14 +135,14 @@
             symbol = as.getSymbol();
         }
         
-        //the following allows for orginal metadata ids to be determined for proc inputs
-        if (symbol instanceof ExpressionSymbol && !(symbol instanceof AggregateSymbol)) {
+        //the following allows for original metadata ids to be determined for proc inputs
+        if (symbol instanceof ExpressionSymbol) {
             Expression expr = ((ExpressionSymbol)symbol).getExpression();
             if (expr instanceof Reference) {
                 expr = ((Reference)expr).getExpression();
             } 
             if (expr instanceof ElementSymbol) {
-                symbol = (ElementSymbol)expr;
+                symbol = expr;
             }
         }
         
@@ -163,12 +166,10 @@
      * @param symbol - element to be added
      * @return metadata id.
      */
-    public TempMetadataID addElementSymbolToTempGroup(String tempGroup, SingleElementSymbol symbol) {
-        String tempName = tempGroup.toUpperCase();
-        
-        TempMetadataID groupID = this.tempGroups.get(tempName);
+    public TempMetadataID addElementSymbolToTempGroup(String tempGroup, Expression symbol) {
+        TempMetadataID groupID = this.tempGroups.get(tempGroup);
         if (groupID != null) {
-            TempMetadataID elementID = createElementSymbol(tempName, symbol, false);
+            TempMetadataID elementID = createElementSymbol(tempGroup, symbol, false);
             
             groupID.addElement(elementID);
             
@@ -183,7 +184,7 @@
      * @return Metadata ID or null if not found
      */
     public TempMetadataID getTempGroupID(String tempGroup) {
-        return tempGroups.get(tempGroup.toUpperCase());    
+        return tempGroups.get(tempGroup);    
     }
     
     /**
@@ -192,13 +193,13 @@
      * @return Metadata ID or null if not found
      */
     public TempMetadataID getTempElementID(String tempElement) {
-        int index = tempElement.lastIndexOf(SingleElementSymbol.SEPARATOR);
+        int index = tempElement.lastIndexOf(Symbol.SEPARATOR);
         if(index < 0) {
             return null;
         }
         String groupName = tempElement.substring(0, index);
             
-        TempMetadataID groupID = tempGroups.get(groupName.toUpperCase());
+        TempMetadataID groupID = tempGroups.get(groupName);
         if(groupID != null) {
         	for (TempMetadataID elementID : groupID.getElements()) {
                 if(elementID.getID().equalsIgnoreCase(tempElement)) { 
@@ -226,14 +227,14 @@
     }
     
     public void addElementToTempGroup(String tempGroup, ElementSymbol symbol) {
-        TempMetadataID groupID = tempGroups.get(tempGroup.toUpperCase());        
+        TempMetadataID groupID = tempGroups.get(tempGroup);        
         if(groupID != null) {
             groupID.addElement((TempMetadataID)symbol.getMetadataID());
         }
     }
     
     public TempMetadataID removeTempGroup(String tempGroup) {
-        return tempGroups.remove(tempGroup.toUpperCase());  
+        return tempGroups.remove(tempGroup);  
     }
 
 }

Modified: trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -22,14 +22,29 @@
 
 package org.teiid.query.metadata;
 
-import java.io.*;
-import java.util.*;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
 
 import org.jboss.vfs.VirtualFile;
 import org.teiid.adminapi.impl.VDBMetaData;
 import org.teiid.api.exception.query.QueryMetadataException;
 import org.teiid.core.TeiidComponentException;
-import org.teiid.core.types.*;
+import org.teiid.core.types.BlobImpl;
+import org.teiid.core.types.ClobImpl;
+import org.teiid.core.types.DataTypeManager;
+import org.teiid.core.types.InputStreamFactory;
+import org.teiid.core.types.SQLXMLImpl;
 import org.teiid.core.util.ArgCheck;
 import org.teiid.core.util.LRUCache;
 import org.teiid.core.util.ObjectConverterUtil;
@@ -180,7 +195,7 @@
 		if (columnIndex == -1) {
 			throw new QueryMetadataException(elementName+TransformationMetadata.NOT_EXISTS_MESSAGE);
 		}
-		Table table = this.store.findGroup(elementName.substring(0, columnIndex).toUpperCase());
+		Table table = this.store.findGroup(elementName.substring(0, columnIndex));
 		String shortElementName = elementName.substring(columnIndex + 1);
 		for (Column column : getElementIDsInGroupID(table)) {
 			if (column.getName().equalsIgnoreCase(shortElementName)) {
@@ -191,7 +206,7 @@
     }
 
     public Table getGroupID(final String groupName) throws TeiidComponentException, QueryMetadataException {
-        return getMetadataStore().findGroup(groupName.toUpperCase());
+        return getMetadataStore().findGroup(groupName);
     }
     
     public Collection<String> getGroupsForPartialName(final String partialGroupName)

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/QueryOptimizer.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/QueryOptimizer.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/QueryOptimizer.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -24,7 +24,6 @@
 
 import java.util.LinkedList;
 import java.util.List;
-import java.util.Map;
 
 import org.teiid.api.exception.query.QueryMetadataException;
 import org.teiid.api.exception.query.QueryPlannerException;
@@ -89,8 +88,12 @@
 		
         boolean debug = analysisRecord.recordDebug();
         
-        Map tempMetadata = command.getTemporaryMetadata();
-        metadata = new TempMetadataAdapter(metadata, new TempMetadataStore(tempMetadata));
+        TempMetadataStore tempMetadata = command.getTemporaryMetadata();
+        if (tempMetadata != null) {
+        	metadata = new TempMetadataAdapter(metadata, tempMetadata);
+        } else if (!(metadata instanceof TempMetadataAdapter)) {
+        	metadata = new TempMetadataAdapter(metadata, new TempMetadataStore());
+        }
                 
         // Create an ID generator that can be used for all plans to generate unique data node IDs
         if(idGenerator == null) {

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/TriggerActionPlanner.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/TriggerActionPlanner.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/TriggerActionPlanner.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -51,9 +51,7 @@
 import org.teiid.query.sql.proc.TriggerAction;
 import org.teiid.query.sql.symbol.ElementSymbol;
 import org.teiid.query.sql.symbol.Expression;
-import org.teiid.query.sql.symbol.ExpressionSymbol;
-import org.teiid.query.sql.symbol.SelectSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Symbol;
 import org.teiid.query.util.CommandContext;
 
 
@@ -85,10 +83,10 @@
 		
 		for (Map.Entry<ElementSymbol, Expression> entry : QueryResolver.getVariableValues(userCommand, false, metadata).entrySet()) {
 			if (entry.getKey().getGroupSymbol().getShortName().equalsIgnoreCase(SQLConstants.Reserved.NEW)) {
-				Expression value = entry.getValue() instanceof SingleElementSymbol ? entry.getValue() : new ExpressionSymbol("x", entry.getValue()); //$NON-NLS-1$
+				Expression value = entry.getValue();
 				params.put(entry.getKey(), value);
 				if (userCommand instanceof Update) {
-					((Query)query).getSelect().addSymbol((SelectSymbol) value);
+					((Query)query).getSelect().addSymbol(value);
 				}
 			} else {
 				params.put(entry.getKey(), entry.getValue()); 
@@ -109,13 +107,13 @@
 			Map<ElementSymbol, Expression> params)
 			throws QueryMetadataException, TeiidComponentException {
 		QueryCommand query;
-		ArrayList<SelectSymbol> selectSymbols = new ArrayList<SelectSymbol>();
+		ArrayList<Expression> selectSymbols = new ArrayList<Expression>();
 		List<ElementSymbol> allSymbols = ResolverUtil.resolveElementsInGroup(ta.getView(), metadata);
 		for (ElementSymbol elementSymbol : allSymbols) {
-			params.put(new ElementSymbol(SQLConstants.Reserved.OLD + ElementSymbol.SEPARATOR + elementSymbol.getShortName()), elementSymbol);
+			params.put(new ElementSymbol(SQLConstants.Reserved.OLD + Symbol.SEPARATOR + elementSymbol.getShortName()), elementSymbol);
 			if (userCommand instanceof Update) {
 				//default to old
-				params.put(new ElementSymbol(SQLConstants.Reserved.NEW + ElementSymbol.SEPARATOR + elementSymbol.getShortName()), elementSymbol);
+				params.put(new ElementSymbol(SQLConstants.Reserved.NEW + Symbol.SEPARATOR + elementSymbol.getShortName()), elementSymbol);
 			}
 		}
 		selectSymbols.addAll(LanguageObject.Util.deepClone(allSymbols, ElementSymbol.class));

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/AliasGenerator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/AliasGenerator.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/AliasGenerator.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -29,25 +29,15 @@
 
 import org.teiid.query.metadata.TempMetadataID;
 import org.teiid.query.sql.LanguageVisitor;
-import org.teiid.query.sql.lang.ExistsCriteria;
-import org.teiid.query.sql.lang.OrderBy;
-import org.teiid.query.sql.lang.OrderByItem;
-import org.teiid.query.sql.lang.Query;
-import org.teiid.query.sql.lang.Select;
-import org.teiid.query.sql.lang.SetQuery;
-import org.teiid.query.sql.lang.SubqueryCompareCriteria;
-import org.teiid.query.sql.lang.SubqueryFromClause;
-import org.teiid.query.sql.lang.SubquerySetCriteria;
-import org.teiid.query.sql.lang.UnaryFromClause;
+import org.teiid.query.sql.lang.*;
 import org.teiid.query.sql.navigator.PreOrderNavigator;
 import org.teiid.query.sql.symbol.AliasSymbol;
 import org.teiid.query.sql.symbol.ElementSymbol;
 import org.teiid.query.sql.symbol.Expression;
-import org.teiid.query.sql.symbol.ExpressionSymbol;
 import org.teiid.query.sql.symbol.GroupSymbol;
 import org.teiid.query.sql.symbol.Reference;
 import org.teiid.query.sql.symbol.ScalarSubquery;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Symbol;
 import org.teiid.query.sql.util.SymbolMap;
 
 
@@ -68,7 +58,7 @@
             
             Map<String, Map<String, String>> elementMap = new HashMap<String, Map<String, String>>();
             Map<String, String> groupNames = new HashMap<String, String>();
-            Map<SingleElementSymbol, String> currentSymbols;
+            Map<Expression, String> currentSymbols;
             
             boolean aliasColumns = false;
             
@@ -76,7 +66,7 @@
                 this.parent = parent;
             }
             
-            public String getElementName(SingleElementSymbol symbol, boolean renameGroup) {
+            public String getElementName(Expression symbol, boolean renameGroup) {
             	String name = null;
             	if (currentSymbols != null) {
             		name = currentSymbols.get(symbol);
@@ -91,9 +81,9 @@
             		return null;
             	}
             	ElementSymbol element = (ElementSymbol)symbol;
-            	Map<String, String> elements = this.elementMap.get(element.getGroupSymbol().getCanonicalName());
+            	Map<String, String> elements = this.elementMap.get(element.getGroupSymbol().getName());
             	if (elements != null) {
-            		name = elements.get(element.getShortCanonicalName());
+            		name = elements.get(element.getShortName());
             		if (name != null) {
             			if (renameGroup) {
             				renameGroup(element.getGroupSymbol());
@@ -116,7 +106,7 @@
             public void renameGroup(GroupSymbol obj) {
                 if (aliasGroups) {
                     String definition = obj.getNonCorrelationName();
-                    String newAlias = getGroupName(obj.getCanonicalName());
+                    String newAlias = getGroupName(obj.getName());
                     if (newAlias == null) {
                         return;
                     }
@@ -159,10 +149,10 @@
             String newName = namingContext.getElementName(obj, true);
             
             if (newName == null) {
-                newName = ElementSymbol.getShortName(obj.getOutputName());
+                newName = Symbol.getShortName(obj.getOutputName());
             }
             
-            obj.setOutputName(group.getOutputName() + ElementSymbol.SEPARATOR + newName);
+            obj.setOutputName(group.getOutputName() + Symbol.SEPARATOR + newName);
             obj.setDisplayMode(ElementSymbol.DisplayMode.OUTPUT_NAME);
         }
         
@@ -216,36 +206,29 @@
     
     public void visit(Select obj) {
         super.visit(obj);
-        List selectSymbols = obj.getSymbols();
-        HashMap<SingleElementSymbol, String> symbols = new HashMap<SingleElementSymbol, String>(selectSymbols.size());                
+        List<Expression> selectSymbols = obj.getSymbols();
+        HashMap<Expression, String> symbols = new HashMap<Expression, String>(selectSymbols.size());                
         for (int i = 0; i < selectSymbols.size(); i++) {
-            SingleElementSymbol symbol = (SingleElementSymbol)selectSymbols.get(i);
+            Expression symbol = selectSymbols.get(i);
 
             boolean needsAlias = visitor.namingContext.aliasColumns;
             
             String newAlias = "c_" + i; //$NON-NLS-1$
             
-            Expression expr = SymbolMap.getExpression(symbol);
+            Expression newSymbol = SymbolMap.getExpression(symbol);
             
-            SingleElementSymbol newSymbol = symbol;
-            
-            if (!(expr instanceof SingleElementSymbol)) {
-                newSymbol = new ExpressionSymbol(newSymbol.getShortName(), expr);
-            } else if (expr instanceof ElementSymbol) {
-                newSymbol = (ElementSymbol)expr;
+            if (newSymbol instanceof ElementSymbol) {
             	if (!needsAlias) {
-            		newAlias = newSymbol.getOutputName();
+            		newAlias = ((ElementSymbol)newSymbol).getOutputName();
             	} else {
-                    needsAlias &= needsAlias(newAlias, (ElementSymbol)expr);
+                    needsAlias &= needsAlias(newAlias, (ElementSymbol)newSymbol);
                 }
-            } else {
-                newSymbol = (SingleElementSymbol)expr; 
             }
                         
             symbols.put(symbol, newAlias);
             if (visitor.namingContext.aliasColumns && needsAlias) {
-                newSymbol = new AliasSymbol(symbol.getShortName(), newSymbol);
-                newSymbol.setOutputName(newAlias);
+                newSymbol = new AliasSymbol(Symbol.getShortName(symbol), newSymbol);
+                ((AliasSymbol)newSymbol).setOutputName(newAlias);
             } 
             selectSymbols.set(i, newSymbol);
         }
@@ -277,10 +260,10 @@
         visitor.createChildNamingContext(true);
         obj.getCommand().acceptVisitor(this);
         Map<String, String> viewGroup = new HashMap<String, String>();
-        for (Entry<SingleElementSymbol, String> entry : visitor.namingContext.currentSymbols.entrySet()) {
-        	viewGroup.put(entry.getKey().getShortCanonicalName(), entry.getValue());
+        for (Entry<Expression, String> entry : visitor.namingContext.currentSymbols.entrySet()) {
+        	viewGroup.put(Symbol.getShortName(entry.getKey()), entry.getValue());
         }
-        visitor.namingContext.parent.elementMap.put(obj.getName().toUpperCase(), viewGroup);
+        visitor.namingContext.parent.elementMap.put(obj.getName(), viewGroup);
         visitor.removeChildNamingContext();
         obj.getGroupSymbol().setOutputName(recontextGroup(obj.getGroupSymbol(), true));
     }
@@ -304,7 +287,7 @@
         } else {
             newAlias = "g_" + groupIndex++; //$NON-NLS-1$
         }
-        visitor.namingContext.groupNames.put(symbol.getName().toUpperCase(), newAlias);
+        visitor.namingContext.groupNames.put(symbol.getName(), newAlias);
         return newAlias;
     }
     
@@ -344,32 +327,32 @@
     	//add/correct aliases if necessary
         for (int i = 0; i < obj.getVariableCount(); i++) {
             OrderByItem item = obj.getOrderByItems().get(i);
-            SingleElementSymbol element = item.getSymbol();
+            Expression element = item.getSymbol();
             if (item.isUnrelated()) {
             	visitNode(element);
             	continue;
             }
             String name = visitor.namingContext.getElementName(element, false);
             boolean needsAlias = visitor.namingContext.aliasColumns;
-            if (name != null) {
-	            
-	            Expression expr = SymbolMap.getExpression(element);
-	                        
-	            if (!(expr instanceof SingleElementSymbol)) {
-	                expr = new ExpressionSymbol(element.getShortName(), expr);
-	            } else if (expr instanceof ElementSymbol) {
-	            	needsAlias &= needsAlias(name, (ElementSymbol)expr);
-	            } 
-	                        
-	            if (needsAlias) {
-	                element = new AliasSymbol(element.getShortName(), (SingleElementSymbol)expr);
-	            } else if (expr instanceof ElementSymbol) {
-	            	element = (ElementSymbol)expr;
-	            	visitNode(element);
-	            }
-	            item.setSymbol(element);
-	            element.setOutputName(name);
+            if (name == null) {
+	            continue;
             }
+            Expression expr = SymbolMap.getExpression(element);
+                        
+            if (expr instanceof ElementSymbol) {
+            	needsAlias &= needsAlias(name, (ElementSymbol)expr);
+            } 
+                        
+            if (needsAlias) {
+                element = new AliasSymbol(Symbol.getShortName(element), expr);
+            } else if (expr instanceof ElementSymbol) {
+            	element = expr;
+            	visitNode(element);
+            }
+            item.setSymbol(element);
+            if (element instanceof Symbol) {
+            	((Symbol)element).setOutputName(name);
+            }
         }
     }
     

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PartitionAnalyzer.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PartitionAnalyzer.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PartitionAnalyzer.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -22,18 +22,7 @@
 
 package org.teiid.query.optimizer.relational;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 
 import org.teiid.core.types.DataTypeManager;
 import org.teiid.query.sql.lang.CompareCriteria;
@@ -46,7 +35,6 @@
 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.SingleElementSymbol;
 import org.teiid.query.sql.util.SymbolMap;
 
 /**
@@ -114,7 +102,7 @@
 	}
 	
 	private static Map<ElementSymbol, Set<Constant>> extractPartitionInfo(Query query, List<ElementSymbol> projectedSymbols) {
-		List<SingleElementSymbol> projected = query.getSelect().getProjectedSymbols();
+		List<Expression> projected = query.getSelect().getProjectedSymbols();
 		List<Criteria> crits = Criteria.separateCriteriaByAnd(query.getCriteria());
 		Map<Expression, Set<Constant>> inMap = new HashMap<Expression, Set<Constant>>();
 		for (Criteria criteria : crits) {

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -49,55 +49,18 @@
 import org.teiid.query.optimizer.relational.rules.RuleAssignOutputElements;
 import org.teiid.query.optimizer.relational.rules.RuleChooseJoinStrategy;
 import org.teiid.query.processor.ProcessorPlan;
-import org.teiid.query.processor.relational.AccessNode;
-import org.teiid.query.processor.relational.ArrayTableNode;
-import org.teiid.query.processor.relational.DependentAccessNode;
-import org.teiid.query.processor.relational.DependentProcedureAccessNode;
-import org.teiid.query.processor.relational.DependentProcedureExecutionNode;
-import org.teiid.query.processor.relational.EnhancedSortMergeJoinStrategy;
-import org.teiid.query.processor.relational.GroupingNode;
-import org.teiid.query.processor.relational.InsertPlanExecutionNode;
-import org.teiid.query.processor.relational.JoinNode;
-import org.teiid.query.processor.relational.LimitNode;
-import org.teiid.query.processor.relational.MergeJoinStrategy;
-import org.teiid.query.processor.relational.NestedLoopJoinStrategy;
-import org.teiid.query.processor.relational.NestedTableJoinStrategy;
-import org.teiid.query.processor.relational.NullNode;
-import org.teiid.query.processor.relational.PlanExecutionNode;
-import org.teiid.query.processor.relational.ProjectIntoNode;
-import org.teiid.query.processor.relational.ProjectNode;
-import org.teiid.query.processor.relational.RelationalNode;
-import org.teiid.query.processor.relational.RelationalPlan;
-import org.teiid.query.processor.relational.SelectNode;
-import org.teiid.query.processor.relational.SortNode;
-import org.teiid.query.processor.relational.TextTableNode;
-import org.teiid.query.processor.relational.UnionAllNode;
-import org.teiid.query.processor.relational.WindowFunctionProjectNode;
-import org.teiid.query.processor.relational.XMLTableNode;
+import org.teiid.query.processor.relational.*;
 import org.teiid.query.processor.relational.JoinNode.JoinStrategyType;
 import org.teiid.query.processor.relational.MergeJoinStrategy.SortOption;
 import org.teiid.query.processor.relational.SortUtility.Mode;
 import org.teiid.query.resolver.util.ResolverUtil;
-import org.teiid.query.sql.lang.ArrayTable;
-import org.teiid.query.sql.lang.Command;
-import org.teiid.query.sql.lang.Criteria;
-import org.teiid.query.sql.lang.Insert;
-import org.teiid.query.sql.lang.JoinType;
-import org.teiid.query.sql.lang.OrderBy;
-import org.teiid.query.sql.lang.OrderByItem;
-import org.teiid.query.sql.lang.Query;
-import org.teiid.query.sql.lang.QueryCommand;
-import org.teiid.query.sql.lang.StoredProcedure;
-import org.teiid.query.sql.lang.TableFunctionReference;
-import org.teiid.query.sql.lang.TextTable;
-import org.teiid.query.sql.lang.XMLTable;
+import org.teiid.query.sql.lang.*;
 import org.teiid.query.sql.lang.SetQuery.Operation;
 import org.teiid.query.sql.lang.XMLTable.XMLColumn;
 import org.teiid.query.sql.symbol.ElementSymbol;
 import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.symbol.ExpressionSymbol;
 import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 import org.teiid.query.sql.symbol.WindowFunction;
 import org.teiid.query.sql.util.SymbolMap;
 import org.teiid.query.sql.visitor.EvaluatableVisitor;
@@ -221,7 +184,7 @@
                     }
 
                 } else {
-                    List<SingleElementSymbol> symbols = (List) node.getProperty(NodeConstants.Info.PROJECT_COLS);
+                    List<Expression> symbols = (List) node.getProperty(NodeConstants.Info.PROJECT_COLS);
                     
                     ProjectNode pnode = new ProjectNode(getID());
                     pnode.setSelectSymbols(symbols);
@@ -231,9 +194,9 @@
             			WindowFunctionProjectNode wfpn = new WindowFunctionProjectNode(getID());
             			Set<WindowFunction> windowFunctions = RuleAssignOutputElements.getWindowFunctions(symbols);
             			//TODO: check for selecting all window functions
-            			List<SingleElementSymbol> outputElements = new ArrayList<SingleElementSymbol>(windowFunctions);
+            			List<Expression> outputElements = new ArrayList<Expression>(windowFunctions);
             			//collect the other projected expressions
-            			for (SingleElementSymbol singleElementSymbol : (List<SingleElementSymbol>)node.getFirstChild().getProperty(Info.OUTPUT_COLS)) {
+            			for (Expression singleElementSymbol : (List<Expression>)node.getFirstChild().getProperty(Info.OUTPUT_COLS)) {
 							outputElements.add(singleElementSymbol);
 						}
             			wfpn.setElements(outputElements);

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -164,7 +164,7 @@
 	                	WithQueryCommand wqc = new WithQueryCommand(with.getGroupSymbol(), with.getColumns(), withCommand);
 	                	pushDownWith.add(wqc);
 	                }
-		        	names.add(with.getGroupSymbol().getCanonicalName());
+		        	names.add(with.getGroupSymbol().getName());
 				}
 	        	if (modelID != null && supportsWithPushdown) {
 	        		supportsWithPushdown = CapabilitiesUtil.supports(Capability.COMMON_TABLE_EXPRESSIONS, modelID, metadata, capFinder);
@@ -190,7 +190,7 @@
 		connectSubqueryContainers(plan); //TODO: merge with node creation
         
         // Set top column information on top node
-        List<SingleElementSymbol> topCols = Util.deepClone(command.getProjectedSymbols(), SingleElementSymbol.class);
+        List<Expression> topCols = Util.deepClone(command.getProjectedSymbols(), Expression.class);
 
         // Build rule set based on hints
         RuleStack rules = buildRules();
@@ -232,7 +232,7 @@
 			@Override
 			public void visit(UnaryFromClause obj) {
 				GroupSymbol group = obj.getGroup();
-				if (names.contains(group.getNonCorrelationName().toUpperCase())) {
+				if (names.contains(group.getNonCorrelationName())) {
 					group.setModelMetadataId(modelID);
 				}
 			}
@@ -505,7 +505,7 @@
         PlanNode projectNode = NodeFactory.getNewNode(NodeConstants.Types.PROJECT);
 
         // Set output columns
-        List<SingleElementSymbol> cols = command.getProjectedSymbols();
+        List<Expression> cols = command.getProjectedSymbols();
         projectNode.setProperty(NodeConstants.Info.PROJECT_COLS, cols);
 
         // Define source of data for stored query / procedure
@@ -975,7 +975,7 @@
 			mergeTempMetadata(nestedCommand, parentCommand);
 		    PlanNode childRoot = generatePlan(nestedCommand, false);
 		    node.addFirstChild(childRoot);
-			List<SingleElementSymbol> projectCols = nestedCommand.getProjectedSymbols();
+			List<Expression> projectCols = nestedCommand.getProjectedSymbols();
 			SymbolMap map = SymbolMap.createSymbolMap(group, projectCols, metadata);
 			node.setProperty(NodeConstants.Info.SYMBOL_MAP, map);
 		} else {
@@ -1187,14 +1187,14 @@
     static void mergeTempMetadata(
         Command childCommand,
         Command parentCommand) {
-        Map childTempMetadata = childCommand.getTemporaryMetadata();
-        if (childTempMetadata != null && !childTempMetadata.isEmpty()){
+        TempMetadataStore childTempMetadata = childCommand.getTemporaryMetadata();
+        if (childTempMetadata != null && !childTempMetadata.getData().isEmpty()){
             // Add to parent temp metadata
-            Map parentTempMetadata = parentCommand.getTemporaryMetadata();
+        	TempMetadataStore parentTempMetadata = parentCommand.getTemporaryMetadata();
             if (parentTempMetadata == null){
-                parentCommand.setTemporaryMetadata(new HashMap(childTempMetadata));
+                parentCommand.setTemporaryMetadata(childTempMetadata);
             } else {
-                parentTempMetadata.putAll(childTempMetadata);
+                parentTempMetadata.getData().putAll(childTempMetadata.getData());
             }
         }
     }
@@ -1249,7 +1249,7 @@
         return QueryRewriter.rewrite(result, metadata, context);
     }
     
-	public static Query createMatViewQuery(Object matMetadataId, String matTableName, List<? extends SelectSymbol> select, boolean isGlobal) {
+	public static Query createMatViewQuery(Object matMetadataId, String matTableName, List<? extends Expression> select, boolean isGlobal) {
 		Query query = new Query();
 		query.setSelect(new Select(select));
 		GroupSymbol gs = new GroupSymbol(matTableName);

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/FrameUtil.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/FrameUtil.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/FrameUtil.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -22,16 +22,7 @@
 
 package org.teiid.query.optimizer.relational.rules;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 
 import org.teiid.api.exception.query.QueryMetadataException;
 import org.teiid.api.exception.query.QueryPlannerException;
@@ -65,7 +56,6 @@
 import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.symbol.ExpressionSymbol;
 import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 import org.teiid.query.sql.util.SymbolMap;
 import org.teiid.query.sql.visitor.ElementCollectorVisitor;
 import org.teiid.query.sql.visitor.ExpressionMappingVisitor;
@@ -233,12 +223,12 @@
             }
                             
         } else if(type == NodeConstants.Types.PROJECT) {                    
-            List<SingleElementSymbol> projectedSymbols = (List<SingleElementSymbol>)node.getProperty(NodeConstants.Info.PROJECT_COLS);
+            List<Expression> projectedSymbols = (List<Expression>)node.getProperty(NodeConstants.Info.PROJECT_COLS);
             Select select = new Select(projectedSymbols);
             ExpressionMappingVisitor.mapExpressions(select, symbolMap);
             if (rewrite) {
             	for (LanguageObject expr : select.getSymbols()) {
-					rewriteSingleElementSymbol(metadata, (SingleElementSymbol) expr);
+					rewriteSingleElementSymbol(metadata, (Expression) expr);
 				}
             }
             node.setProperty(NodeConstants.Info.PROJECT_COLS, select.getSymbols());
@@ -296,7 +286,7 @@
     }
 
 	private static void rewriteSingleElementSymbol(
-			QueryMetadataInterface metadata, SingleElementSymbol ses) throws QueryPlannerException {
+			QueryMetadataInterface metadata, Expression ses) throws QueryPlannerException {
 		try {
 			if (ses instanceof AliasSymbol) {
 				ses = ((AliasSymbol)ses).getSymbol();
@@ -304,7 +294,7 @@
 			if (ses instanceof ExpressionSymbol) {
 				ExpressionSymbol es = (ExpressionSymbol)ses;
 				if (es.getExpression() != null) {
-					es.setExpression(QueryRewriter.rewriteExpression(es.getExpression(), null, null, metadata));
+					es.setExpression(QueryRewriter.rewriteExpression(es.getExpression(), null, metadata));
 				}
 			}
 		} catch(TeiidProcessingException e) {
@@ -320,7 +310,7 @@
             return expression;
         }
         
-        if(expression instanceof SingleElementSymbol) { 
+        if(expression instanceof Expression) { 
             Expression mappedSymbol = (Expression) symbolMap.get(expression);
             if (mappedSymbol != null) {
                 return mappedSymbol;
@@ -535,13 +525,13 @@
     /**
      * Finds the closest project columns in the current frame
      */
-    static List<SingleElementSymbol> findTopCols(PlanNode node) {
+    static List<Expression> findTopCols(PlanNode node) {
     	PlanNode project = NodeEditor.findNodePreOrder(node, NodeConstants.Types.PROJECT, NodeConstants.Types.SOURCE);
         if (project == null) {
             project = NodeEditor.findParent(node, NodeConstants.Types.PROJECT, NodeConstants.Types.SOURCE);
         }
         if (project != null) {
-            return (List<SingleElementSymbol>)project.getProperty(NodeConstants.Info.PROJECT_COLS);
+            return (List<Expression>)project.getProperty(NodeConstants.Info.PROJECT_COLS);
         }
         Assertion.failed("no top cols in frame"); //$NON-NLS-1$
         return null;

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/JoinUtil.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/JoinUtil.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/JoinUtil.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -153,7 +153,7 @@
                                           Expression expr) {
         Expression simplifiedExpression = (Expression)replaceWithNullValues(innerGroups, expr);
         try {
-            simplifiedExpression = QueryRewriter.rewriteExpression(simplifiedExpression, null, null, metadata);
+            simplifiedExpression = QueryRewriter.rewriteExpression(simplifiedExpression, null, metadata);
         } catch (TeiidException err) {
             //log the exception
             return true;

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/NewCalculateCostUtil.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/NewCalculateCostUtil.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/NewCalculateCostUtil.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -25,17 +25,7 @@
 import java.sql.Date;
 import java.sql.Time;
 import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 import java.util.Map.Entry;
 
 import org.teiid.api.exception.query.QueryMetadataException;
@@ -55,25 +45,12 @@
 import org.teiid.query.optimizer.relational.plantree.PlanNode;
 import org.teiid.query.optimizer.relational.plantree.NodeConstants.Info;
 import org.teiid.query.resolver.util.ResolverUtil;
-import org.teiid.query.sql.lang.AbstractSetCriteria;
-import org.teiid.query.sql.lang.CompareCriteria;
-import org.teiid.query.sql.lang.CompoundCriteria;
-import org.teiid.query.sql.lang.Criteria;
-import org.teiid.query.sql.lang.DependentSetCriteria;
-import org.teiid.query.sql.lang.IsNullCriteria;
-import org.teiid.query.sql.lang.JoinType;
-import org.teiid.query.sql.lang.MatchCriteria;
-import org.teiid.query.sql.lang.NotCriteria;
-import org.teiid.query.sql.lang.PredicateCriteria;
-import org.teiid.query.sql.lang.SetCriteria;
-import org.teiid.query.sql.lang.SetQuery;
-import org.teiid.query.sql.lang.SubquerySetCriteria;
+import org.teiid.query.sql.lang.*;
 import org.teiid.query.sql.lang.SetQuery.Operation;
 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;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 import org.teiid.query.sql.util.SymbolMap;
 import org.teiid.query.sql.visitor.ElementCollectorVisitor;
 import org.teiid.query.sql.visitor.EvaluatableVisitor;
@@ -439,7 +416,7 @@
     			}
     			if (stats == null) {
         			if (node.getType() == NodeConstants.Types.PROJECT) {
-	        			Collection<SingleElementSymbol> elems = new HashSet<SingleElementSymbol>();
+	        			Collection<Expression> elems = new HashSet<Expression>();
 	        			ElementCollectorVisitor.getElements(expr, elems);
 	        			newStats[Stat.NDV.ordinal()] = getStat(Stat.NDV, elems, node, childCardinality, metadata);
 		        		newStats[Stat.NNV.ordinal()] = getStat(Stat.NNV, elems, node, childCardinality, metadata);

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleAssignOutputElements.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleAssignOutputElements.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleAssignOutputElements.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -62,7 +62,6 @@
 import org.teiid.query.sql.symbol.ExpressionSymbol;
 import org.teiid.query.sql.symbol.Function;
 import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 import org.teiid.query.sql.symbol.WindowFunction;
 import org.teiid.query.sql.util.SymbolMap;
 import org.teiid.query.sql.visitor.AggregateSymbolCollectorVisitor;
@@ -109,7 +108,7 @@
             return plan;
         }
 
-		List<SingleElementSymbol> projectCols = (List<SingleElementSymbol>)projectNode.getProperty(NodeConstants.Info.PROJECT_COLS);
+		List<Expression> projectCols = (List<Expression>)projectNode.getProperty(NodeConstants.Info.PROJECT_COLS);
 
 		assignOutputElements(plan, projectCols, metadata, capFinder, rules, analysisRecord, context);
 
@@ -136,7 +135,7 @@
      * @param outputElements Output elements needed for this node
      * @param metadata Metadata implementation
      */
-	private void assignOutputElements(PlanNode root, List<SingleElementSymbol> outputElements, QueryMetadataInterface metadata, CapabilitiesFinder capFinder, RuleStack rules, AnalysisRecord analysisRecord, CommandContext context)
+	private void assignOutputElements(PlanNode root, List<Expression> outputElements, QueryMetadataInterface metadata, CapabilitiesFinder capFinder, RuleStack rules, AnalysisRecord analysisRecord, CommandContext context)
 		throws QueryPlannerException, QueryMetadataException, TeiidComponentException {
 
 	    int nodeType = root.getType();
@@ -156,7 +155,7 @@
 	                root.setProperty(NodeConstants.Info.OUTPUT_COLS, command.getProjectedSymbols());
 	            } else if (checkSymbols) {
 	            	Object modelId = RuleRaiseAccess.getModelIDFromAccess(root, metadata);
-	            	for (SingleElementSymbol symbol : outputElements) {
+	            	for (Expression symbol : outputElements) {
 	                    if(!RuleRaiseAccess.canPushSymbol(symbol, true, modelId, metadata, capFinder, analysisRecord)) {
 	                    	throw new QueryPlannerException(QueryPlugin.Util.getString("RuleAssignOutputElements.couldnt_push_expression", symbol, modelId)); //$NON-NLS-1$
 	                    } 
@@ -168,7 +167,7 @@
 		    	if (root.hasBooleanProperty(NodeConstants.Info.UNRELATED_SORT)) {
 		    		//add missing sort columns
 			    	OrderBy elements = (OrderBy) root.getProperty(NodeConstants.Info.SORT_ORDER);
-			    	outputElements = new ArrayList<SingleElementSymbol>(outputElements);
+			    	outputElements = new ArrayList<Expression>(outputElements);
 			    	boolean hasUnrelated = false;
 			    	for (OrderByItem item : elements.getOrderByItems()) {
 			    		if (item.getExpressionPosition() == -1) {
@@ -188,16 +187,16 @@
 		        assignOutputElements(root.getLastChild(), outputElements, metadata, capFinder, rules, analysisRecord, context);
 		        break;
 		    case NodeConstants.Types.SOURCE: {
-		        outputElements = (List<SingleElementSymbol>)determineSourceOutput(root, outputElements, metadata, capFinder);
+		        outputElements = (List<Expression>)determineSourceOutput(root, outputElements, metadata, capFinder);
 	            root.setProperty(NodeConstants.Info.OUTPUT_COLS, outputElements);
-	            List<SingleElementSymbol> childElements = filterVirtualElements(root, outputElements, metadata);
+	            List<Expression> childElements = filterVirtualElements(root, outputElements, metadata);
 	            assignOutputElements(root.getFirstChild(), childElements, metadata, capFinder, rules, analysisRecord, context);
 		        break;
 		    }
 		    case NodeConstants.Types.SET_OP: {
 		        for (PlanNode childNode : root.getChildren()) {
 		            PlanNode projectNode = NodeEditor.findNodePreOrder(childNode, NodeConstants.Types.PROJECT);
-	                List<SingleElementSymbol> projectCols = (List<SingleElementSymbol>)projectNode.getProperty(NodeConstants.Info.PROJECT_COLS);
+	                List<Expression> projectCols = (List<Expression>)projectNode.getProperty(NodeConstants.Info.PROJECT_COLS);
 	                assignOutputElements(childNode, projectCols, metadata, capFinder, rules, analysisRecord, context);
 	            }
 	            break;
@@ -210,14 +209,14 @@
 		                execute(intoRoot.getFirstChild(), metadata, capFinder, rules, analysisRecord, context);
 		                return;
 		            }
-	            	List<SingleElementSymbol> projectCols = outputElements;
+	            	List<Expression> projectCols = outputElements;
 	            	boolean modifiedProject = false;
 	            	PlanNode sortNode = NodeEditor.findParent(root, NodeConstants.Types.SORT, NodeConstants.Types.SOURCE);
 	            	if (sortNode != null && sortNode.hasBooleanProperty(NodeConstants.Info.UNRELATED_SORT)) {
 	            		//if this is the initial rule run, remove unrelated order before changing the project cols
 			            if (!finalRun) {
 		            		OrderBy elements = (OrderBy) sortNode.getProperty(NodeConstants.Info.SORT_ORDER);
-		            		projectCols = new ArrayList<SingleElementSymbol>(projectCols);
+		            		projectCols = new ArrayList<Expression>(projectCols);
 		            		for (OrderByItem item : elements.getOrderByItems()) {
 		            			if (item.getExpressionPosition() == -1) {
 		            				projectCols.remove(item.getSymbol());
@@ -241,7 +240,7 @@
 	            	}
 		    	}
 	            
-	            List<SingleElementSymbol> requiredInput = collectRequiredInputSymbols(root);
+	            List<Expression> requiredInput = collectRequiredInputSymbols(root);
 	            //targeted optimization for unnecessary aggregation
 	            if (root.getType() == NodeConstants.Types.GROUP && root.hasBooleanProperty(Info.IS_OPTIONAL) && NodeEditor.findParent(root, NodeConstants.Types.ACCESS) == null) {
 	            	PlanNode old = root;
@@ -279,7 +278,7 @@
 	                //determine which elements go to each side of the join
 	                for (PlanNode childNode : root.getChildren()) {
 	                    Set<GroupSymbol> filterGroups = FrameUtil.findJoinSourceNode(childNode).getGroups();
-	                    List<SingleElementSymbol> filteredElements = filterElements(requiredInput, filterGroups);
+	                    List<Expression> filteredElements = filterElements(requiredInput, filterGroups);
 
 	                    // Call child recursively
 	                    assignOutputElements(childNode, filteredElements, metadata, capFinder, rules, analysisRecord, context);
@@ -290,17 +289,17 @@
 	}
 
 	public static Set<WindowFunction> getWindowFunctions(
-			List<SingleElementSymbol> projectCols) {
+			List<Expression> projectCols) {
 		LinkedHashSet<WindowFunction> windowFunctions = new LinkedHashSet<WindowFunction>();
-		for (SingleElementSymbol singleElementSymbol : projectCols) {
+		for (Expression singleElementSymbol : projectCols) {
 			AggregateSymbolCollectorVisitor.getAggregates(singleElementSymbol, null, null, null, windowFunctions, null);
 		}
 		return windowFunctions;
 	}
 
-    private List<SingleElementSymbol> filterElements(Collection<? extends SingleElementSymbol> requiredInput, Set<GroupSymbol> filterGroups) {
-        List<SingleElementSymbol> filteredElements = new ArrayList<SingleElementSymbol>();
-        for (SingleElementSymbol element : requiredInput) {
+    private List<Expression> filterElements(Collection<? extends Expression> requiredInput, Set<GroupSymbol> filterGroups) {
+        List<Expression> filteredElements = new ArrayList<Expression>();
+        for (Expression element : requiredInput) {
             if(filterGroups.containsAll(GroupsUsedByElementsVisitor.getGroups(element))) {
                 filteredElements.add(element);
             }
@@ -320,8 +319,8 @@
      * @throws QueryMetadataException 
      * @throws QueryPlannerException 
      */
-    static List<? extends SingleElementSymbol> determineSourceOutput(PlanNode root,
-                                           List<SingleElementSymbol> outputElements,
+    static List<? extends Expression> determineSourceOutput(PlanNode root,
+                                           List<Expression> outputElements,
                                            QueryMetadataInterface metadata,
                                            CapabilitiesFinder capFinder) throws QueryMetadataException, TeiidComponentException, QueryPlannerException {
         PlanNode virtualRoot = root.getLastChild();
@@ -350,7 +349,7 @@
     		return outputElements;
         }
         OrderBy sortOrder = (OrderBy)sort.getProperty(NodeConstants.Info.SORT_ORDER);
-        List<SingleElementSymbol> topCols = FrameUtil.findTopCols(sort);
+        List<Expression> topCols = FrameUtil.findTopCols(sort);
         
         SymbolMap symbolMap = (SymbolMap)root.getProperty(NodeConstants.Info.SYMBOL_MAP);
         
@@ -386,7 +385,7 @@
      * @return The filtered list of columns for this node (used in recursing tree)
      * @throws QueryPlannerException 
      */
-	static List<SingleElementSymbol> filterVirtualElements(PlanNode sourceNode, List<SingleElementSymbol> outputColumns, QueryMetadataInterface metadata) throws QueryPlannerException {
+	static List<Expression> filterVirtualElements(PlanNode sourceNode, List<Expression> outputColumns, QueryMetadataInterface metadata) throws QueryPlannerException {
 
 		PlanNode virtualRoot = sourceNode.getLastChild();
 
@@ -429,10 +428,10 @@
 			}
         }
         
-        List<SingleElementSymbol> newCols = null;
+        List<Expression> newCols = null;
         for(int i=allProjects.size()-1; i>=0; i--) {
             PlanNode projectNode = allProjects.get(i);
-            List<SingleElementSymbol> projectCols = (List<SingleElementSymbol>) projectNode.getProperty(NodeConstants.Info.PROJECT_COLS);
+            List<Expression> projectCols = (List<Expression>) projectNode.getProperty(NodeConstants.Info.PROJECT_COLS);
 
             newCols = RelationalNode.projectTuple(filteredIndex, projectCols, true);
             
@@ -442,7 +441,7 @@
 					if (filteredIndex[j] != -1) {
 						continue;
 					}
-					SingleElementSymbol ex = (SingleElementSymbol) outputColumns.get(j).clone();
+					Expression ex = (Expression) outputColumns.get(j).clone();
 					ExpressionMappingVisitor.mapExpressions(ex, childMap.asMap());
 					newCols.set(j, ex);
 					filteredIndex[j] = j;
@@ -506,25 +505,25 @@
      * for instance to create a new element symbol or sort on it, etc.
      * @param node Node to collect for
      */
-	private List<SingleElementSymbol> collectRequiredInputSymbols(PlanNode node) {
+	private List<Expression> collectRequiredInputSymbols(PlanNode node) {
 
-        Set<SingleElementSymbol> requiredSymbols = new LinkedHashSet<SingleElementSymbol>();
-        Set<SingleElementSymbol> createdSymbols = new HashSet<SingleElementSymbol>();
+        Set<Expression> requiredSymbols = new LinkedHashSet<Expression>();
+        Set<Expression> createdSymbols = new HashSet<Expression>();
         
-        List<SingleElementSymbol> outputCols = (List<SingleElementSymbol>) node.getProperty(NodeConstants.Info.OUTPUT_COLS);
+        List<Expression> outputCols = (List<Expression>) node.getProperty(NodeConstants.Info.OUTPUT_COLS);
 
 		switch(node.getType()) {
 			case NodeConstants.Types.PROJECT:
             {
-                List<SingleElementSymbol> projectCols = (List<SingleElementSymbol>) node.getProperty(NodeConstants.Info.PROJECT_COLS);
-                for (SingleElementSymbol ss : projectCols) {
+                List<Expression> projectCols = (List<Expression>) node.getProperty(NodeConstants.Info.PROJECT_COLS);
+                for (Expression ss : projectCols) {
                     if(ss instanceof AliasSymbol) {
                         createdSymbols.add(ss);
                         
                         ss = ((AliasSymbol)ss).getSymbol();
                     }
                     
-                    if (ss instanceof WindowFunction || (ss instanceof ExpressionSymbol && !(ss instanceof AggregateSymbol))) {
+                    if (ss instanceof WindowFunction || ss instanceof ExpressionSymbol) {
                         createdSymbols.add(ss);
                     }
                     boolean symbolRequired = false;
@@ -573,7 +572,7 @@
 				Set<ElementSymbol> usedAggregates = new HashSet<ElementSymbol>();
 				
 				// Take credit for creating any aggregates that are needed above
-				for (SingleElementSymbol outputSymbol : outputCols) {
+				for (Expression outputSymbol : outputCols) {
 					if (!(outputSymbol instanceof ElementSymbol)) {
 						continue;
 					}
@@ -621,7 +620,7 @@
         requiredSymbols.addAll(tempRequired);
 */        
         // Add any columns to required that are in this node's output but were not created here
-        for (SingleElementSymbol currentOutputSymbol : outputCols) {
+        for (Expression currentOutputSymbol : outputCols) {
             if(!(createdSymbols.contains(currentOutputSymbol)) ) {
                 requiredSymbols.add(currentOutputSymbol);
             }
@@ -631,15 +630,15 @@
         //TODO: this should depend upon whether the expressions are deterministic
         if (node.getType() == NodeConstants.Types.PROJECT) {
             Set<Expression> expressions = new HashSet<Expression>();
-            for (Iterator<SingleElementSymbol> iterator = requiredSymbols.iterator(); iterator.hasNext();) {
-                SingleElementSymbol ses = iterator.next();
+            for (Iterator<Expression> iterator = requiredSymbols.iterator(); iterator.hasNext();) {
+                Expression ses = iterator.next();
                 if (!expressions.add(SymbolMap.getExpression(ses))) {
                     iterator.remove();
                 }
             }
         }
         
-        return new ArrayList<SingleElementSymbol>(requiredSymbols);
+        return new ArrayList<Expression>(requiredSymbols);
 	}
 
     /**

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleChooseJoinStrategy.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleChooseJoinStrategy.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleChooseJoinStrategy.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -45,7 +45,7 @@
 import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.symbol.ExpressionSymbol;
 import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Symbol;
 import org.teiid.query.sql.visitor.GroupsUsedByElementsVisitor;
 import org.teiid.query.util.CommandContext;
 
@@ -167,11 +167,11 @@
         }
 	}
     
-    public static List<SingleElementSymbol> createExpressionSymbols(List<? extends Expression> expressions) {
-        List<SingleElementSymbol> result = new ArrayList<SingleElementSymbol>();
+    public static List<Expression> createExpressionSymbols(List<? extends Expression> expressions) {
+        List<Expression> result = new ArrayList<Expression>();
         for (Expression expression : expressions) {
-            if (expression instanceof SingleElementSymbol) {
-                result.add((SingleElementSymbol)expression);
+            if (expression instanceof Symbol) {
+                result.add(expression);
                 continue;
             } 
             result.add(new ExpressionSymbol("expr", expression)); //$NON-NLS-1$

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleCollapseSource.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleCollapseSource.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleCollapseSource.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -55,26 +55,7 @@
 import org.teiid.query.processor.relational.RelationalPlan;
 import org.teiid.query.resolver.util.ResolverUtil;
 import org.teiid.query.rewriter.QueryRewriter;
-import org.teiid.query.sql.lang.Command;
-import org.teiid.query.sql.lang.CompoundCriteria;
-import org.teiid.query.sql.lang.Criteria;
-import org.teiid.query.sql.lang.ExistsCriteria;
-import org.teiid.query.sql.lang.From;
-import org.teiid.query.sql.lang.FromClause;
-import org.teiid.query.sql.lang.GroupBy;
-import org.teiid.query.sql.lang.Insert;
-import org.teiid.query.sql.lang.JoinPredicate;
-import org.teiid.query.sql.lang.JoinType;
-import org.teiid.query.sql.lang.Limit;
-import org.teiid.query.sql.lang.OrderBy;
-import org.teiid.query.sql.lang.OrderByItem;
-import org.teiid.query.sql.lang.Query;
-import org.teiid.query.sql.lang.QueryCommand;
-import org.teiid.query.sql.lang.Select;
-import org.teiid.query.sql.lang.SetQuery;
-import org.teiid.query.sql.lang.SubqueryContainer;
-import org.teiid.query.sql.lang.SubqueryFromClause;
-import org.teiid.query.sql.lang.UnaryFromClause;
+import org.teiid.query.sql.lang.*;
 import org.teiid.query.sql.lang.SetQuery.Operation;
 import org.teiid.query.sql.navigator.DeepPostOrderNavigator;
 import org.teiid.query.sql.symbol.AggregateSymbol;
@@ -84,7 +65,6 @@
 import org.teiid.query.sql.symbol.ExpressionSymbol;
 import org.teiid.query.sql.symbol.GroupSymbol;
 import org.teiid.query.sql.symbol.ScalarSubquery;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 import org.teiid.query.sql.util.SymbolMap;
 import org.teiid.query.sql.visitor.AggregateSymbolCollectorVisitor;
 import org.teiid.query.sql.visitor.ExpressionMappingVisitor;
@@ -169,7 +149,7 @@
 			return;
 		}
 		// ensure that all columns are comparable - they might not be if there is an intermediate project
-		for (SingleElementSymbol ses : queryCommand.getProjectedSymbols()) {
+		for (Expression ses : queryCommand.getProjectedSymbols()) {
 			if (DataTypeManager.isNonComparable(DataTypeManager.getDataTypeName(ses.getType()))) {
 				return;
 			}
@@ -239,7 +219,7 @@
         }
 		Query query = new Query();
         Select select = new Select();
-        List<SingleElementSymbol> columns = (List<SingleElementSymbol>)node.getProperty(NodeConstants.Info.OUTPUT_COLS);
+        List<Expression> columns = (List<Expression>)node.getProperty(NodeConstants.Info.OUTPUT_COLS);
         prepareSubqueries(ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(columns));
         select.addSymbols(columns);
         query.setSelect(select);
@@ -498,7 +478,7 @@
 		OrderBy orderBy = (OrderBy)node.getProperty(NodeConstants.Info.SORT_ORDER);
 		query.setOrderBy(orderBy);
 		if (query instanceof Query) {
-			List<SingleElementSymbol> cols = query.getProjectedSymbols();
+			List<Expression> cols = query.getProjectedSymbols();
 			for (OrderByItem item : orderBy.getOrderByItems()) {
 				item.setExpressionPosition(cols.indexOf(item.getSymbol()));
 			}
@@ -613,13 +593,8 @@
 	        }
 	    }
 	    Select innerSelect = new Select();
-	    int index = 0;
 	    for (Expression expr : newSelectColumns) {
-	        if (expr instanceof SingleElementSymbol) {
-	            innerSelect.addSymbol((SingleElementSymbol)expr);
-	        } else {
-	            innerSelect.addSymbol(new ExpressionSymbol("EXPR" + index++ , expr)); //$NON-NLS-1$
-	        }
+            innerSelect.addSymbol(expr);
 	    }
 	    query.setSelect(innerSelect);
 	    Query outerQuery = null;
@@ -628,9 +603,9 @@
 	    } catch (TeiidException err) {
 	        throw new TeiidRuntimeException(err);
 	    }
-	    Iterator<SingleElementSymbol> iter = outerQuery.getSelect().getProjectedSymbols().iterator();
-	    HashMap<Expression, SingleElementSymbol> expressionMap = new HashMap<Expression, SingleElementSymbol>();
-	    for (SingleElementSymbol symbol : query.getSelect().getProjectedSymbols()) {
+	    Iterator<Expression> iter = outerQuery.getSelect().getProjectedSymbols().iterator();
+	    HashMap<Expression, Expression> expressionMap = new HashMap<Expression, Expression>();
+	    for (Expression symbol : query.getSelect().getProjectedSymbols()) {
 	        expressionMap.put(SymbolMap.getExpression(symbol), iter.next());
 	    }
 	    ExpressionMappingVisitor.mapExpressions(groupBy, expressionMap);

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleDecomposeJoin.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleDecomposeJoin.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleDecomposeJoin.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -54,7 +54,6 @@
 import org.teiid.query.sql.symbol.ElementSymbol;
 import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 import org.teiid.query.sql.util.SymbolMap;
 import org.teiid.query.util.CommandContext;
 
@@ -211,7 +210,7 @@
 		group = RulePlaceAccess.recontextSymbol(group, groups);
 		
 		PlanNode projectNode = NodeEditor.findNodePreOrder(newUnion, NodeConstants.Types.PROJECT);
-		List<? extends SingleElementSymbol> projectedSymbols = (List<? extends SingleElementSymbol>)projectNode.getProperty(Info.PROJECT_COLS);
+		List<? extends Expression> projectedSymbols = (List<? extends Expression>)projectNode.getProperty(Info.PROJECT_COLS);
 
     	SymbolMap newSymbolMap = RulePushAggregates.createSymbolMap(group, projectedSymbols, newUnion, metadata);
 	    PlanNode view = RuleDecomposeJoin.createSource(group, newUnion, newSymbolMap);
@@ -324,7 +323,7 @@
 		PlanNode branchSource = NodeFactory.getNewNode(NodeConstants.Types.SOURCE);
 		branchSource.addGroup(group);
 		PlanNode projectNode = NodeEditor.findNodePreOrder(unionNode, NodeConstants.Types.PROJECT);
-		branchSource.setProperty(Info.SYMBOL_MAP, SymbolMap.createSymbolMap(symbolMap.getKeys(), (List<? extends SingleElementSymbol>)projectNode.getProperty(Info.PROJECT_COLS)));
+		branchSource.setProperty(Info.SYMBOL_MAP, SymbolMap.createSymbolMap(symbolMap.getKeys(), (List<? extends Expression>)projectNode.getProperty(Info.PROJECT_COLS)));
 		unionNode.addAsParent(branchSource);
 		return branchSource;
 	}

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleImplementJoinStrategy.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleImplementJoinStrategy.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleImplementJoinStrategy.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -50,8 +50,8 @@
 import org.teiid.query.sql.lang.JoinType;
 import org.teiid.query.sql.lang.OrderBy;
 import org.teiid.query.sql.symbol.ElementSymbol;
+import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 import org.teiid.query.sql.util.SymbolMap;
 import org.teiid.query.sql.visitor.GroupsUsedByElementsVisitor;
 import org.teiid.query.util.CommandContext;
@@ -115,8 +115,8 @@
             	}
             }
 
-            List<SingleElementSymbol> leftExpressions = (List<SingleElementSymbol>) joinNode.getProperty(NodeConstants.Info.LEFT_EXPRESSIONS);
-            List<SingleElementSymbol> rightExpressions = (List<SingleElementSymbol>) joinNode.getProperty(NodeConstants.Info.RIGHT_EXPRESSIONS);
+            List<Expression> leftExpressions = (List<Expression>) joinNode.getProperty(NodeConstants.Info.LEFT_EXPRESSIONS);
+            List<Expression> rightExpressions = (List<Expression>) joinNode.getProperty(NodeConstants.Info.RIGHT_EXPRESSIONS);
             int origExpressionCount = leftExpressions.size();
 
             //check index information on each side
@@ -136,9 +136,9 @@
             	List<Object> keyCols = metadata.getElementIDsInKey(key);
             	int[] reorder = new int[keyCols.size()];
             	List<Integer> toCriteria = new ArrayList<Integer>(rightExpressions.size() - keyCols.size()); 
-            	List<SingleElementSymbol> keyExpressions = right?rightExpressions:leftExpressions;
+            	List<Expression> keyExpressions = right?rightExpressions:leftExpressions;
         		for (int j = 0; j < keyExpressions.size(); j++) {
-					SingleElementSymbol ses = keyExpressions.get(j);
+					Expression ses = keyExpressions.get(j);
 					if (!(ses instanceof ElementSymbol)) {
 						continue;
 					}
@@ -156,8 +156,8 @@
 				}
         		List<Criteria> joinCriteria = (List<Criteria>) joinNode.getProperty(Info.NON_EQUI_JOIN_CRITERIA);
         		for (int index : toCriteria) {
-					SingleElementSymbol lses = leftExpressions.get(index);
-					SingleElementSymbol rses = rightExpressions.get(index);
+					Expression lses = leftExpressions.get(index);
+					Expression rses = rightExpressions.get(index);
 					CompareCriteria cc = new CompareCriteria(lses, CompareCriteria.EQ, rses);
 					if (joinCriteria == null || joinCriteria.isEmpty()) {
 						joinCriteria = new ArrayList<Criteria>();
@@ -178,7 +178,7 @@
 	        		&& joinNode.getProperty(NodeConstants.Info.JOIN_TYPE) == JoinType.JOIN_INNER 
 	        		&& joinNode.getProperty(NodeConstants.Info.DEPENDENT_VALUE_SOURCE) != null
 	        		&& !joinNode.hasCollectionProperty(Info.NON_EQUI_JOIN_CRITERIA)) {
-	        	Collection<SingleElementSymbol> output = (Collection<SingleElementSymbol>) joinNode.getProperty(NodeConstants.Info.OUTPUT_COLS);
+	        	Collection<Expression> output = (Collection<Expression>) joinNode.getProperty(NodeConstants.Info.OUTPUT_COLS);
 	        	Collection<GroupSymbol> groups = GroupsUsedByElementsVisitor.getGroups(output);
 	        	if (Collections.disjoint(groups, FrameUtil.findJoinSourceNode(joinNode.getFirstChild()).getGroups())) {
 	        		pushRight = false;
@@ -205,14 +205,14 @@
      * @throws TeiidComponentException 
      * @throws QueryMetadataException 
      */
-    static boolean insertSort(PlanNode childNode, List<SingleElementSymbol> expressions, PlanNode jnode, QueryMetadataInterface metadata, CapabilitiesFinder capFinder,
+    static boolean insertSort(PlanNode childNode, List<Expression> expressions, PlanNode jnode, QueryMetadataInterface metadata, CapabilitiesFinder capFinder,
     		boolean attemptPush) throws QueryMetadataException, TeiidComponentException {
-        Set<SingleElementSymbol> orderSymbols = new LinkedHashSet<SingleElementSymbol>(expressions); 
+        Set<Expression> orderSymbols = new LinkedHashSet<Expression>(expressions); 
 
         PlanNode sourceNode = FrameUtil.findJoinSourceNode(childNode);
         PlanNode joinNode = childNode.getParent();
 
-        Set<SingleElementSymbol> outputSymbols = new LinkedHashSet<SingleElementSymbol>((List<SingleElementSymbol>)childNode.getProperty(NodeConstants.Info.OUTPUT_COLS));
+        Set<Expression> outputSymbols = new LinkedHashSet<Expression>((List<Expression>)childNode.getProperty(NodeConstants.Info.OUTPUT_COLS));
         
         int oldSize = outputSymbols.size();
         
@@ -220,7 +220,7 @@
         
         boolean needsCorrection = outputSymbols.size() > oldSize;
                 
-        PlanNode sortNode = createSortNode(new ArrayList<SingleElementSymbol>(orderSymbols), outputSymbols);
+        PlanNode sortNode = createSortNode(new ArrayList<Expression>(orderSymbols), outputSymbols);
         
         boolean distinct = false;
         if (sourceNode.getFirstChild() != null && sourceNode.getType() == NodeConstants.Types.SOURCE && outputSymbols.size() == expressions.size() && outputSymbols.containsAll(expressions)) {
@@ -270,7 +270,7 @@
         return false;
     }
 
-    private static PlanNode createSortNode(List<SingleElementSymbol> orderSymbols,
+    private static PlanNode createSortNode(List<Expression> orderSymbols,
                                            Collection outputElements) {
         PlanNode sortNode = NodeFactory.getNewNode(NodeConstants.Types.SORT);
         sortNode.setProperty(NodeConstants.Info.SORT_ORDER, new OrderBy(orderSymbols));

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleMergeCriteria.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleMergeCriteria.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleMergeCriteria.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -54,18 +54,7 @@
 import org.teiid.query.resolver.util.ResolverUtil;
 import org.teiid.query.rewriter.QueryRewriter;
 import org.teiid.query.sql.LanguageObject;
-import org.teiid.query.sql.lang.CompareCriteria;
-import org.teiid.query.sql.lang.CompoundCriteria;
-import org.teiid.query.sql.lang.Criteria;
-import org.teiid.query.sql.lang.ExistsCriteria;
-import org.teiid.query.sql.lang.FromClause;
-import org.teiid.query.sql.lang.GroupBy;
-import org.teiid.query.sql.lang.JoinType;
-import org.teiid.query.sql.lang.OrderBy;
-import org.teiid.query.sql.lang.OrderByItem;
-import org.teiid.query.sql.lang.Query;
-import org.teiid.query.sql.lang.SubqueryCompareCriteria;
-import org.teiid.query.sql.lang.SubquerySetCriteria;
+import org.teiid.query.sql.lang.*;
 import org.teiid.query.sql.navigator.DeepPostOrderNavigator;
 import org.teiid.query.sql.symbol.AggregateSymbol;
 import org.teiid.query.sql.symbol.Constant;
@@ -75,7 +64,6 @@
 import org.teiid.query.sql.symbol.GroupSymbol;
 import org.teiid.query.sql.symbol.Reference;
 import org.teiid.query.sql.symbol.ScalarSubquery;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 import org.teiid.query.sql.symbol.AggregateSymbol.Type;
 import org.teiid.query.sql.util.SymbolMap;
 import org.teiid.query.sql.visitor.AggregateSymbolCollectorVisitor;
@@ -296,7 +284,7 @@
 		
 		try {
 			//clone the symbols as they may change during planning
-			List<SingleElementSymbol> projectedSymbols = LanguageObject.Util.deepClone(plannedResult.query.getProjectedSymbols(), SingleElementSymbol.class);
+			List<Expression> projectedSymbols = LanguageObject.Util.deepClone(plannedResult.query.getProjectedSymbols(), Expression.class);
 			//NOTE: we could tap into the relationalplanner at a lower level to get this in a plan node form,
 			//the major benefit would be to reuse the dependent join planning logic if possible.
 			if (analysisRecord != null && analysisRecord.recordDebug()) {
@@ -345,7 +333,7 @@
             semiJoin.addLastChild(node);
             PlanNode result = current.getParent();
             NodeEditor.removeChildNode(result, current);
-            RuleImplementJoinStrategy.insertSort(semiJoin.getFirstChild(), (List<SingleElementSymbol>) plannedResult.leftExpressions, semiJoin, metadata, capFinder, true);
+            RuleImplementJoinStrategy.insertSort(semiJoin.getFirstChild(), (List<Expression>) plannedResult.leftExpressions, semiJoin, metadata, capFinder, true);
             return result;
 		} catch (QueryPlannerException e) {
 			//can't be done - probably access patterns - what about dependent
@@ -535,21 +523,21 @@
 			}
 		}
 		HashSet<Expression> projectedSymbols = new HashSet<Expression>();
-		for (SingleElementSymbol ses : plannedResult.query.getProjectedSymbols()) {
+		for (Expression ses : plannedResult.query.getProjectedSymbols()) {
 			projectedSymbols.add(SymbolMap.getExpression(ses));
 		}
 		for (Expression ses : requiredExpressions) {
 			if (projectedSymbols.add(ses)) {
-				if (ses instanceof SingleElementSymbol) {
-					plannedResult.query.getSelect().addSymbol((SingleElementSymbol)ses);
+				if (ses instanceof Expression) {
+					plannedResult.query.getSelect().addSymbol((Expression)ses);
 				} else {
 					plannedResult.query.getSelect().addSymbol(new ExpressionSymbol("expr", (Expression) ses.clone())); //$NON-NLS-1$
 				}
 			}
 		}
-		for (SingleElementSymbol ses : (List<SingleElementSymbol>)plannedResult.rightExpressions) {
+		for (Expression ses : (List<Expression>)plannedResult.rightExpressions) {
 			if (projectedSymbols.add(SymbolMap.getExpression(ses))) {
-				plannedResult.query.getSelect().addSymbol((SingleElementSymbol)ses.clone());
+				plannedResult.query.getSelect().addSymbol((Expression)ses.clone());
 			}
 		}
 		return true;
@@ -585,7 +573,7 @@
 		RuleChooseJoinStrategy.separateCriteria(leftGroups, rightGroups, plannedResult.leftExpressions, plannedResult.rightExpressions, crits, plannedResult.nonEquiJoinCriteria);
 	}
 
-	public static boolean isDistinct(Query query, List<SingleElementSymbol> expressions, QueryMetadataInterface metadata)
+	public static boolean isDistinct(Query query, List<Expression> expressions, QueryMetadataInterface metadata)
 			throws QueryMetadataException, TeiidComponentException {
 		boolean distinct = false;
 		if (query.getGroupBy() != null) {

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleMergeVirtual.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleMergeVirtual.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleMergeVirtual.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -48,7 +48,6 @@
 import org.teiid.query.sql.symbol.ElementSymbol;
 import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 import org.teiid.query.sql.util.SymbolMap;
 import org.teiid.query.sql.visitor.ElementCollectorVisitor;
 import org.teiid.query.sql.visitor.FunctionCollectorVisitor;
@@ -227,12 +226,12 @@
             return root;
         }
         
-        List<? extends SingleElementSymbol> requiredElements = RuleAssignOutputElements.determineSourceOutput(frame, new ArrayList<SingleElementSymbol>(), metadata, null);
-        List<SingleElementSymbol> selectSymbols = (List<SingleElementSymbol>)parentProject.getProperty(NodeConstants.Info.PROJECT_COLS);
+        List<? extends Expression> requiredElements = RuleAssignOutputElements.determineSourceOutput(frame, new ArrayList<Expression>(), metadata, null);
+        List<Expression> selectSymbols = (List<Expression>)parentProject.getProperty(NodeConstants.Info.PROJECT_COLS);
 
         // check that it only performs simple projection and that all required symbols are projected
         LinkedHashSet<ElementSymbol> symbols = new LinkedHashSet<ElementSymbol>(); //ensuring there are no duplicates prevents problems with subqueries  
-        for (SingleElementSymbol symbol : selectSymbols) {
+        for (Expression symbol : selectSymbols) {
             Expression expr = SymbolMap.getExpression(symbol);
             if (!(expr instanceof ElementSymbol)) {
                 return root;
@@ -247,7 +246,7 @@
         }
         
         // re-order the lower projects
-        RuleAssignOutputElements.filterVirtualElements(frame, new ArrayList<SingleElementSymbol>(symbols), metadata);
+        RuleAssignOutputElements.filterVirtualElements(frame, new ArrayList<Expression>(symbols), metadata);
 
         // remove phantom select nodes
         nodeToCheck = parentProject.getFirstChild();
@@ -302,10 +301,10 @@
     }
 
 	private static void correctOrderBy(PlanNode frame,
-			List<SingleElementSymbol> selectSymbols, PlanNode startNode) {
+			List<Expression> selectSymbols, PlanNode startNode) {
 		PlanNode sort = NodeEditor.findParent(startNode, NodeConstants.Types.SORT, NodeConstants.Types.SOURCE | NodeConstants.Types.SET_OP);
 		if (sort != null) { //special handling is needed since we are retaining the child aliases
-			List<SingleElementSymbol> childProject = (List<SingleElementSymbol>)NodeEditor.findNodePreOrder(frame, NodeConstants.Types.PROJECT).getProperty(NodeConstants.Info.PROJECT_COLS);
+			List<Expression> childProject = (List<Expression>)NodeEditor.findNodePreOrder(frame, NodeConstants.Types.PROJECT).getProperty(NodeConstants.Info.PROJECT_COLS);
 			OrderBy elements = (OrderBy)sort.getProperty(NodeConstants.Info.SORT_ORDER);
 			for (OrderByItem item : elements.getOrderByItems()) {
 				item.setSymbol(childProject.get(selectSymbols.indexOf(item.getSymbol())));
@@ -326,7 +325,7 @@
         	return false;
         }
 
-        List<SingleElementSymbol> selectSymbols = (List<SingleElementSymbol>)projectNode.getProperty(NodeConstants.Info.PROJECT_COLS);
+        List<Expression> selectSymbols = (List<Expression>)projectNode.getProperty(NodeConstants.Info.PROJECT_COLS);
         
         HashSet<GroupSymbol> groups = new HashSet<GroupSymbol>();
         for (PlanNode sourceNode : NodeEditor.findAllNodes(projectNode, NodeConstants.Types.SOURCE, NodeConstants.Types.SOURCE)) {
@@ -352,7 +351,7 @@
         }
 
         for (int i = 0; i < selectSymbols.size(); i++) {
-        	SingleElementSymbol symbol = selectSymbols.get(i);
+        	Expression symbol = selectSymbols.get(i);
             Collection scalarSubqueries = ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(symbol);
             if (!scalarSubqueries.isEmpty()) {
                 return false;

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePlanSorts.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePlanSorts.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePlanSorts.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -47,7 +47,6 @@
 import org.teiid.query.sql.symbol.ElementSymbol;
 import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.symbol.ExpressionSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 import org.teiid.query.sql.util.SymbolMap;
 import org.teiid.query.util.CommandContext;
 
@@ -90,13 +89,13 @@
 				root = checkForProjectOptimization(node, root, metadata, capFinder, record);
 			}
 			OrderBy orderBy = (OrderBy)node.getProperty(NodeConstants.Info.SORT_ORDER);
-			List<SingleElementSymbol> orderColumns = orderBy.getSortKeys();
+			List<Expression> orderColumns = orderBy.getSortKeys();
 			List<Expression> sortExpressions = new ArrayList<Expression>(orderColumns.size());
 			PlanNode possibleSort = NodeEditor.findNodePreOrder(node, NodeConstants.Types.GROUP, NodeConstants.Types.SOURCE | NodeConstants.Types.ACCESS);
 			if (possibleSort != null) {
 				boolean otherExpression = false;
 				SymbolMap groupMap = (SymbolMap)possibleSort.getProperty(Info.SYMBOL_MAP);
-				for (SingleElementSymbol singleElementSymbol : orderColumns) {
+				for (Expression singleElementSymbol : orderColumns) {
 					Expression ex = SymbolMap.getExpression(singleElementSymbol);
 					if (ex instanceof ElementSymbol) {
 						sortExpressions.add(groupMap.getMappedExpression((ElementSymbol) ex));						
@@ -154,7 +153,7 @@
 				node.setProperty(NodeConstants.Info.IS_DUP_REMOVAL, true);
 				if (cardinalityDependent) {
 					PlanNode source = NodeEditor.findNodePreOrder(node, NodeConstants.Types.SOURCE);
-					List<SingleElementSymbol> sourceOutput = (List<SingleElementSymbol>)source.getProperty(Info.OUTPUT_COLS);
+					List<Expression> sourceOutput = (List<Expression>)source.getProperty(Info.OUTPUT_COLS);
 					PlanNode child = node.getFirstChild();
 					while (child != source) {
 						child.setProperty(Info.OUTPUT_COLS, sourceOutput);
@@ -231,14 +230,14 @@
 		} else {
 			return root;
 		}
-		List<SingleElementSymbol> childOutputCols = (List<SingleElementSymbol>) projectNode.getFirstChild().getProperty(Info.OUTPUT_COLS);
+		List<Expression> childOutputCols = (List<Expression>) projectNode.getFirstChild().getProperty(Info.OUTPUT_COLS);
 		OrderBy orderBy = (OrderBy) node.getProperty(Info.SORT_ORDER);
-		List<SingleElementSymbol> orderByKeys = orderBy.getSortKeys();
-		for (SingleElementSymbol ss : orderByKeys) {
+		List<Expression> orderByKeys = orderBy.getSortKeys();
+		for (Expression ss : orderByKeys) {
 			if(ss instanceof AliasSymbol) {
                 ss = ((AliasSymbol)ss).getSymbol();
             }
-            if (ss instanceof ExpressionSymbol && !(ss instanceof AggregateSymbol)) {
+            if (ss instanceof ExpressionSymbol) {
                 return root; //TODO: insert a new project node to handle this case
             }
 			if (!childOutputCols.contains(ss)) {
@@ -261,7 +260,7 @@
 				projectNode.addFirstChild(node);
 			}
 		}
-		List<SingleElementSymbol> orderByOutputSymbols = (List<SingleElementSymbol>) node.getProperty(Info.OUTPUT_COLS);
+		List<Expression> orderByOutputSymbols = (List<Expression>) node.getProperty(Info.OUTPUT_COLS);
 		boolean unrelated = false;
 		if (node.hasBooleanProperty(Info.UNRELATED_SORT)) {
 			node.setProperty(Info.UNRELATED_SORT, false);

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushAggregates.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushAggregates.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushAggregates.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -22,19 +22,7 @@
 
 package org.teiid.query.optimizer.relational.rules;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 
 import org.teiid.api.exception.query.QueryMetadataException;
 import org.teiid.api.exception.query.QueryPlannerException;
@@ -69,16 +57,7 @@
 import org.teiid.query.sql.lang.OrderBy;
 import org.teiid.query.sql.lang.Select;
 import org.teiid.query.sql.lang.SetQuery.Operation;
-import org.teiid.query.sql.symbol.AggregateSymbol;
-import org.teiid.query.sql.symbol.AliasSymbol;
-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.ExpressionSymbol;
-import org.teiid.query.sql.symbol.Function;
-import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.symbol.SearchedCaseExpression;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.*;
 import org.teiid.query.sql.symbol.AggregateSymbol.Type;
 import org.teiid.query.sql.util.SymbolMap;
 import org.teiid.query.sql.visitor.AggregateSymbolCollectorVisitor;
@@ -219,7 +198,7 @@
 			return;
 		}
 		
-		List<SingleElementSymbol> copy = new ArrayList<SingleElementSymbol>(aggregates);
+		List<AggregateSymbol> copy = new ArrayList<AggregateSymbol>(aggregates);
 		aggregates.clear();
 		Map<AggregateSymbol, Expression> aggMap = buildAggregateMap(copy, metadata, aggregates);
 		
@@ -247,7 +226,7 @@
 		
 		updateParentAggs(groupNode, context, aggMap, metadata);
 		
-		List<SingleElementSymbol> symbols = (List<SingleElementSymbol>) NodeEditor.findNodePreOrder(unionSourceParent, NodeConstants.Types.PROJECT).getProperty(Info.PROJECT_COLS);
+		List<Expression> symbols = (List<Expression>) NodeEditor.findNodePreOrder(unionSourceParent, NodeConstants.Types.PROJECT).getProperty(Info.PROJECT_COLS);
 		GroupSymbol modifiedGroup = group.clone();
 		SymbolMap symbolMap = createSymbolMap(modifiedGroup, symbols, unionSourceParent, metadata);
 		unionSourceParent.setProperty(Info.SYMBOL_MAP, symbolMap);
@@ -290,11 +269,11 @@
 			SymbolMap oldGroupingMap = (SymbolMap) groupNode.getProperty(Info.SYMBOL_MAP);
 			GroupSymbol oldGroup = oldGroupingMap.asMap().keySet().iterator().next().getGroupSymbol();
 			SymbolMap groupingMap = RelationalPlanner.buildGroupingNode(compositeAggs, (List<? extends Expression>) groupNode.getProperty(Info.GROUP_COLS), groupNode, context, idGenerator);
-			ArrayList<SingleElementSymbol> projectCols = new ArrayList<SingleElementSymbol>(oldGroupingMap.asMap().size());
+			ArrayList<Expression> projectCols = new ArrayList<Expression>(oldGroupingMap.asMap().size());
 			SymbolMap correctedMap = new SymbolMap();
 			Map<Expression, ElementSymbol> inverseMap = groupingMap.inserseMapping();
 			for (Map.Entry<ElementSymbol, Expression> entry : oldGroupingMap.asMap().entrySet()) {
-				SingleElementSymbol ses = null;
+				Expression ses = null;
 				if (entry.getValue() instanceof AggregateSymbol) {
 					Expression ex = aggMap.get(entry.getValue());
 					if (ex instanceof AggregateSymbol) {
@@ -306,8 +285,8 @@
 				} else {
 					ses = inverseMap.get(entry.getValue());
 				}
-				ses = (SingleElementSymbol) ses.clone();
-				projectCols.add(new AliasSymbol(entry.getKey().getShortCanonicalName(), ses));
+				ses = (Expression) ses.clone();
+				projectCols.add(new AliasSymbol(Symbol.getShortName(entry.getKey()), ses));
 				correctedMap.addMapping(entry.getKey(), SymbolMap.getExpression(ses));
 			}
 			PlanNode projectNode = groupNode.getParent();
@@ -350,7 +329,7 @@
 					planNode, false);
 			first = false;
 		}
-		List<SingleElementSymbol> symbols = (List<SingleElementSymbol>) NodeEditor.findNodePreOrder(sourceNode, NodeConstants.Types.PROJECT).getProperty(Info.PROJECT_COLS);
+		List<Expression> symbols = (List<Expression>) NodeEditor.findNodePreOrder(sourceNode, NodeConstants.Types.PROJECT).getProperty(Info.PROJECT_COLS);
 		GroupSymbol modifiedGroup = group.clone();
 		SymbolMap symbolMap = createSymbolMap(modifiedGroup, symbols, sourceNode, metadata);
 		sourceNode.setProperty(Info.SYMBOL_MAP, symbolMap);
@@ -383,18 +362,18 @@
 		//branches other than the first need to have their projected column names updated
 		if (!first) {
 			PlanNode sortNode = NodeEditor.findNodePreOrder(planNode, NodeConstants.Types.SORT, NodeConstants.Types.SOURCE);
-			List<SingleElementSymbol> sortOrder = null;
+			List<Expression> sortOrder = null;
 			OrderBy orderBy = null;
 			if (sortNode != null) {
 				orderBy = (OrderBy)sortNode.getProperty(Info.SORT_ORDER);
 				sortOrder = orderBy.getSortKeys();
 			}
-			List<SingleElementSymbol> projectCols = FrameUtil.findTopCols(planNode);
+			List<Expression> projectCols = FrameUtil.findTopCols(planNode);
 			List<ElementSymbol> virtualElements = parentMap.getKeys();
 			for (int i = 0; i < virtualElements.size(); i++) {
 				ElementSymbol virtualElem = virtualElements.get(i);
-				SingleElementSymbol projectedSymbol = projectCols.get(i);
-				if (!projectedSymbol.getShortCanonicalName().equals(virtualElem.getShortCanonicalName())) {
+				Expression projectedSymbol = projectCols.get(i);
+				if (!Symbol.getShortName(projectedSymbol).equals(Symbol.getShortName(virtualElem))) {
 					if (sortOrder != null) {
 						int sortIndex = sortOrder.indexOf(projectedSymbol);
 						if (sortIndex > -1) {
@@ -456,12 +435,12 @@
 		}
 	}
 	
-	private void updateSymbolName(List<SingleElementSymbol> projectCols, int i,
-			ElementSymbol virtualElem, SingleElementSymbol projectedSymbol) {
+	private void updateSymbolName(List<Expression> projectCols, int i,
+			ElementSymbol virtualElem, Expression projectedSymbol) {
 		if (projectedSymbol instanceof AliasSymbol) {
-			((AliasSymbol)projectedSymbol).setShortName(virtualElem.getShortCanonicalName());
+			((AliasSymbol)projectedSymbol).setShortName(Symbol.getShortName(virtualElem));
 		} else {
-			projectCols.set(i, new AliasSymbol(virtualElem.getShortCanonicalName(), projectedSymbol));
+			projectCols.set(i, new AliasSymbol(Symbol.getShortName(virtualElem), projectedSymbol));
 		}
 	}
 
@@ -524,7 +503,7 @@
 	}
     
 	static SymbolMap createSymbolMap(GroupSymbol group,
-			List<? extends SingleElementSymbol> virtualElements,
+			List<? extends Expression> virtualElements,
 			PlanNode child, QueryMetadataInterface metadata)
 			throws TeiidComponentException, QueryMetadataException {
 		TempMetadataStore store = new TempMetadataStore();
@@ -555,8 +534,8 @@
         
         while (currentNode != null) {
             if (currentNode.getType() == NodeConstants.Types.PROJECT) {
-                List<SingleElementSymbol> projectedSymbols = (List<SingleElementSymbol>)currentNode.getProperty(NodeConstants.Info.PROJECT_COLS);
-                for (SingleElementSymbol symbol : projectedSymbols) {
+                List<Expression> projectedSymbols = (List<Expression>)currentNode.getProperty(NodeConstants.Info.PROJECT_COLS);
+                for (Expression symbol : projectedSymbols) {
                     mapAggregates(ElementCollectorVisitor.getAggregates(symbol, true), symbolMap, aggregates);
                 }
                 break;
@@ -764,11 +743,11 @@
 
             if (planNode == parentJoin.getFirstChild()) {
                 if (parentJoin.hasCollectionProperty(NodeConstants.Info.LEFT_EXPRESSIONS)) {
-                	filterJoinColumns(stagedGroupingSymbols, groups, (List<SingleElementSymbol>)parentJoin.getProperty(NodeConstants.Info.LEFT_EXPRESSIONS));
+                	filterJoinColumns(stagedGroupingSymbols, groups, (List<Expression>)parentJoin.getProperty(NodeConstants.Info.LEFT_EXPRESSIONS));
                 }
             } else {
                 if (parentJoin.hasCollectionProperty(NodeConstants.Info.RIGHT_EXPRESSIONS)) {
-                	filterJoinColumns(stagedGroupingSymbols, groups, (List<SingleElementSymbol>)parentJoin.getProperty(NodeConstants.Info.RIGHT_EXPRESSIONS));
+                	filterJoinColumns(stagedGroupingSymbols, groups, (List<Expression>)parentJoin.getProperty(NodeConstants.Info.RIGHT_EXPRESSIONS));
                 }
             }
 
@@ -850,12 +829,11 @@
         return result;
     }
 
-    private static Map<AggregateSymbol, Expression> buildAggregateMap(Collection<? extends SingleElementSymbol> aggregateExpressions,
+    private static Map<AggregateSymbol, Expression> buildAggregateMap(Collection<? extends AggregateSymbol> aggregateExpressions,
                                                                         QueryMetadataInterface metadata, Set<AggregateSymbol> nestedAggregates) throws QueryResolverException,
                                                                                                         TeiidComponentException {
         Map<AggregateSymbol, Expression> aggMap = new LinkedHashMap<AggregateSymbol, Expression>();
-        for (SingleElementSymbol symbol : aggregateExpressions) {
-            AggregateSymbol partitionAgg = (AggregateSymbol)symbol;
+        for (AggregateSymbol partitionAgg : aggregateExpressions) {
            
             Expression newExpression = null;
 

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRaiseAccess.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRaiseAccess.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRaiseAccess.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -54,7 +54,6 @@
 import org.teiid.query.sql.symbol.ElementSymbol;
 import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 import org.teiid.query.sql.util.SymbolMap;
 import org.teiid.query.util.CommandContext;
 import org.teiid.translator.ExecutionFactory.SupportedJoinCriteria;
@@ -117,7 +116,7 @@
                 List projectCols = (List) parentNode.getProperty(NodeConstants.Info.PROJECT_COLS);
                 
                 for (int i = 0; i < projectCols.size(); i++) {
-                    SingleElementSymbol symbol = (SingleElementSymbol)projectCols.get(i);
+                    Expression symbol = (Expression)projectCols.get(i);
                     if(! canPushSymbol(symbol, true, modelID, metadata, capFinder, record)) {
                         return null;
                     } 
@@ -301,7 +300,7 @@
 
     static boolean canRaiseOverGroupBy(PlanNode groupNode,
                                          PlanNode accessNode,
-                                         Collection<? extends SingleElementSymbol> aggregates,
+                                         Collection<? extends AggregateSymbol> aggregates,
                                          QueryMetadataInterface metadata,
                                          CapabilitiesFinder capFinder, AnalysisRecord record) throws QueryMetadataException,
                                                         TeiidComponentException {
@@ -322,7 +321,7 @@
             }
         }
         if (aggregates != null) {
-            for (SingleElementSymbol aggregateSymbol : aggregates) {
+            for (AggregateSymbol aggregateSymbol : aggregates) {
                 if(! CriteriaCapabilityValidatorVisitor.canPushLanguageObject(aggregateSymbol, modelID, metadata, capFinder, record)) {
                     return false;
                 }

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRaiseNull.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRaiseNull.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRaiseNull.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -46,9 +46,8 @@
 import org.teiid.query.sql.symbol.AliasSymbol;
 import org.teiid.query.sql.symbol.ElementSymbol;
 import org.teiid.query.sql.symbol.Expression;
-import org.teiid.query.sql.symbol.ExpressionSymbol;
 import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Symbol;
 import org.teiid.query.sql.util.SymbolMap;
 import org.teiid.query.util.CommandContext;
 
@@ -147,17 +146,17 @@
                         return raiseNullNode(rootNode, parentNode, nullNode, nodes);
                     }
 
-                    List<SingleElementSymbol> newProjectSymbols = (List<SingleElementSymbol>)firstProject.getProperty(NodeConstants.Info.PROJECT_COLS);
-                    List<SingleElementSymbol> oldProjectSymbols = (List<SingleElementSymbol>)nullNode.getProperty(NodeConstants.Info.PROJECT_COLS);
+                    List<Expression> newProjectSymbols = (List<Expression>)firstProject.getProperty(NodeConstants.Info.PROJECT_COLS);
+                    List<Expression> oldProjectSymbols = (List<Expression>)nullNode.getProperty(NodeConstants.Info.PROJECT_COLS);
                     
                     for (int i = 0; i < newProjectSymbols.size(); i++) {
-                        SingleElementSymbol newSes = newProjectSymbols.get(i);
-                        SingleElementSymbol oldSes = oldProjectSymbols.get(i);
-                        if (newSes instanceof ExpressionSymbol || !newSes.getShortCanonicalName().equals(oldSes.getShortCanonicalName())) {
+                        Expression newSes = newProjectSymbols.get(i);
+                        Expression oldSes = oldProjectSymbols.get(i);
+                        if (!(newSes instanceof Symbol) || !Symbol.getShortName(newSes).equals(Symbol.getShortName(oldSes))) {
                             if (newSes instanceof AliasSymbol) {
                                 newSes = ((AliasSymbol)newSes).getSymbol();
                             }
-                            newProjectSymbols.set(i, new AliasSymbol(oldSes.getShortName(), newSes));
+                            newProjectSymbols.set(i, new AliasSymbol(Symbol.getShortName(oldSes), newSes));
                         }
                     }
                     
@@ -166,7 +165,7 @@
                     if (sort != null) { //correct the sort to the new columns as well
                         OrderBy sortOrder = (OrderBy)sort.getProperty(NodeConstants.Info.SORT_ORDER);
                         for (OrderByItem item : sortOrder.getOrderByItems()) {
-                            SingleElementSymbol sortElement = item.getSymbol();
+                            Expression sortElement = item.getSymbol();
                             sortElement = newProjectSymbols.get(oldProjectSymbols.indexOf(sortElement));
                             item.setSymbol(sortElement);
                         }

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/xml/CriteriaPlanner.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/xml/CriteriaPlanner.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/xml/CriteriaPlanner.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -44,6 +44,7 @@
 import org.teiid.query.sql.symbol.ElementSymbol;
 import org.teiid.query.sql.symbol.Function;
 import org.teiid.query.sql.symbol.GroupSymbol;
+import org.teiid.query.sql.symbol.Symbol;
 import org.teiid.query.sql.visitor.ElementCollectorVisitor;
 import org.teiid.query.sql.visitor.GroupsUsedByElementsVisitor;
 
@@ -131,11 +132,11 @@
         Collection<ElementSymbol> elements = ElementCollectorVisitor.getElements(conjunct, true);
         Set<MappingSourceNode> resultSets = new HashSet<MappingSourceNode>();
         
-        String contextFullName = context.getFullyQualifiedName().toUpperCase();
+        String contextFullName = context.getFullyQualifiedName();
         
         //validate that each element's group is under the current context or is in the direct parentage
         for (ElementSymbol elementSymbol : elements) {
-            String elementFullName = elementSymbol.getCanonicalName();
+            String elementFullName = elementSymbol.getName();
             
             MappingNode node = MappingNode.findNode(mappingDoc, elementFullName);
             
@@ -144,17 +145,17 @@
                 throw new QueryPlannerException(QueryPlugin.Util.getString("CriteriaPlanner.invalid_element", elementSymbol)); //$NON-NLS-1$
             }
             
-            String elementRsFullName = elementRsNode.getFullyQualifiedName().toUpperCase();
+            String elementRsFullName = elementRsNode.getFullyQualifiedName();
             
             //check for a match at or below the context
             if (contextFullName.equals(elementRsFullName) || 
-                            elementRsFullName.startsWith(contextFullName + ElementSymbol.SEPARATOR)) {
+                            elementRsFullName.startsWith(contextFullName + Symbol.SEPARATOR)) {
                 resultSets.add(elementRsNode);
                 continue;
             }
             
             //check for match above the context
-            if (contextFullName.startsWith(elementRsFullName + ElementSymbol.SEPARATOR)) {
+            if (contextFullName.startsWith(elementRsFullName + Symbol.SEPARATOR)) {
                 continue;
             }
             
@@ -256,7 +257,7 @@
         
         String fullyQualifiedNodeName = planEnv.getGlobalMetadata().getFullName(((ElementSymbol)rowLimitFunction.getArg(0)).getMetadataID());
         
-        MappingNode node = MappingNode.findNode(planEnv.mappingDoc, fullyQualifiedNodeName.toUpperCase());
+        MappingNode node = MappingNode.findNode(planEnv.mappingDoc, fullyQualifiedNodeName);
         MappingSourceNode sourceNode = node.getSourceNode();
         if (sourceNode == null) {
             String msg = QueryPlugin.Util.getString("XMLPlanner.The_rowlimit_parameter_{0}_is_not_in_the_scope_of_any_mapping_class", fullyQualifiedNodeName); //$NON-NLS-1$
@@ -333,7 +334,7 @@
         
         ElementSymbol targetContext = (ElementSymbol)contextFunction.getArg(0);
 
-        MappingNode contextNode = MappingNode.findNode(planEnv.mappingDoc, targetContext.getCanonicalName());
+        MappingNode contextNode = MappingNode.findNode(planEnv.mappingDoc, targetContext.getName());
         if (contextNode == null){
             throw new QueryPlannerException("ERR.015.004.0037", QueryPlugin.Util.getString("ERR.015.004.0037", targetContext)); //$NON-NLS-1$ //$NON-NLS-2$
         }

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/xml/MarkExcludeVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/xml/MarkExcludeVisitor.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/xml/MarkExcludeVisitor.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -26,17 +26,7 @@
 import java.util.Iterator;
 import java.util.List;
 
-import org.teiid.query.mapping.xml.MappingAllNode;
-import org.teiid.query.mapping.xml.MappingAttribute;
-import org.teiid.query.mapping.xml.MappingBaseNode;
-import org.teiid.query.mapping.xml.MappingChoiceNode;
-import org.teiid.query.mapping.xml.MappingDocument;
-import org.teiid.query.mapping.xml.MappingElement;
-import org.teiid.query.mapping.xml.MappingRecursiveElement;
-import org.teiid.query.mapping.xml.MappingSequenceNode;
-import org.teiid.query.mapping.xml.MappingSourceNode;
-import org.teiid.query.mapping.xml.MappingVisitor;
-import org.teiid.query.mapping.xml.Navigator;
+import org.teiid.query.mapping.xml.*;
 
 
 /** 
@@ -46,8 +36,8 @@
 public class MarkExcludeVisitor extends MappingVisitor{
     HashSet<String> keepNodes;
     
-    public MarkExcludeVisitor(HashSet<String> keppNodes) {
-        this.keepNodes = keppNodes;
+    public MarkExcludeVisitor(HashSet<String> keepNodes) {
+        this.keepNodes = keepNodes;
     }
 
     // User non-selectable node; just exclude
@@ -74,7 +64,7 @@
     }
      
     public void visit(MappingAttribute attribute) {
-        String name = attribute.getCanonicalName();
+        String name = attribute.getFullyQualifiedName();
         if (keepNodes.contains(name)) {
             // we need to keep this; if not already excluded
             if (!attribute.isExcluded()) {
@@ -90,7 +80,7 @@
     }
 
     public void visit(MappingElement element) {
-        String name = element.getCanonicalName();
+        String name = element.getFullyQualifiedName();
         if (keepNodes.contains(name)) {
             // we need to keep this; if not already excluded
             if (!element.isExcluded()) {

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/xml/QueryUtil.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/xml/QueryUtil.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/xml/QueryUtil.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -56,6 +56,7 @@
 import org.teiid.query.sql.symbol.GroupSymbol;
 import org.teiid.query.sql.symbol.MultipleElementSymbol;
 import org.teiid.query.sql.symbol.Reference;
+import org.teiid.query.sql.symbol.Symbol;
 import org.teiid.query.sql.visitor.ElementCollectorVisitor;
 import org.teiid.query.sql.visitor.ReferenceCollectorVisitor;
 import org.teiid.query.util.CommandContext;
@@ -208,7 +209,7 @@
         for (Iterator i = projectedElements.iterator(); i.hasNext();) {
             ElementSymbol element = (ElementSymbol)i.next();
 
-            symbolMap.put(element, new ElementSymbol(newGroup + ElementSymbol.SEPARATOR + element.getShortName()));
+            symbolMap.put(element, new ElementSymbol(newGroup + Symbol.SEPARATOR + element.getShortName()));
         }
         return symbolMap;
     }

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/xml/SourceNodePlannerVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/xml/SourceNodePlannerVisitor.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/xml/SourceNodePlannerVisitor.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -51,8 +51,9 @@
 import org.teiid.query.sql.lang.UnaryFromClause;
 import org.teiid.query.sql.symbol.AliasSymbol;
 import org.teiid.query.sql.symbol.ElementSymbol;
+import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Symbol;
 import org.teiid.query.sql.visitor.ElementCollectorVisitor;
 import org.teiid.query.sql.visitor.ExpressionMappingVisitor;
 import org.teiid.query.sql.visitor.SQLStringVisitor;
@@ -112,7 +113,7 @@
             baseQuery.getSelect().clearSymbols();
             for (Iterator<ElementSymbol> i = ResolverUtil.resolveElementsInGroup(groupSymbol, planEnv.getGlobalMetadata()).iterator(); i.hasNext();) {
             	ElementSymbol ses = i.next();
-                baseQuery.getSelect().addSymbol(new ElementSymbol(newGroup + SingleElementSymbol.SEPARATOR + ses.getShortName()));
+                baseQuery.getSelect().addSymbol(new ElementSymbol(newGroup + Symbol.SEPARATOR + ses.getShortName()));
             }
             
             rsInfo.setCommand(baseQuery);
@@ -193,18 +194,18 @@
     private boolean areBindingsOnlyToNode(QueryNode modifiedNode, MappingSourceNode sourceNode) 
         throws TeiidComponentException {
         
-        List<SingleElementSymbol> bindings = QueryResolver.parseBindings(modifiedNode);
+        List<Expression> bindings = QueryResolver.parseBindings(modifiedNode);
 
-        String nodeStr = (sourceNode.getActualResultSetName() + ElementSymbol.SEPARATOR).toUpperCase();
+        String nodeStr = sourceNode.getActualResultSetName() + Symbol.SEPARATOR;
         
-        for (Iterator<SingleElementSymbol> i = bindings.iterator(); i.hasNext();) {
-        	SingleElementSymbol ses = i.next();
+        for (Iterator<Expression> i = bindings.iterator(); i.hasNext();) {
+        	Expression ses = i.next();
         	if (ses instanceof AliasSymbol) {
         		ses = ((AliasSymbol)ses).getSymbol();
         	}
             ElementSymbol binding = (ElementSymbol)ses;
             
-            if (!binding.getCanonicalName().startsWith(nodeStr)) {
+            if (!binding.getName().startsWith(nodeStr)) {
                 return false;
             }
         }
@@ -266,9 +267,9 @@
                              QueryNode modifiedNode) throws TeiidComponentException {
         if (oldQueryNode.getBindings() != null) {
             List<String> bindings = new ArrayList<String>();
-            for (Iterator<SingleElementSymbol> i = QueryResolver.parseBindings(oldQueryNode).iterator(); i.hasNext();) {
-            	SingleElementSymbol ses = i.next();
-            	String name = ses.getName();
+            for (Iterator<Expression> i = QueryResolver.parseBindings(oldQueryNode).iterator(); i.hasNext();) {
+            	Expression ses = i.next();
+            	String name = Symbol.getName(ses);
             	boolean useName = false;
             	if (ses instanceof AliasSymbol) {
             		ses = ((AliasSymbol)ses).getSymbol();
@@ -322,7 +323,7 @@
         Collection<ElementSymbol> elementsInCriteria = ElementCollectorVisitor.getElements(criteria, true);
         Map<ElementSymbol, ElementSymbol> mappedElements = new HashMap<ElementSymbol, ElementSymbol>();
 
-        List<SingleElementSymbol> projectedSymbols = transformationQuery.getProjectedSymbols();
+        List<Expression> projectedSymbols = transformationQuery.getProjectedSymbols();
         
         boolean addedProjectedSymbol = false;
         
@@ -335,12 +336,12 @@
             }
             
             if (projectedSymbols.contains(symbol)) {
-                mappedElements.put(symbol, new ElementSymbol(groupName + ElementSymbol.SEPARATOR + symbol.getShortName()));
+                mappedElements.put(symbol, new ElementSymbol(groupName + Symbol.SEPARATOR + symbol.getShortName()));
                 continue;
             }
             AliasSymbol alias = getMachingAlias(projectedSymbols, symbol);
             if (alias != null) {
-                mappedElements.put(symbol, new ElementSymbol(groupName + ElementSymbol.SEPARATOR + alias.getShortName()));
+                mappedElements.put(symbol, new ElementSymbol(groupName + Symbol.SEPARATOR + alias.getShortName()));
                 continue;
             }
             // this means that the criteria symbol, is not projected, so add the element symbol
@@ -356,7 +357,7 @@
             // also add to the projected elements on the temp group.
             metadata.getMetadataStore().addElementSymbolToTempGroup(newGroupSymbol.getName(), selectSymbol);
             
-            ElementSymbol upperSymbol = new ElementSymbol(groupName + ElementSymbol.SEPARATOR + selectSymbol.getShortName());
+            ElementSymbol upperSymbol = new ElementSymbol(groupName + Symbol.SEPARATOR + selectSymbol.getShortName());
             mappedElements.put(symbol, upperSymbol);
             
             //add to the symbol map.  the base symbol is not to the original group, since it doesn't really project this element 
@@ -376,7 +377,7 @@
 
         String newSymbolName = elementSymbol.getShortName();
 
-        while (symbolMap.values().contains(new ElementSymbol(newGroupName + ElementSymbol.SEPARATOR + newSymbolName))) {
+        while (symbolMap.values().contains(new ElementSymbol(newGroupName + Symbol.SEPARATOR + newSymbolName))) {
             newSymbolName = elementSymbol.getShortName() + "_" + index++; //$NON-NLS-1$
         }
 
@@ -387,8 +388,8 @@
      * If the element has alias wrapping, then return the matching alias element.
      * @return matched alias symbol; null otherwise.
      */
-    private AliasSymbol getMachingAlias(List<SingleElementSymbol> elementsInGroup, ElementSymbol symbol) {
-    	for (SingleElementSymbol element : elementsInGroup) {
+    private AliasSymbol getMachingAlias(List<Expression> elementsInGroup, ElementSymbol symbol) {
+    	for (Expression element : elementsInGroup) {
             if (element instanceof AliasSymbol) {
                 AliasSymbol alias = (AliasSymbol)element;
                 if (alias.getSymbol().equals(symbol)) {

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLNodeMappingVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLNodeMappingVisitor.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLNodeMappingVisitor.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -86,7 +86,7 @@
 	    	if (!xml) {
     			return symbol;
 	    	}
-	    	String path = metadata.getFullName(metadataId).toUpperCase();
+	    	String path = metadata.getFullName(metadataId);
 	
     		// Find mapping node for specified path
     		MappingNode node = MappingNode.findNode(rootNode, path); 
@@ -134,7 +134,7 @@
         try {
             PreOrPostOrderNavigator.doVisit(object, mappingVisitor, PreOrPostOrderNavigator.POST_ORDER, deep);
         } catch (TeiidRuntimeException e) {
-            Throwable child = e.getChild();
+            Throwable child = e.getCause();
             
             if (child instanceof TeiidComponentException) {
                 throw (TeiidComponentException)child;

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLPlanToProcessVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLPlanToProcessVisitor.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLPlanToProcessVisitor.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -28,38 +28,8 @@
 import java.util.Map;
 import java.util.Stack;
 
-import org.teiid.query.mapping.xml.InterceptingVisitor;
-import org.teiid.query.mapping.xml.MappingAllNode;
-import org.teiid.query.mapping.xml.MappingAttribute;
-import org.teiid.query.mapping.xml.MappingBaseNode;
-import org.teiid.query.mapping.xml.MappingChoiceNode;
-import org.teiid.query.mapping.xml.MappingCommentNode;
-import org.teiid.query.mapping.xml.MappingCriteriaNode;
-import org.teiid.query.mapping.xml.MappingDocument;
-import org.teiid.query.mapping.xml.MappingElement;
-import org.teiid.query.mapping.xml.MappingInterceptor;
-import org.teiid.query.mapping.xml.MappingRecursiveElement;
-import org.teiid.query.mapping.xml.MappingSequenceNode;
-import org.teiid.query.mapping.xml.MappingSourceNode;
-import org.teiid.query.mapping.xml.ResultSetInfo;
-import org.teiid.query.processor.xml.AbortProcessingInstruction;
-import org.teiid.query.processor.xml.AddNodeInstruction;
-import org.teiid.query.processor.xml.BlockInstruction;
-import org.teiid.query.processor.xml.Condition;
-import org.teiid.query.processor.xml.CriteriaCondition;
-import org.teiid.query.processor.xml.DefaultCondition;
-import org.teiid.query.processor.xml.EndBlockInstruction;
-import org.teiid.query.processor.xml.EndDocumentInstruction;
-import org.teiid.query.processor.xml.ExecSqlInstruction;
-import org.teiid.query.processor.xml.ExecStagingTableInstruction;
-import org.teiid.query.processor.xml.IfInstruction;
-import org.teiid.query.processor.xml.InitializeDocumentInstruction;
-import org.teiid.query.processor.xml.MoveCursorInstruction;
-import org.teiid.query.processor.xml.MoveDocInstruction;
-import org.teiid.query.processor.xml.ProcessorInstruction;
-import org.teiid.query.processor.xml.Program;
-import org.teiid.query.processor.xml.RecurseProgramCondition;
-import org.teiid.query.processor.xml.WhileInstruction;
+import org.teiid.query.mapping.xml.*;
+import org.teiid.query.processor.xml.*;
 
 
 
@@ -379,7 +349,7 @@
                 
         // this is set by root recursive node. Note that the MappingClass on recursive
         // node is same as the source on the root recursive node.
-        Program recursiveProgram = (Program)context.get(element.getMappingClass().toUpperCase());
+        Program recursiveProgram = (Program)context.get(element.getMappingClass());
         IfInstruction ifInst = new IfInstruction();
         RecurseProgramCondition recurseCondition = buildRecurseCondition(element, recursiveProgram);
         ifInst.addCondition(recurseCondition);

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLPlanner.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLPlanner.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLPlanner.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -54,10 +54,9 @@
 import org.teiid.query.sql.lang.Query;
 import org.teiid.query.sql.lang.Select;
 import org.teiid.query.sql.symbol.ElementSymbol;
+import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.symbol.GroupSymbol;
 import org.teiid.query.sql.symbol.MultipleElementSymbol;
-import org.teiid.query.sql.symbol.SelectSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 import org.teiid.query.sql.visitor.ElementCollectorVisitor;
 import org.teiid.query.util.CommandContext;
 
@@ -244,7 +243,7 @@
      */
     static MappingDocument preMarkExcluded(Query xmlCommand, MappingDocument doc) {
         Select select = xmlCommand.getSelect();
-        SelectSymbol firstSymbol = select.getSymbol(0);
+        Expression firstSymbol = select.getSymbol(0);
 
         // 0. mark the nodes to be excluded
         if(firstSymbol instanceof MultipleElementSymbol && ((MultipleElementSymbol)firstSymbol).getGroup() == null) {
@@ -255,10 +254,10 @@
         Collection<ElementSymbol> validElements = ElementCollectorVisitor.getElements(select, true);
         HashSet<String> elements = new HashSet<String>(validElements.size());
         for (ElementSymbol element : validElements) {
-            elements.add(element.getCanonicalName());
+            elements.add(element.getName());
         }
         
-        // keep the nodes given mark the rest of the nodes to be elementated
+        // keep the nodes given mark the rest of the nodes to be eliminated
         return MarkExcludeVisitor.markExcludedNodes(doc, elements);
      }    
         
@@ -281,13 +280,13 @@
             return;
         }
         
-        List<SingleElementSymbol> elements = orderBy.getSortKeys();
+        List<Expression> elements = orderBy.getSortKeys();
 		List<Boolean> types = orderBy.getTypes();
 
 		for (int i = 0; i< elements.size(); i++) {
 			ElementSymbol elemSymbol = (ElementSymbol) elements.get(i);
 			
-            String nodeName = planEnv.getGlobalMetadata().getFullName(elemSymbol.getMetadataID()).toUpperCase();
+            String nodeName = planEnv.getGlobalMetadata().getFullName(elemSymbol.getMetadataID());
             MappingNode elementNode = MappingNode.findNode(planEnv.mappingDoc, nodeName); 
 
             // make sure that the name in source is defined for this node, so that it can be used

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLPlannerEnvironment.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLPlannerEnvironment.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLPlannerEnvironment.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -32,13 +32,14 @@
 import org.teiid.query.mapping.xml.ResultSetInfo;
 import org.teiid.query.metadata.QueryMetadataInterface;
 import org.teiid.query.metadata.TempMetadataAdapter;
+import org.teiid.query.metadata.TempMetadataID;
 import org.teiid.query.metadata.TempMetadataStore;
 import org.teiid.query.optimizer.capabilities.CapabilitiesFinder;
 import org.teiid.query.processor.xml.Program;
 import org.teiid.query.processor.xml.XMLProcessorEnvironment;
 import org.teiid.query.sql.lang.Query;
-import org.teiid.query.sql.symbol.ElementSymbol;
 import org.teiid.query.sql.symbol.GroupSymbol;
+import org.teiid.query.sql.symbol.Symbol;
 import org.teiid.query.util.CommandContext;
 
 
@@ -97,7 +98,7 @@
      * be defined here so that they are known to all for resolution.  This map should be 
      * used with a TempMetadataStore and a TempMetadataAdapter.  
      */
-    private Map globalTempMetadata = new HashMap();
+    private TempMetadataStore globalTempMetadata = new TempMetadataStore();
     
     private Map stagingTableMap = new HashMap();
     
@@ -118,7 +119,7 @@
       
         
     TempMetadataAdapter getGlobalMetadata() {
-        return new TempMetadataAdapter(metadata, new TempMetadataStore(this.globalTempMetadata), this.stagingTableMap, this.queryNodeMap);
+        return new TempMetadataAdapter(metadata, this.globalTempMetadata, this.stagingTableMap, this.queryNodeMap);
     }
 
     public ResultSetInfo getStagingTableResultsInfo(String groupName) {
@@ -143,8 +144,8 @@
         return this.stagingTableMap.containsKey(groupId);
     }
 
-    public void addToGlobalMetadata(Map data) {
-        this.globalTempMetadata.putAll(data);
+    public void addToGlobalMetadata(Map<String, TempMetadataID> data) {
+        this.globalTempMetadata.getData().putAll(data);
     }
     
     public void addQueryNodeToMetadata(Object metadataId, QueryNode node) {
@@ -160,7 +161,7 @@
     }    
     
     public String getAliasName(final String rsName) {
-        String inlineViewName = rsName.replace(ElementSymbol.SEPARATOR.charAt(0), '_');
+        String inlineViewName = rsName.replace(Symbol.SEPARATOR.charAt(0), '_');
         return inlineViewName;
     }    
 }
\ No newline at end of file

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLProjectionMinimizer.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLProjectionMinimizer.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLProjectionMinimizer.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -50,7 +50,7 @@
 import org.teiid.query.sql.symbol.ElementSymbol;
 import org.teiid.query.sql.symbol.ExpressionSymbol;
 import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.symbol.SelectSymbol;
+import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.visitor.ElementCollectorVisitor;
 import org.teiid.query.sql.visitor.ExpressionMappingVisitor;
 
@@ -168,7 +168,7 @@
 								Map reverseMap = QueryUtil.createSymbolMap(new GroupSymbol(element.getAliasResultName()), 
 										rsInfo.getResultSetName(),
 										ResolverUtil.resolveElementsInGroup(QueryUtil.createResolvedGroup(element.getAliasResultName(), planEnv.getGlobalMetadata()), planEnv.getGlobalMetadata()));
-								Select select = new Select(new ArrayList<SelectSymbol>(elements));
+								Select select = new Select(new ArrayList<Expression>(elements));
 								ExpressionMappingVisitor.mapExpressions(select, reverseMap);
 								rsQuery.setSelect(select);
 							}

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLQueryPlanner.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLQueryPlanner.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLQueryPlanner.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -48,6 +48,7 @@
 import org.teiid.query.metadata.QueryMetadataInterface;
 import org.teiid.query.metadata.TempMetadataAdapter;
 import org.teiid.query.metadata.TempMetadataID;
+import org.teiid.query.metadata.TempMetadataStore;
 import org.teiid.query.optimizer.QueryOptimizer;
 import org.teiid.query.optimizer.relational.rules.NewCalculateCostUtil;
 import org.teiid.query.processor.ProcessorPlan;
@@ -55,21 +56,7 @@
 import org.teiid.query.processor.relational.RelationalPlan;
 import org.teiid.query.resolver.QueryResolver;
 import org.teiid.query.resolver.util.ResolverUtil;
-import org.teiid.query.sql.lang.Command;
-import org.teiid.query.sql.lang.Criteria;
-import org.teiid.query.sql.lang.Drop;
-import org.teiid.query.sql.lang.ExistsCriteria;
-import org.teiid.query.sql.lang.FromClause;
-import org.teiid.query.sql.lang.GroupContext;
-import org.teiid.query.sql.lang.Into;
-import org.teiid.query.sql.lang.JoinPredicate;
-import org.teiid.query.sql.lang.JoinType;
-import org.teiid.query.sql.lang.Limit;
-import org.teiid.query.sql.lang.Query;
-import org.teiid.query.sql.lang.QueryCommand;
-import org.teiid.query.sql.lang.SubqueryContainer;
-import org.teiid.query.sql.lang.SubqueryFromClause;
-import org.teiid.query.sql.lang.UnaryFromClause;
+import org.teiid.query.sql.lang.*;
 import org.teiid.query.sql.symbol.Constant;
 import org.teiid.query.sql.symbol.ElementSymbol;
 import org.teiid.query.sql.symbol.GroupSymbol;
@@ -393,7 +380,7 @@
 		LinkedHashSet<GroupSymbol> allGroups = new LinkedHashSet<GroupSymbol>();
 		allGroups.add(gs);
 		//TODO: this group should have been marked as xml, or could attempt this step prior to place user criteria
-		if (planEnv.getGlobalMetadata().getMetadataStore().getTempGroupID(gs.getNonCorrelationName().toUpperCase()) == null) {
+		if (planEnv.getGlobalMetadata().getMetadataStore().getTempGroupID(gs.getNonCorrelationName()) == null) {
 			return;
 		}
 		MappingSourceNode parentMsn = findMappingSourceNode(planEnv, gs);
@@ -474,7 +461,7 @@
         planStagaingQuery(false, groupName, groupName, query, planEnv);
     }
     /**
-     * This method takes given query and adds the "into" symbol to query and resoves it
+     * This method takes given query and adds the "into" symbol to query and resolves it
      * and registers it with planner env as the staging table. Also, builds a unload query
      * to unload the staging table.
      * @throws QueryResolverException 
@@ -540,9 +527,9 @@
         
         // since this was staging table; this adds some temp metadata to the query node; extract
         // that metadata and inject into global metadata store for rest of the queries to use.
-        Map tempMetadata = query.getTemporaryMetadata();
-        if (tempMetadata != null && !tempMetadata.isEmpty()) {
-            planEnv.addToGlobalMetadata(tempMetadata);
+        TempMetadataStore tempMetadata = query.getTemporaryMetadata();
+        if (tempMetadata != null && !tempMetadata.getData().isEmpty()) {
+            planEnv.addToGlobalMetadata(tempMetadata.getData());
         }
         
         ResultSetInfo rsInfo = planEnv.getStagingTableResultsInfo(stageGroupName);
@@ -554,7 +541,6 @@
         intoGroupID.setCardinality(cardinality);
         
         // add the materialization hook for the staged table to original one.
-        //GroupSymbol groupSymbol = (GroupSymbol)query.getFrom().getGroups().get(0);
         planEnv.addStagingTable(srcGroup.getMetadataID(), intoGroupID);
         
         // plan the unload of the staging table

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLStagaingQueryPlanner.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLStagaingQueryPlanner.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLStagaingQueryPlanner.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -68,7 +68,7 @@
 import org.teiid.query.sql.symbol.ExpressionSymbol;
 import org.teiid.query.sql.symbol.GroupSymbol;
 import org.teiid.query.sql.symbol.Reference;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.visitor.ExpressionMappingVisitor;
 import org.teiid.query.sql.visitor.GroupCollectorVisitor;
 
@@ -220,10 +220,10 @@
         		
         		if (parentRsInfo.getTempTable() == null) {
 	        		//create a temp table to represent the resultset
-	                List<SingleElementSymbol> projectedSymbols = parentRsInfo.getCommand().getProjectedSymbols();
-	                ArrayList<SingleElementSymbol> elements = new ArrayList<SingleElementSymbol>(projectedSymbols.size());
-	        		for (SingleElementSymbol singleElementSymbol : projectedSymbols) {
-	        			singleElementSymbol = (SingleElementSymbol) singleElementSymbol.clone();
+	                List<Expression> projectedSymbols = parentRsInfo.getCommand().getProjectedSymbols();
+	                ArrayList<Expression> elements = new ArrayList<Expression>(projectedSymbols.size());
+	        		for (Expression singleElementSymbol : projectedSymbols) {
+	        			singleElementSymbol = (Expression) singleElementSymbol.clone();
 						ResolverVisitor.resolveLanguageObject(singleElementSymbol, planEnv.getGlobalMetadata());
 						elements.add(singleElementSymbol);
 					}

Modified: trunk/engine/src/main/java/org/teiid/query/parser/ParseInfo.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/parser/ParseInfo.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/parser/ParseInfo.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -23,7 +23,6 @@
 package org.teiid.query.parser;
 
 import java.io.Serializable;
-import java.util.Map;
 
 import org.teiid.core.util.PropertiesUtils;
 
@@ -33,8 +32,6 @@
 	private static final long serialVersionUID = -7323683731955992888L;
     private static final boolean ANSI_QUOTED_DEFAULT = PropertiesUtils.getBooleanProperty(System.getProperties(), "org.teiid.ansiQuotedIdentifiers", true); //$NON-NLS-1$
 
-	public Map<String, Integer> nameCounts = null;
-	
     public int referenceCount = 0;
 
     // treat a double quoted variable as variable instead of string 

Modified: trunk/engine/src/main/java/org/teiid/query/parser/QueryParser.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/parser/QueryParser.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/parser/QueryParser.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -35,7 +35,6 @@
 import org.teiid.query.sql.lang.Command;
 import org.teiid.query.sql.lang.Criteria;
 import org.teiid.query.sql.symbol.Expression;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 
 /**
  * <p>Converts a SQL-string to an object version of a query.  This
@@ -297,14 +296,14 @@
         return result;
     }
     
-    public SingleElementSymbol parseSelectExpression(String sql) throws QueryParserException {
+    public Expression parseSelectExpression(String sql) throws QueryParserException {
         if(sql == null) {
             throw new IllegalArgumentException(QueryPlugin.Util.getString("QueryParser.nullSqlExpr")); //$NON-NLS-1$
         }
 
         ParseInfo dummyInfo = new ParseInfo();
 
-        SingleElementSymbol result = null;
+        Expression result = null;
         try{
             result = getSqlParser(sql).selectExpression(dummyInfo);
 

Modified: trunk/engine/src/main/java/org/teiid/query/parser/SQLParserUtil.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/parser/SQLParserUtil.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/parser/SQLParserUtil.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -22,7 +22,6 @@
 
 package org.teiid.query.parser;
 
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
@@ -316,29 +315,6 @@
         }
     }
     
-    /**
-     * Generate an expression name based on the function type and previous names.
-     * @param info Parse info, including counts for each function type
-     * @param functionType Null for expression, the function name for aggregates
-     * @return New unique function name
-     */
-    String generateFunctionName(ParseInfo info, String functionType) {
-    	if (functionType == null) {
-    		functionType = "expr"; //$NON-NLS-1$
-    	} else {
-    		functionType = functionType.toLowerCase();
-    	}
-    	if (info.nameCounts == null) {
-    		info.nameCounts = new HashMap<String, Integer>();
-    	}
-        Integer num = info.nameCounts.get(functionType);
-        if (num == null) {
-        	num = 0;
-        }
-        info.nameCounts.put(functionType, num + 1);
-        return functionType + (num == 0 ? "" : ""+num); //$NON-NLS-1$   //$NON-NLS-2$  
-    }
-    
     int getOperator(String opString) {
         if (opString.equals("=")) { //$NON-NLS-1$
             return CompareCriteria.EQ;

Modified: trunk/engine/src/main/java/org/teiid/query/processor/proc/ExecDynamicSqlInstruction.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/proc/ExecDynamicSqlInstruction.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/processor/proc/ExecDynamicSqlInstruction.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -65,7 +65,6 @@
 import org.teiid.query.sql.symbol.ElementSymbol;
 import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 import org.teiid.query.sql.util.VariableContext;
 import org.teiid.query.util.CommandContext;
 import org.teiid.query.validator.ValidationVisitor;
@@ -141,19 +140,18 @@
 
 			Command command = QueryParser.getQueryParser().parseCommand(value.toString());
 			command.setExternalGroupContexts(dynamicCommand.getExternalGroupContexts());
-			command.setTemporaryMetadata(dynamicCommand.getTemporaryMetadata());
+			command.setTemporaryMetadata(dynamicCommand.getTemporaryMetadata().clone());
 			updateContextWithUsingValues(procEnv, localContext);
 			
-			Map tempMetadata = command.getTemporaryMetadata();
-			final TempMetadataStore metadataStore = new TempMetadataStore(tempMetadata);
+			TempMetadataStore metadataStore = command.getTemporaryMetadata();
             
             if (dynamicCommand.getUsing() != null
                             && !dynamicCommand.getUsing().isEmpty()) {
-                metadataStore.addTempGroup(Reserved.USING, new LinkedList(dynamicCommand.getUsing().getClauseMap().keySet()));
+                metadataStore.addTempGroup(Reserved.USING, new LinkedList<ElementSymbol>(dynamicCommand.getUsing().getClauseMap().keySet()));
                 GroupSymbol using = new GroupSymbol(Reserved.USING);
                 using.setMetadataID(metadataStore.getTempGroupID(Reserved.USING));
                 command.addExternalGroupToContext(using);
-                metadataStore.addTempGroup(ProcedureReservedWords.DVARS, new LinkedList(dynamicCommand.getUsing().getClauseMap().keySet()));
+                metadataStore.addTempGroup(ProcedureReservedWords.DVARS, new LinkedList<ElementSymbol>(dynamicCommand.getUsing().getClauseMap().keySet()));
                 using = new GroupSymbol(ProcedureReservedWords.DVARS);
                 using.setMetadataID(metadataStore.getTempGroupID(ProcedureReservedWords.DVARS));
                 command.addExternalGroupToContext(using);
@@ -200,7 +198,7 @@
             dynamicProgram.addInstruction(inst);
 
             if (dynamicCommand.getIntoGroup() != null) {
-                String groupName = dynamicCommand.getIntoGroup().getCanonicalName();
+                String groupName = dynamicCommand.getIntoGroup().getName();
                 if (!procEnv.getTempTableStore().getAllTempTables().contains(groupName)) {
                 	//create the temp table in the parent scope
                 	Create create = new Create();
@@ -272,7 +270,7 @@
 			QueryProcessingException {
 		// validate project symbols
 		List dynamicExpectedColumns = dynamicCommand.getAsColumns();
-		List<SingleElementSymbol> sourceProjectedSymbolList = command.getProjectedSymbols();
+		List<Expression> sourceProjectedSymbolList = command.getProjectedSymbols();
 
 		if (dynamicExpectedColumns != null && !dynamicExpectedColumns.isEmpty()) {
 			if (dynamicExpectedColumns.size() != sourceProjectedSymbolList.size()) {
@@ -282,14 +280,15 @@
 			// If there is only one project symbol, we won't validate the name.
 
 			Iterator dynamicIter = dynamicExpectedColumns.iterator();
-			Iterator<SingleElementSymbol> sourceIter = sourceProjectedSymbolList.iterator();
+			Iterator<Expression> sourceIter = sourceProjectedSymbolList.iterator();
 			// Check for proper element name and datatype definition in the
 			// dynamic SQL
 			// If the projected symbol list equal to 1, we won't bother checking
 			// the name.
 			while (dynamicIter.hasNext()) {
-				SingleElementSymbol dynamicSymbol = (SingleElementSymbol) dynamicIter.next();
-				Class<?> sourceSymbolDatatype = sourceIter.next().getType();
+				Expression dynamicSymbol = (Expression) dynamicIter.next();
+				Expression sourceExpr = sourceIter.next();
+				Class<?> sourceSymbolDatatype = sourceExpr.getType();
 
 				// Check if the the dynamic sql element types are equal or
 				// implicitly convertible to the source types
@@ -302,13 +301,9 @@
 						&& // If the types aren't the same, and...
 						!DataTypeManager.isImplicitConversion(sourceTypeName,
 								dynamicTypeName)) { // if there's no implicit
-					// conversion between the
-					// two
-					Object[] params = new Object[] { sourceTypeName,
-							dynamicSymbol.getShortName(),
-							dynamicTypeName };
+					// conversion between the two
 					throw new QueryProcessingException(QueryPlugin.Util
-							.getString("ExecDynamicSqlInstruction.6", params)); //$NON-NLS-1$
+							.getString("ExecDynamicSqlInstruction.6", sourceTypeName, sourceExpr, dynamicTypeName)); //$NON-NLS-1$
 				}
 			}
 		}
@@ -316,7 +311,7 @@
 		// do a recursion check
 		// Add group to recursion stack
 		CommandContext context = procEnv.getContext();
-		context.pushCall(parentProcCommand.getVirtualGroup().getCanonicalName());
+		context.pushCall(parentProcCommand.getVirtualGroup().getName());
 	}
 
 	/**

Modified: trunk/engine/src/main/java/org/teiid/query/processor/proc/ForEachRowPlan.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/proc/ForEachRowPlan.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/processor/proc/ForEachRowPlan.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -39,7 +39,6 @@
 import org.teiid.query.sql.lang.Command;
 import org.teiid.query.sql.symbol.ElementSymbol;
 import org.teiid.query.sql.symbol.Expression;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 import org.teiid.query.util.CommandContext;
 
 public class ForEachRowPlan extends ProcessorPlan {
@@ -79,7 +78,7 @@
 	}
 
 	@Override
-	public List<SingleElementSymbol> getOutputElements() {
+	public List<Expression> getOutputElements() {
 		return Command.getUpdateCommandSymbol();
 	}
 

Modified: trunk/engine/src/main/java/org/teiid/query/processor/proc/LoopInstruction.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/proc/LoopInstruction.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/processor/proc/LoopInstruction.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -34,7 +34,8 @@
 import org.teiid.core.TeiidProcessingException;
 import org.teiid.query.processor.ProcessorPlan;
 import org.teiid.query.sql.symbol.ElementSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Expression;
+import org.teiid.query.sql.symbol.Symbol;
 import org.teiid.query.sql.util.VariableContext;
 
 
@@ -44,7 +45,7 @@
     // the loop block
     private Program loopProgram;
     
-    private List elements;
+    private List<ElementSymbol> elements;
     private String label;
     
     public LoopInstruction(Program loopProgram, String rsName, ProcessorPlan plan, String label) {
@@ -64,20 +65,19 @@
     }
 
     public void process(ProcedurePlan procEnv) throws TeiidComponentException {
-        List currentRow = procEnv.getCurrentRow(rsName); 
+        List<?> currentRow = procEnv.getCurrentRow(rsName); 
         VariableContext varContext = procEnv.getCurrentVariableContext();
         //set results to the variable context(the cursor.element is treated as variable)
         if(this.elements == null){
             List schema = procEnv.getSchema(rsName);
-            elements = new ArrayList(schema.size());
+            elements = new ArrayList<ElementSymbol>(schema.size());
             for(int i=0; i< schema.size(); i++){
-                // defect 13432 - schema may contain AliasSymbols. Cast to SingleElementSymbol instead of ElementSymbol
-                SingleElementSymbol element = (SingleElementSymbol)schema.get(i);
-                elements.add(new ElementSymbol(rsName + "." + element.getShortName()));              //$NON-NLS-1$
+                Expression element = (Expression)schema.get(i);
+                elements.add(new ElementSymbol(rsName + "." + Symbol.getShortName(element)));              //$NON-NLS-1$
             }
         }
         for(int i=0; i< elements.size(); i++){
-            varContext.setValue((ElementSymbol)elements.get(i), currentRow.get(i));               
+            varContext.setValue(elements.get(i), currentRow.get(i));               
         }
     }
     

Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/AccessNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/AccessNode.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/AccessNode.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -50,8 +50,6 @@
 import org.teiid.query.sql.lang.Select;
 import org.teiid.query.sql.symbol.Constant;
 import org.teiid.query.sql.symbol.Expression;
-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.util.CommandContext;
 
@@ -74,7 +72,7 @@
     private int schemaSize;
     
     private Object[] projection;
-    private List<SelectSymbol> originalSelect;
+    private List<Expression> originalSelect;
 	private Object modelId;
     
     protected AccessNode() {
@@ -169,18 +167,18 @@
 		}
 		Query query = (Query)atomicCommand;
 		Select select = query.getSelect();
-		List<SelectSymbol> symbols = select.getSymbols();
+		List<Expression> symbols = select.getSymbols();
 		if (symbols.size() == 1) {
 			return;
 		}
 		boolean shouldProject = false;
 		LinkedHashMap<Expression, Integer> uniqueSymbols = new LinkedHashMap<Expression, Integer>();
 		projection = new Object[symbols.size()];
-		this.originalSelect = new ArrayList<SelectSymbol>(query.getSelect().getSymbols());
+		this.originalSelect = new ArrayList<Expression>(query.getSelect().getSymbols());
 		int i = 0;
 		int j = 0;
-		for (Iterator<SelectSymbol> iter = symbols.iterator(); iter.hasNext(); ) {
-			SingleElementSymbol ss = (SingleElementSymbol) iter.next();
+		for (Iterator<Expression> iter = symbols.iterator(); iter.hasNext(); ) {
+			Expression ss = (Expression) iter.next();
 			Expression ex = SymbolMap.getExpression(ss);
 			if (ex instanceof Constant) {
 				projection[i] = ex;
@@ -210,13 +208,13 @@
 				Integer index = uniqueSymbols.get(SymbolMap.getExpression(item.getSymbol()));
 				if (index != null) {
 					item.setExpressionPosition(index);
-					item.setSymbol((SingleElementSymbol) select.getSymbols().get(index));
+					item.setSymbol((Expression) select.getSymbols().get(index));
 				}
 			}
 		}
 	}
 	
-	public List<SelectSymbol> getOriginalSelect() {
+	public List<Expression> getOriginalSelect() {
 		return originalSelect;
 	}
 	

Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentCriteriaProcessor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentCriteriaProcessor.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentCriteriaProcessor.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -22,17 +22,7 @@
 
 package org.teiid.query.processor.relational;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 import org.teiid.api.exception.query.ExpressionEvaluationException;
 import org.teiid.common.buffer.BlockedException;
@@ -54,7 +44,6 @@
 import org.teiid.query.sql.lang.SetCriteria;
 import org.teiid.query.sql.symbol.Constant;
 import org.teiid.query.sql.symbol.Expression;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 import org.teiid.query.sql.util.ValueIterator;
 
 
@@ -94,11 +83,11 @@
                 DependentValueSource originalVs = (DependentValueSource)dependentNode.getContext().getVariableContext().getGlobalValue(valueSource);
                 if (!originalVs.isDistinct()) {
 	            	if (sortUtility == null) {
-	            		List<SingleElementSymbol> sortSymbols = new ArrayList<SingleElementSymbol>(dependentSetStates.size());
+	            		List<Expression> sortSymbols = new ArrayList<Expression>(dependentSetStates.size());
 		                List<Boolean> sortDirection = new ArrayList<Boolean>(sortSymbols.size());
 		                for (int i = 0; i < dependentSetStates.size(); i++) {
 		                    sortDirection.add(Boolean.valueOf(OrderBy.ASC));
-		                    sortSymbols.add((SingleElementSymbol)dependentSetStates.get(i).valueExpression);
+		                    sortSymbols.add(dependentSetStates.get(i).valueExpression);
 		                }
 		                this.sortUtility = new SortUtility(originalVs.getTupleBuffer().createIndexedTupleSource(), sortSymbols, sortDirection, Mode.DUP_REMOVE, dependentNode.getBufferManager(), dependentNode.getConnectionID(), originalVs.getTupleBuffer().getSchema());
 	            	}

Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentValueSource.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentValueSource.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentValueSource.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -35,7 +35,6 @@
 import org.teiid.core.types.DataTypeManager;
 import org.teiid.core.util.Assertion;
 import org.teiid.query.sql.symbol.Expression;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 import org.teiid.query.sql.util.ValueIterator;
 import org.teiid.query.sql.util.ValueIteratorSource;
 
@@ -88,7 +87,7 @@
         		index = buffer.getSchema().indexOf(valueExpression);
         	}
         	Assertion.assertTrue(index != -1);
-        	if (((SingleElementSymbol)buffer.getSchema().get(index)).getType() == DataTypeManager.DefaultDataClasses.BIG_DECIMAL) {
+        	if (((Expression)buffer.getSchema().get(index)).getType() == DataTypeManager.DefaultDataClasses.BIG_DECIMAL) {
         		result = new TreeSet<Object>();
     		} else {
     			result = new HashSet<Object>();

Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/EnhancedSortMergeJoinStrategy.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/EnhancedSortMergeJoinStrategy.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/EnhancedSortMergeJoinStrategy.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -41,7 +41,7 @@
 import org.teiid.query.processor.CollectionTupleSource;
 import org.teiid.query.sql.lang.OrderBy;
 import org.teiid.query.sql.symbol.ElementSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Expression;
 
 
 /**
@@ -122,10 +122,10 @@
     			reorderedSortIndex[j++] = i;
     		}
     	}
-    	List<SingleElementSymbol> reordered = RelationalNode.projectTuple(reorderedSortIndex, elements);
+    	List<Expression> reordered = RelationalNode.projectTuple(reorderedSortIndex, elements);
     	if (!state.isDistinct()) {
     		//need to add a rowid, just in case
-    		reordered = new ArrayList<SingleElementSymbol>(reordered);
+    		reordered = new ArrayList<Expression>(reordered);
     		ElementSymbol id = new ElementSymbol("rowId"); //$NON-NLS-1$
     		id.setType(DataTypeManager.DefaultDataClasses.INTEGER);
     		reordered.add(keyLength, id);

Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/GroupingNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/GroupingNode.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/GroupingNode.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -41,17 +41,7 @@
 import org.teiid.core.TeiidProcessingException;
 import org.teiid.language.SortSpecification.NullOrdering;
 import org.teiid.query.eval.Evaluator;
-import org.teiid.query.function.aggregate.AggregateFunction;
-import org.teiid.query.function.aggregate.ArrayAgg;
-import org.teiid.query.function.aggregate.Avg;
-import org.teiid.query.function.aggregate.ConstantFunction;
-import org.teiid.query.function.aggregate.Count;
-import org.teiid.query.function.aggregate.Max;
-import org.teiid.query.function.aggregate.Min;
-import org.teiid.query.function.aggregate.StatsFunction;
-import org.teiid.query.function.aggregate.Sum;
-import org.teiid.query.function.aggregate.TextAgg;
-import org.teiid.query.function.aggregate.XMLAgg;
+import org.teiid.query.function.aggregate.*;
 import org.teiid.query.processor.BatchCollector;
 import org.teiid.query.processor.ProcessorDataManager;
 import org.teiid.query.processor.BatchCollector.BatchProducer;
@@ -61,7 +51,6 @@
 import org.teiid.query.sql.symbol.AggregateSymbol;
 import org.teiid.query.sql.symbol.ElementSymbol;
 import org.teiid.query.sql.symbol.Expression;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 import org.teiid.query.sql.symbol.TextLine;
 import org.teiid.query.sql.symbol.AggregateSymbol.Type;
 import org.teiid.query.sql.util.SymbolMap;
@@ -167,7 +156,7 @@
 		}
 		
         // Incoming elements and lookup map for evaluating expressions
-        List<? extends SingleElementSymbol> sourceElements = this.getChildren()[0].getElements();
+        List<? extends Expression> sourceElements = this.getChildren()[0].getElements();
         this.elementMap = createLookupMap(sourceElements);
 
     	// List should contain all grouping columns / expressions as we need those for sorting
@@ -178,7 +167,7 @@
                 this.collectedExpressions.add(ex);
 			}
             if (removeDuplicates) {
-            	for (SingleElementSymbol ses : sourceElements) {
+            	for (Expression ses : sourceElements) {
             		collectExpression(SymbolMap.getExpression(ses));
             	}
             	distinctCols = collectedExpressions.size();
@@ -190,7 +179,7 @@
         // Construct aggregate function state accumulators
         functions = new AggregateFunction[getElements().size()];
         for(int i=0; i<getElements().size(); i++) {
-            Expression symbol = (Expression) getElements().get(i);
+            Expression symbol = getElements().get(i);
             if (this.outputMapping != null) {
             	symbol = outputMapping.getMappedExpression((ElementSymbol)symbol);
             }

Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/NestedTableJoinStrategy.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/NestedTableJoinStrategy.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/NestedTableJoinStrategy.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -33,7 +33,6 @@
 import org.teiid.query.sql.lang.JoinType;
 import org.teiid.query.sql.symbol.ElementSymbol;
 import org.teiid.query.sql.symbol.Expression;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 import org.teiid.query.sql.util.SymbolMap;
 
 /**
@@ -164,9 +163,9 @@
 	}
 
 	private void updateContext(List<?> tuple,
-			List<? extends SingleElementSymbol> elements) {
+			List<? extends Expression> elements) {
 		for (int i = 0; i < elements.size(); i++) {
-			SingleElementSymbol element = elements.get(i);
+			Expression element = elements.get(i);
 			if (element instanceof ElementSymbol) {
 				if (tuple == null) {
 					joinNode.getContext().getVariableContext().remove((ElementSymbol)element);

Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/ProjectNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/ProjectNode.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/ProjectNode.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -41,14 +41,13 @@
 import org.teiid.query.processor.ProcessorDataManager;
 import org.teiid.query.sql.symbol.AliasSymbol;
 import org.teiid.query.sql.symbol.Expression;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 import org.teiid.query.sql.util.SymbolMap;
 import org.teiid.query.util.CommandContext;
 
 
 public class ProjectNode extends SubqueryAwareRelationalNode {
 
-	private List<? extends SingleElementSymbol> selectSymbols;
+	private List<? extends Expression> selectSymbols;
 
     // Derived element lookup map
     private Map elementMap;
@@ -79,11 +78,11 @@
      * return List of select symbols
      * @return List of select symbols
      */
-    public List<? extends SingleElementSymbol> getSelectSymbols() {
+    public List<? extends Expression> getSelectSymbols() {
         return this.selectSymbols;
     }
 
-	public void setSelectSymbols(List<? extends SingleElementSymbol> symbols) {
+	public void setSelectSymbols(List<? extends Expression> symbols) {
 		this.selectSymbols = symbols;
 	}
 	
@@ -100,7 +99,7 @@
     	Arrays.fill(this.projectionIndexes, -1);
     	
     	this.expressions = new ArrayList<Expression>(this.selectSymbols.size());
-    	for (SingleElementSymbol ses : this.selectSymbols) {
+    	for (Expression ses : this.selectSymbols) {
 			this.expressions.add(SymbolMap.getExpression(ses));
 		}
         //in the case of select with no from, there is no child node
@@ -120,7 +119,7 @@
         // 3. order of input values == order of output values
         needsProject = childElements.size() != getElements().size();
         for(int i=0; i<selectSymbols.size(); i++) {
-            SingleElementSymbol symbol = selectSymbols.get(i);
+            Expression symbol = selectSymbols.get(i);
             
             if(symbol instanceof AliasSymbol) {
                 Integer index = (Integer) elementMap.get(symbol);

Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalNode.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalNode.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -46,7 +46,6 @@
 import org.teiid.query.processor.BatchCollector.BatchProducer;
 import org.teiid.query.sql.symbol.AliasSymbol;
 import org.teiid.query.sql.symbol.Expression;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 import org.teiid.query.util.CommandContext;
 
 
@@ -54,7 +53,7 @@
 	
 	static class NodeData {
 		int nodeID;
-		List<? extends SingleElementSymbol> elements;
+		List<? extends Expression> elements;
 		Number estimateNodeCardinality;
 		Number setSizeEstimate;
 		Number depAccessEstimate;
@@ -166,16 +165,16 @@
         }
     }
 
-	public void setElements(List<? extends SingleElementSymbol> elements) {
+	public void setElements(List<? extends Expression> elements) {
 		this.data.elements = elements;
 	}
 	
 	@Override
-	public List<? extends SingleElementSymbol> getOutputElements() {
+	public List<? extends Expression> getOutputElements() {
 		return getElements();
 	}
 
-	public List<? extends SingleElementSymbol> getElements() {
+	public List<? extends Expression> getElements() {
 		return this.data.elements;
 	}
     	
@@ -403,9 +402,9 @@
         Map lookupMap = new HashMap();
         for(int i=0; i<elements.size(); i++) {
             Object element = elements.get(i);
-            lookupMap.put(element, new Integer(i));
+            lookupMap.put(element, i);
             if (element instanceof AliasSymbol) {
-                lookupMap.put(((AliasSymbol)element).getSymbol(), new Integer(i));
+                lookupMap.put(((AliasSymbol)element).getSymbol(), i);
             }
         }
         return lookupMap;

Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalPlan.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalPlan.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalPlan.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -159,7 +159,7 @@
     					break;
     				}
     			}
-        		this.tempTableStore.setUpdatable(withCommand.getGroupSymbol().getCanonicalName(), false);
+        		this.tempTableStore.setUpdatable(withCommand.getGroupSymbol().getName(), false);
         		withToProcess.remove(0);
         		withProcessor = null;
 			}

Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/SortUtility.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/SortUtility.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/SortUtility.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -45,7 +45,6 @@
 import org.teiid.query.sql.lang.OrderBy;
 import org.teiid.query.sql.lang.OrderByItem;
 import org.teiid.query.sql.symbol.Expression;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 
 
 /**
@@ -172,7 +171,7 @@
         this.comparator.setNullOrdering(nullOrderings);
     }
     
-    public SortUtility(TupleSource ts, List<? extends SingleElementSymbol> expressions, List<Boolean> types,
+    public SortUtility(TupleSource ts, List<? extends Expression> expressions, List<Boolean> types,
 			Mode mode, BufferManager bufferManager, String connectionID, List schema) {
 		this(ts, new OrderBy(expressions, types).getOrderByItems(), mode, bufferManager, connectionID, schema);
 	}

Modified: trunk/engine/src/main/java/org/teiid/query/processor/xml/ExecSqlInstruction.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/xml/ExecSqlInstruction.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/processor/xml/ExecSqlInstruction.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -75,7 +75,7 @@
 			XMLContext context) throws TeiidComponentException {
 		PlanExecutor executor = context.getResultExecutor(resultSetName);
         if (executor == null) {
-            executor = env.createResultExecutor(resultSetName, info);
+            executor = env.createResultExecutor(info);
             context.setResultExecutor(resultSetName, executor);
         }
 		return executor;

Modified: trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLContext.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLContext.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLContext.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -30,6 +30,7 @@
 import org.teiid.core.TeiidProcessingException;
 import org.teiid.query.QueryPlugin;
 import org.teiid.query.sql.symbol.ElementSymbol;
+import org.teiid.query.sql.symbol.Symbol;
 import org.teiid.query.sql.util.VariableContext;
 
 
@@ -192,7 +193,7 @@
         		continue;
         	}
             ElementSymbol symbol = (ElementSymbol)elements.get(index);
-            variableContext.setValue(new ElementSymbol(resultSetName + ElementSymbol.SEPARATOR + symbol.getShortName()), row.get(index));
+            variableContext.setValue(new ElementSymbol(resultSetName + Symbol.SEPARATOR + symbol.getShortName()), row.get(index));
         }
     }
 }

Modified: trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLProcessorEnvironment.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLProcessorEnvironment.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLProcessorEnvironment.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -112,11 +112,11 @@
      * program stack
      */
     public boolean isRecursiveProgramInStack() {
-        Iterator stackedPrograms = this.programStack.iterator();
+        Iterator<ProgramState> stackedPrograms = this.programStack.iterator();
         // Always at least one program in the stack
-        ProgramState programState = (ProgramState)stackedPrograms.next();
+        ProgramState programState = stackedPrograms.next();
         while (programState.recursionCount == ProgramState.NOT_RECURSIVE && stackedPrograms.hasNext()) {
-            programState = (ProgramState) stackedPrograms.next();
+            programState = stackedPrograms.next();
         }
         return (programState.recursionCount > ProgramState.NOT_RECURSIVE);
     }
@@ -225,7 +225,7 @@
         return result;
     }
 
-    public PlanExecutor createResultExecutor(String resultSetName, ResultSetInfo info) 
+    public PlanExecutor createResultExecutor(ResultSetInfo info) 
         throws TeiidComponentException{
     
         // cloning the plan inside the resultset is not possible

Modified: trunk/engine/src/main/java/org/teiid/query/resolver/ProcedureContainerResolver.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/ProcedureContainerResolver.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/ProcedureContainerResolver.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -52,8 +52,8 @@
 import org.teiid.query.sql.proc.CreateProcedureCommand;
 import org.teiid.query.sql.proc.TriggerAction;
 import org.teiid.query.sql.symbol.ElementSymbol;
+import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 import org.teiid.query.validator.UpdateValidator.UpdateInfo;
 
 
@@ -206,11 +206,11 @@
         procCommand.setUpdateInfo(ProcedureContainerResolver.getUpdateInfo(group, metadata, procCommand.getType()));
     }
 
-    public static GroupSymbol addScalarGroup(String name, TempMetadataStore metadata, GroupContext externalGroups, List<? extends SingleElementSymbol> symbols) {
+    public static GroupSymbol addScalarGroup(String name, TempMetadataStore metadata, GroupContext externalGroups, List<? extends Expression> symbols) {
     	return addScalarGroup(name, metadata, externalGroups, symbols, true);
     }
     
-	public static GroupSymbol addScalarGroup(String name, TempMetadataStore metadata, GroupContext externalGroups, List<? extends SingleElementSymbol> symbols, boolean updatable) {
+	public static GroupSymbol addScalarGroup(String name, TempMetadataStore metadata, GroupContext externalGroups, List<? extends Expression> symbols, boolean updatable) {
 		boolean[] updateArray = new boolean[symbols.size()];
 		if (updatable) {
 			Arrays.fill(updateArray, true);
@@ -218,7 +218,7 @@
 		return addScalarGroup(name, metadata, externalGroups, symbols, updateArray);
 	}
 	
-	public static GroupSymbol addScalarGroup(String name, TempMetadataStore metadata, GroupContext externalGroups, List<? extends SingleElementSymbol> symbols, boolean[] updatable) {
+	public static GroupSymbol addScalarGroup(String name, TempMetadataStore metadata, GroupContext externalGroups, List<? extends Expression> symbols, boolean[] updatable) {
 		GroupSymbol variables = new GroupSymbol(name);
 	    externalGroups.addGroup(variables);
 	    TempMetadataID tid = metadata.addTempGroup(name, symbols);
@@ -260,7 +260,7 @@
 			cupc.setVirtualGroup(container);
 
 			if (type == Command.TYPE_STORED_PROCEDURE) {
-				StoredProcedureInfo info = metadata.getStoredProcedureInfoForProcedure(container.getCanonicalName());
+				StoredProcedureInfo info = metadata.getStoredProcedureInfoForProcedure(container.getName());
 		        // Create temporary metadata that defines a group based on either the stored proc
 		        // name or the stored query name - this will be used later during planning
 		        String procName = info.getProcedureCallableName();
@@ -281,7 +281,7 @@
 			}
 		}
 		
-	    QueryResolver.setChildMetadata(currentCommand, childMetadata.getData(), externalGroups);
+	    QueryResolver.setChildMetadata(currentCommand, childMetadata, externalGroups);
 	}
 
 }

Modified: trunk/engine/src/main/java/org/teiid/query/resolver/QueryResolver.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/QueryResolver.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/QueryResolver.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -67,7 +67,7 @@
 import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.symbol.GroupSymbol;
 import org.teiid.query.sql.symbol.Reference;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Symbol;
 import org.teiid.query.sql.visitor.ExpressionMappingVisitor;
 import org.teiid.query.sql.visitor.ValueIteratorProviderCollectorVisitor;
 import org.teiid.query.validator.UpdateValidator;
@@ -172,8 +172,8 @@
 		    // Create ElementSymbols for each InputParameter
 		    final List<ElementSymbol> elements = new ArrayList<ElementSymbol>(queryNode.getBindings().size());
 		    boolean positional = true;
-		    for (SingleElementSymbol ses : parseBindings(queryNode)) {
-		    	String name = ses.getName();
+		    for (Expression ses : parseBindings(queryNode)) {
+		    	String name = Symbol.getShortName(ses);
 		    	if (ses instanceof AliasSymbol) {
 		    		ses = ((AliasSymbol)ses).getSymbol();
 		    		positional = false;
@@ -182,7 +182,7 @@
 		    	ResolverVisitor.resolveLanguageObject(elementSymbol, metadata);
 		    	elementSymbol.setIsExternalReference(true);
 		    	if (!positional) {
-		    		symbolMap.put(new ElementSymbol(BINDING_GROUP + ElementSymbol.SEPARATOR + name), elementSymbol.clone());
+		    		symbolMap.put(new ElementSymbol(BINDING_GROUP + Symbol.SEPARATOR + name), elementSymbol.clone());
 		    		elementSymbol.setShortName(name);
 		    	}
 		        elements.add(elementSymbol);
@@ -209,7 +209,7 @@
 		        
 		        ProcedureContainerResolver.addScalarGroup("INPUT", rootExternalStore, externalGroups, elements); //$NON-NLS-1$
 		        ProcedureContainerResolver.addScalarGroup(BINDING_GROUP, rootExternalStore, externalGroups, elements);
-		        QueryResolver.setChildMetadata(currentCommand, rootExternalStore.getData(), externalGroups);
+		        QueryResolver.setChildMetadata(currentCommand, rootExternalStore, externalGroups);
 		    }
 		}
 		TempMetadataStore result = resolveCommand(currentCommand, metadata, false);
@@ -228,16 +228,16 @@
 	 * @return
 	 * @throws TeiidComponentException
 	 */
-    public static List<SingleElementSymbol> parseBindings(QueryNode planNode) throws TeiidComponentException {
+    public static List<Expression> parseBindings(QueryNode planNode) throws TeiidComponentException {
         Collection<String> bindingsCol = planNode.getBindings();
         if (bindingsCol == null) {
             return Collections.emptyList();
         }
         
-        List<SingleElementSymbol> parsedBindings = new ArrayList<SingleElementSymbol>(bindingsCol.size());
+        List<Expression> parsedBindings = new ArrayList<Expression>(bindingsCol.size());
         for (Iterator<String> bindings=bindingsCol.iterator(); bindings.hasNext();) {
             try {
-                SingleElementSymbol binding = QueryParser.getQueryParser().parseSelectExpression(bindings.next());
+                Expression binding = QueryParser.getQueryParser().parseSelectExpression(bindings.next());
                 parsedBindings.add(binding);
             } catch (QueryParserException err) {
                 throw new TeiidComponentException(err);
@@ -253,13 +253,12 @@
         
         TempMetadataAdapter resolverMetadata = null;
         try {
-            Map tempMetadata = currentCommand.getTemporaryMetadata();
-            if(tempMetadata == null) {
-                currentCommand.setTemporaryMetadata(new HashMap());
+        	TempMetadataStore discoveredMetadata = currentCommand.getTemporaryMetadata();
+            if(discoveredMetadata == null) {
+            	discoveredMetadata = new TempMetadataStore();
+                currentCommand.setTemporaryMetadata(discoveredMetadata);
             }
             
-            TempMetadataStore discoveredMetadata = new TempMetadataStore(currentCommand.getTemporaryMetadata());
-            
             resolverMetadata = new TempMetadataAdapter(metadata, discoveredMetadata);
             
             // Resolve external groups for command
@@ -378,18 +377,18 @@
     }
 
     public static void setChildMetadata(Command subCommand, Command parent) {
-        Map childMetadataMap = parent.getTemporaryMetadata();
+    	TempMetadataStore childMetadata = parent.getTemporaryMetadata();
         GroupContext parentContext = parent.getExternalGroupContexts();
         
-        setChildMetadata(subCommand, childMetadataMap, parentContext);
+        setChildMetadata(subCommand, childMetadata, parentContext);
     }
     
-    public static void setChildMetadata(Command subCommand, Map parentTempMetadata, GroupContext parentContext) {
-        Map tempMetadata = subCommand.getTemporaryMetadata();
+    public static void setChildMetadata(Command subCommand, TempMetadataStore parentTempMetadata, GroupContext parentContext) {
+    	TempMetadataStore tempMetadata = subCommand.getTemporaryMetadata();
         if(tempMetadata == null) {
-            subCommand.setTemporaryMetadata(new HashMap(parentTempMetadata));
+            subCommand.setTemporaryMetadata(parentTempMetadata.clone());
         } else {
-            tempMetadata.putAll(parentTempMetadata);
+            tempMetadata.getData().putAll(parentTempMetadata.getData());
         }
     
         subCommand.setExternalGroupContexts(parentContext);
@@ -469,19 +468,19 @@
 			throws QueryMetadataException, TeiidComponentException, QueryValidatorException {
 		//ensure that null types match the view
 		List<ElementSymbol> symbols = ResolverUtil.resolveElementsInGroup(virtualGroup, qmi);
-		List<SingleElementSymbol> projectedSymbols = result.getProjectedSymbols();
+		List<Expression> projectedSymbols = result.getProjectedSymbols();
 		validateProjectedSymbols(virtualGroup, symbols, projectedSymbols);
 	}
 
 	public static void validateProjectedSymbols(GroupSymbol virtualGroup,
 			List<ElementSymbol> symbols,
-			List<SingleElementSymbol> projectedSymbols)
+			List<Expression> projectedSymbols)
 			throws QueryValidatorException {
 		if (symbols.size() != projectedSymbols.size()) {
 			throw new QueryValidatorException(QueryPlugin.Util.getString("QueryResolver.wrong_view_symbols", virtualGroup, symbols.size(), projectedSymbols.size())); //$NON-NLS-1$
 		}
 		for (int i = 0; i < projectedSymbols.size(); i++) {
-			SingleElementSymbol projectedSymbol = projectedSymbols.get(i);
+			Expression projectedSymbol = projectedSymbols.get(i);
 			
 			ResolverUtil.setTypeIfNull(projectedSymbol, symbols.get(i).getType());
 			

Modified: trunk/engine/src/main/java/org/teiid/query/resolver/command/DynamicCommandResolver.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/command/DynamicCommandResolver.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/command/DynamicCommandResolver.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -63,12 +63,12 @@
         if (dynamicCmd.getIntoGroup() == null) {
             while (columns.hasNext()) {
                 ElementSymbol column = (ElementSymbol)columns.next();
-                column.setMetadataID(new TempMetadataID(column.getShortCanonicalName(), column.getType()));
+                column.setMetadataID(new TempMetadataID(column.getShortName(), column.getType()));
             }
         } else if (dynamicCmd.getIntoGroup().isTempGroupSymbol()) {
             while (columns.hasNext()) {
                 ElementSymbol column = (ElementSymbol)columns.next();
-                column.setGroupSymbol(new GroupSymbol(dynamicCmd.getIntoGroup().getCanonicalName()));
+                column.setGroupSymbol(new GroupSymbol(dynamicCmd.getIntoGroup().getName()));
             }
         }
         
@@ -86,7 +86,7 @@
                 ElementSymbol id = clause.getSymbol();
                 id.setGroupSymbol(new GroupSymbol(ProcedureReservedWords.DVARS));
                 id.setType(clause.getValue().getType());
-                id.setMetadataID(new TempMetadataID(id.getCanonicalName(), id.getType()));
+                id.setMetadataID(new TempMetadataID(id.getName(), id.getType()));
             }
         }
         

Modified: trunk/engine/src/main/java/org/teiid/query/resolver/command/ExecResolver.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/command/ExecResolver.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/command/ExecResolver.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -27,6 +27,7 @@
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.TreeMap;
 
 import org.teiid.api.exception.query.QueryMetadataException;
 import org.teiid.api.exception.query.QueryResolverException;
@@ -109,7 +110,8 @@
         // the procedure was parsed with named or unnamed parameters, the keys
         // for this map will either be the String names of the parameters or
         // the Integer indices, as entered in the user query
-        Map<Object, Expression> inputExpressions = new HashMap<Object, Expression>();
+        Map<Integer, Expression> postionalExpressions = new HashMap<Integer, Expression>();
+        Map<String, Expression> namedExpressions = new TreeMap<String, Expression>(String.CASE_INSENSITIVE_ORDER);
         int adjustIndex = 0;
         for (SPParameter param : oldParams) {
             if(param.getExpression() == null) {
@@ -119,16 +121,16 @@
             	continue;
             }
             if (namedParameters && param.getParameterType() != SPParameter.RETURN_VALUE) {
-                if (inputExpressions.put(param.getName().toUpperCase(), param.getExpression()) != null) {
+                if (namedExpressions.put(param.getName(), param.getExpression()) != null) {
                 	throw new QueryResolverException(QueryPlugin.Util.getString("ExecResolver.duplicate_named_params", param.getName().toUpperCase())); //$NON-NLS-1$
                 }
             } else {
-                inputExpressions.put(param.getIndex() + adjustIndex, param.getExpression());
+                postionalExpressions.put(param.getIndex() + adjustIndex, param.getExpression());
             }
         }
 
         storedProcedureCommand.clearParameters();
-        int origInputs = inputExpressions.size();
+        int origInputs = postionalExpressions.size() + namedExpressions.size();
         /*
          * Take the values set from the stored procedure implementation, and match up with the
          * types of parameter it is from the metadata and then reset the newly joined parameters
@@ -159,7 +161,7 @@
         	throw new QueryResolverException(QueryPlugin.Util.getString("ExecResolver.return_expected", storedProcedureCommand.getGroup()));  //$NON-NLS-1$
         }
 
-        if(!namedParameters && (inputParams > inputExpressions.size())) {
+        if(!namedParameters && (inputParams > postionalExpressions.size())) {
             throw new QueryResolverException("ERR.015.008.0007", QueryPlugin.Util.getString("ERR.015.008.0007", inputParams, origInputs, storedProcedureCommand.getGroup())); //$NON-NLS-1$ //$NON-NLS-2$
         }
         
@@ -170,7 +172,7 @@
         if (storedProcedureCommand.isCalledWithReturn() && hasReturnValue) {
 	        for (SPParameter param : clonedMetadataParams) {
 	        	if (param.getParameterType() == SPParameter.RETURN_VALUE) {
-	        		Expression expr = inputExpressions.remove(exprIndex++);
+	        		Expression expr = postionalExpressions.remove(exprIndex++);
 	                param.setExpression(expr);
 	        	}
 	        }
@@ -180,8 +182,8 @@
             	continue;
             }
             if (namedParameters) {
-                String nameKey = param.getParameterSymbol().getShortCanonicalName();
-                Expression expr = inputExpressions.remove(nameKey);
+                String nameKey = param.getParameterSymbol().getShortName();
+                Expression expr = namedExpressions.remove(nameKey);
                 // With named parameters, have to check on optional params and default values
                 if (expr == null && param.getParameterType() != ParameterInfo.OUT) {
                 	expr = ResolverUtil.getDefault(param.getParameterSymbol(), metadata);
@@ -193,16 +195,16 @@
             	if(param.getParameterType() == SPParameter.OUT) {
             		continue;
             	}
-                Expression expr = inputExpressions.remove(exprIndex++);
+                Expression expr = postionalExpressions.remove(exprIndex++);
                 param.setExpression(expr);
             }
         }
         
         // Check for leftovers, i.e. params entered by user w/ wrong/unknown names
-        if (!inputExpressions.isEmpty()) {
-        	if (namedParameters) {
-        		throw new QueryResolverException(QueryPlugin.Util.getString("ExecResolver.invalid_named_params", inputExpressions.keySet(), expected)); //$NON-NLS-1$
-        	}
+        if (!namedExpressions.isEmpty()) {
+    		throw new QueryResolverException(QueryPlugin.Util.getString("ExecResolver.invalid_named_params", namedExpressions.keySet(), expected)); //$NON-NLS-1$
+        }
+        if (!postionalExpressions.isEmpty()) {
         	throw new QueryResolverException("ERR.015.008.0007", QueryPlugin.Util.getString("ERR.015.008.0007", inputParams, origInputs, storedProcedureCommand.getGroup().toString())); //$NON-NLS-1$ //$NON-NLS-2$
         }
         
@@ -286,7 +288,7 @@
     protected String getPlan(QueryMetadataInterface metadata,
                              GroupSymbol group) throws TeiidComponentException,
                                                QueryMetadataException, QueryResolverException {
-        StoredProcedureInfo storedProcedureInfo = metadata.getStoredProcedureInfoForProcedure(group.getCanonicalName());
+        StoredProcedureInfo storedProcedureInfo = metadata.getStoredProcedureInfoForProcedure(group.getName());
         
         //if there is a query plan associated with the procedure, get it.
         QueryNode plan = storedProcedureInfo.getQueryPlan();

Modified: trunk/engine/src/main/java/org/teiid/query/resolver/command/InsertResolver.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/command/InsertResolver.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/command/InsertResolver.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -55,7 +55,7 @@
 import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.symbol.GroupSymbol;
 import org.teiid.query.sql.symbol.Reference;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Symbol;
 
 
 /**
@@ -105,8 +105,8 @@
             } else {
                 for (int i = 0; i < values.size(); i++) {
                 	if (usingQuery) {
-                		SingleElementSymbol ses = (SingleElementSymbol)values.get(i);
-                    	ElementSymbol es = new ElementSymbol(ses.getShortName()); 
+                		Expression ses = (Expression)values.get(i);
+                    	ElementSymbol es = new ElementSymbol(Symbol.getShortName(ses)); 
                     	es.setType(ses.getType());
                     	insert.addVariable(es);
                     } else {

Modified: trunk/engine/src/main/java/org/teiid/query/resolver/command/SetQueryResolver.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/command/SetQueryResolver.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/command/SetQueryResolver.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -23,7 +23,6 @@
 package org.teiid.query.resolver.command;
 
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 
 import org.teiid.api.exception.query.QueryMetadataException;
@@ -41,7 +40,7 @@
 import org.teiid.query.sql.lang.OrderByItem;
 import org.teiid.query.sql.lang.QueryCommand;
 import org.teiid.query.sql.lang.SetQuery;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Expression;
 
 
 public class SetQueryResolver implements CommandResolver {
@@ -61,9 +60,9 @@
         QueryResolver.setChildMetadata(firstCommand, setQuery);
         QueryResolver.resolveCommand(firstCommand, metadata.getMetadata(), false);
 
-        List<SingleElementSymbol> firstProject = firstCommand.getProjectedSymbols();
+        List<Expression> firstProject = firstCommand.getProjectedSymbols();
         List<Class<?>> firstProjectTypes = new ArrayList<Class<?>>();
-        for (SingleElementSymbol symbol : firstProject) {
+        for (Expression symbol : firstProject) {
             firstProjectTypes.add(symbol.getType());
         }
 
@@ -101,7 +100,7 @@
             ResolverUtil.resolveLimit(setQuery.getLimit());
         }
         
-        setQuery.setTemporaryMetadata(new HashMap(firstCommand.getTemporaryMetadata()));
+        setQuery.setTemporaryMetadata(firstCommand.getTemporaryMetadata().clone());
     }
 
     private void setProjectedTypes(SetQuery setQuery,
@@ -114,7 +113,7 @@
             List projectedSymbols = child.getProjectedSymbols();
             if (child.getOrderBy() != null) {
                 for (int j = 0; j < projectedSymbols.size(); j++) {
-                    SingleElementSymbol ses = (SingleElementSymbol)projectedSymbols.get(j);
+                    Expression ses = (Expression)projectedSymbols.get(j);
                     Class<?> targetType = firstProjectTypes.get(j);
                     if (ses.getType() != targetType && orderByContainsVariable(child.getOrderBy(), ses, j)) {
                         String sourceTypeName = DataTypeManager.getDataTypeName(ses.getType());
@@ -134,7 +133,7 @@
      * @param position 0-based index of the variable
      * @return True if the ORDER BY contains the element
      */
-    public static boolean orderByContainsVariable(OrderBy orderBy, SingleElementSymbol ses, int position) {
+    public static boolean orderByContainsVariable(OrderBy orderBy, Expression ses, int position) {
     	for (OrderByItem item : orderBy.getOrderByItems()) {
 			if (item.getExpressionPosition() == position) {
 				return true;
@@ -146,7 +145,7 @@
 	static void checkSymbolTypes(List firstProjectTypes, List projSymbols) {
         for(int j=0; j<projSymbols.size(); j++){
             Class firstProjType = (Class)firstProjectTypes.get(j);
-    		SingleElementSymbol projSymbol = (SingleElementSymbol)projSymbols.get(j);
+    		Expression projSymbol = (Expression)projSymbols.get(j);
             Class projType = projSymbol.getType();
             
             if(firstProjType.equals(projType)){

Modified: trunk/engine/src/main/java/org/teiid/query/resolver/command/SimpleQueryResolver.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/command/SimpleQueryResolver.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/command/SimpleQueryResolver.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -22,16 +22,7 @@
 
 package org.teiid.query.resolver.command;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
 
 import org.teiid.api.exception.query.QueryMetadataException;
 import org.teiid.api.exception.query.QueryResolverException;
@@ -52,28 +43,7 @@
 import org.teiid.query.resolver.util.ResolverUtil;
 import org.teiid.query.resolver.util.ResolverVisitor;
 import org.teiid.query.sql.LanguageObject;
-import org.teiid.query.sql.lang.ArrayTable;
-import org.teiid.query.sql.lang.Command;
-import org.teiid.query.sql.lang.ExistsCriteria;
-import org.teiid.query.sql.lang.From;
-import org.teiid.query.sql.lang.FromClause;
-import org.teiid.query.sql.lang.Into;
-import org.teiid.query.sql.lang.JoinPredicate;
-import org.teiid.query.sql.lang.JoinType;
-import org.teiid.query.sql.lang.Query;
-import org.teiid.query.sql.lang.QueryCommand;
-import org.teiid.query.sql.lang.SPParameter;
-import org.teiid.query.sql.lang.Select;
-import org.teiid.query.sql.lang.StoredProcedure;
-import org.teiid.query.sql.lang.SubqueryCompareCriteria;
-import org.teiid.query.sql.lang.SubqueryContainer;
-import org.teiid.query.sql.lang.SubqueryFromClause;
-import org.teiid.query.sql.lang.SubquerySetCriteria;
-import org.teiid.query.sql.lang.TableFunctionReference;
-import org.teiid.query.sql.lang.TextTable;
-import org.teiid.query.sql.lang.UnaryFromClause;
-import org.teiid.query.sql.lang.WithQueryCommand;
-import org.teiid.query.sql.lang.XMLTable;
+import org.teiid.query.sql.lang.*;
 import org.teiid.query.sql.navigator.PostOrderNavigator;
 import org.teiid.query.sql.symbol.AliasSymbol;
 import org.teiid.query.sql.symbol.ElementSymbol;
@@ -83,7 +53,7 @@
 import org.teiid.query.sql.symbol.MultipleElementSymbol;
 import org.teiid.query.sql.symbol.Reference;
 import org.teiid.query.sql.symbol.ScalarSubquery;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Symbol;
 import org.teiid.query.sql.visitor.ElementCollectorVisitor;
 
 public class SimpleQueryResolver implements CommandResolver {
@@ -124,7 +94,7 @@
         	ResolverUtil.resolveOrderBy(query.getOrderBy(), query, metadata);
         }
         
-        List<SingleElementSymbol> symbols = query.getSelect().getProjectedSymbols();
+        List<Expression> symbols = query.getSelect().getProjectedSymbols();
         
         if (query.getInto() != null) {
             GroupSymbol symbol = query.getInto().getGroup();
@@ -150,13 +120,13 @@
             if (!discoveredGroups.add(obj.getGroupSymbol())) {
             	throw new QueryResolverException(QueryPlugin.Util.getString("SimpleQueryResolver.duplicate_with", obj.getGroupSymbol())); //$NON-NLS-1$
             }
-            List<? extends SingleElementSymbol> projectedSymbols = obj.getCommand().getProjectedSymbols();
+            List<? extends Expression> projectedSymbols = obj.getCommand().getProjectedSymbols();
             if (obj.getColumns() != null && !obj.getColumns().isEmpty()) {
             	if (obj.getColumns().size() != projectedSymbols.size()) {
             		throw new QueryResolverException(QueryPlugin.Util.getString("SimpleQueryResolver.mismatched_with_columns", obj.getGroupSymbol())); //$NON-NLS-1$
             	}
             	Iterator<ElementSymbol> iter = obj.getColumns().iterator();
-            	for (SingleElementSymbol singleElementSymbol : projectedSymbols) {
+            	for (Expression singleElementSymbol : projectedSymbols) {
             		ElementSymbol es = iter.next();
             		es.setType(singleElementSymbol.getType());
 				}
@@ -167,7 +137,7 @@
             obj.getGroupSymbol().setIsTempTable(true);
             List<GroupSymbol> groups = Collections.singletonList(obj.getGroupSymbol());
             if (obj.getColumns() != null && !obj.getColumns().isEmpty()) {
-	            for (SingleElementSymbol singleElementSymbol : projectedSymbols) {
+	            for (Expression singleElementSymbol : projectedSymbols) {
 	                ResolverVisitor.resolveLanguageObject(singleElementSymbol, groups, metadata);
 				}
             }
@@ -183,7 +153,7 @@
 	}
 
     private static GroupSymbol resolveAllInGroup(MultipleElementSymbol allInGroupSymbol, Set<GroupSymbol> groups, QueryMetadataInterface metadata) throws QueryResolverException, QueryMetadataException, TeiidComponentException {       
-        String groupAlias = allInGroupSymbol.getGroup().getCanonicalName();
+        String groupAlias = allInGroupSymbol.getGroup().getName();
         List<GroupSymbol> groupSymbols = ResolverUtil.findMatchingGroups(groupAlias, groups, metadata);
         if(groupSymbols.isEmpty() || groupSymbols.size() > 1) {
             String msg = QueryPlugin.Util.getString(groupSymbols.isEmpty()?"ERR.015.008.0047":"SimpleQueryResolver.ambiguous_all_in_group", allInGroupSymbol);  //$NON-NLS-1$ //$NON-NLS-2$
@@ -483,21 +453,21 @@
 			            aliasName += "_IN"; //$NON-NLS-1$
 			        }
 			        
-			        SingleElementSymbol newSymbol = new AliasSymbol(aliasName, new ExpressionSymbol(paramSymbol.getShortName(), ref));
+			        Expression newSymbol = new AliasSymbol(aliasName, new ExpressionSymbol(paramSymbol.getShortName(), ref));
 			        
 			        select.addSymbol(newSymbol);
-			        accessPatternElementNames.add(queryName + ElementSymbol.SEPARATOR + aliasName);
+			        accessPatternElementNames.add(queryName + Symbol.SEPARATOR + aliasName);
 			    }
 			}
 			
 			QueryResolver.resolveCommand(procQuery, metadata.getMetadata());
 			
-			List<SingleElementSymbol> projectedSymbols = procQuery.getProjectedSymbols();
+			List<Expression> projectedSymbols = procQuery.getProjectedSymbols();
 			
-			HashSet<String> foundNames = new HashSet<String>();
+			Set<String> foundNames = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
 			
-			for (SingleElementSymbol ses : projectedSymbols) {
-			    if (!foundNames.add(ses.getShortCanonicalName())) {
+			for (Expression ses : projectedSymbols) {
+			    if (!foundNames.add(Symbol.getShortName(ses))) {
 			        throw new QueryResolverException(QueryPlugin.Util.getString("SimpleQueryResolver.Proc_Relational_Name_conflict", fullName)); //$NON-NLS-1$                            
 			    }
 			}

Modified: trunk/engine/src/main/java/org/teiid/query/resolver/command/TempTableResolver.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/command/TempTableResolver.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/command/TempTableResolver.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -43,6 +43,7 @@
 import org.teiid.query.sql.lang.Drop;
 import org.teiid.query.sql.symbol.ElementSymbol;
 import org.teiid.query.sql.symbol.GroupSymbol;
+import org.teiid.query.sql.symbol.Symbol;
 
 
 
@@ -62,7 +63,7 @@
             GroupSymbol group = create.getTable();
             
             //assuming that all temp table creates are local, the user must use a local name
-            if (group.getName().indexOf(ElementSymbol.SEPARATOR) != -1) {
+            if (group.getName().indexOf(Symbol.SEPARATOR) != -1) {
                 throw new QueryResolverException(QueryPlugin.Util.getString("TempTableResolver.unqualified_name_required", group.getName())); //$NON-NLS-1$
             }
 

Modified: trunk/engine/src/main/java/org/teiid/query/resolver/command/UpdateProcedureResolver.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/command/UpdateProcedureResolver.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/command/UpdateProcedureResolver.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -24,7 +24,6 @@
 
 import java.util.Arrays;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
 
@@ -57,7 +56,7 @@
 import org.teiid.query.sql.symbol.ElementSymbol;
 import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Symbol;
 import org.teiid.query.sql.visitor.ValueIteratorProviderCollectorVisitor;
 
 
@@ -84,7 +83,7 @@
         
         List<ElementSymbol> symbols = new LinkedList<ElementSymbol>();
         
-        String countVar = ProcedureReservedWords.VARIABLES + ElementSymbol.SEPARATOR + ProcedureReservedWords.ROWCOUNT;
+        String countVar = ProcedureReservedWords.VARIABLES + Symbol.SEPARATOR + ProcedureReservedWords.ROWCOUNT;
         ElementSymbol updateCount = new ElementSymbol(countVar);
         updateCount.setType(DataTypeManager.DefaultDataClasses.INTEGER);
         symbols.add(updateCount);
@@ -99,12 +98,12 @@
         LogManager.logTrace(org.teiid.logging.LogConstants.CTX_QUERY_RESOLVER, new Object[]{"Resolving block", block}); //$NON-NLS-1$
         
         //create a new variable and metadata context for this block so that discovered metadata is not visible else where
-        TempMetadataStore store = new TempMetadataStore(new HashMap(metadata.getMetadataStore().getData()));
+        TempMetadataStore store = metadata.getMetadataStore().clone();
         metadata = new TempMetadataAdapter(metadata.getMetadata(), store);
         externalGroups = new GroupContext(externalGroups, null);
         
         //create a new variables group for this block
-        GroupSymbol variables = ProcedureContainerResolver.addScalarGroup(ProcedureReservedWords.VARIABLES, store, externalGroups, new LinkedList<SingleElementSymbol>());
+        GroupSymbol variables = ProcedureContainerResolver.addScalarGroup(ProcedureReservedWords.VARIABLES, store, externalGroups, new LinkedList<Expression>());
         
         for (Statement statement : block.getStatements()) {
             resolveStatement(command, statement, externalGroups, variables, metadata);
@@ -245,10 +244,10 @@
 	        	}
                 Command cmd = loopStmt.getCommand();
                 resolveEmbeddedCommand(metadata, externalGroups, cmd);
-                List<SingleElementSymbol> symbols = cmd.getProjectedSymbols();
+                List<Expression> symbols = cmd.getProjectedSymbols();
                 
                 //add the loop cursor group into its own context
-                TempMetadataStore store = new TempMetadataStore(new HashMap(metadata.getMetadataStore().getData()));
+                TempMetadataStore store = metadata.getMetadataStore().clone();
                 metadata = new TempMetadataAdapter(metadata.getMetadata(), store);
                 externalGroups = new GroupContext(externalGroups, null);
                 
@@ -272,7 +271,7 @@
     private TempMetadataStore resolveEmbeddedCommand(TempMetadataAdapter metadata, GroupContext groupContext,
                                 Command cmd) throws TeiidComponentException,
                                             QueryResolverException {
-        QueryResolver.setChildMetadata(cmd, metadata.getMetadataStore().getData(), groupContext);
+        QueryResolver.setChildMetadata(cmd, metadata.getMetadataStore(), groupContext);
         
         return QueryResolver.resolveCommand(cmd, metadata.getMetadata());
     }
@@ -286,7 +285,7 @@
             variable.setGroupSymbol(new GroupSymbol(ProcedureReservedWords.VARIABLES));
             variable.setOutputName(outputName);
         } else {
-        	if (gs.getSchema() != null || !gs.getShortCanonicalName().equals(ProcedureReservedWords.VARIABLES)) {
+        	if (gs.getSchema() != null || !gs.getShortName().equalsIgnoreCase(ProcedureReservedWords.VARIABLES)) {
                 handleUnresolvableDeclaration(variable, QueryPlugin.Util.getString("ERR.015.010.0031", new Object[]{ProcedureReservedWords.VARIABLES, variable})); //$NON-NLS-1$
             }
         }

Modified: trunk/engine/src/main/java/org/teiid/query/resolver/command/XMLQueryResolver.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/command/XMLQueryResolver.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/command/XMLQueryResolver.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -59,10 +59,11 @@
 import org.teiid.query.sql.lang.SubqueryContainer;
 import org.teiid.query.sql.symbol.AliasSymbol;
 import org.teiid.query.sql.symbol.ElementSymbol;
+import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.symbol.ExpressionSymbol;
 import org.teiid.query.sql.symbol.GroupSymbol;
 import org.teiid.query.sql.symbol.MultipleElementSymbol;
-import org.teiid.query.sql.symbol.SelectSymbol;
+import org.teiid.query.sql.symbol.Symbol;
 import org.teiid.query.sql.visitor.ElementCollectorVisitor;
 import org.teiid.query.sql.visitor.GroupCollectorVisitor;
 import org.teiid.query.sql.visitor.ValueIteratorProviderCollectorVisitor;
@@ -282,7 +283,7 @@
 		 */
 		MappingDocument doc = (MappingDocument) metadata.getMappingNode(docGroup.getMetadataID());
 		
-		final String prefix = group.getNonCorrelationName() + ElementSymbol.SEPARATOR;
+		final String prefix = group.getNonCorrelationName() + Symbol.SEPARATOR;
 
         doc.acceptVisitor(new Navigator(true, new MappingVisitor() {
         	@Override
@@ -323,7 +324,7 @@
 
 		List elements = select.getSymbols();
 		for (int i = 0; i < elements.size(); i++) {
-			SelectSymbol ss = (SelectSymbol) elements.get(i);
+			Expression ss = (Expression) elements.get(i);
 
 			if (ss instanceof ElementSymbol) {
 				// Here we make an assumption that: all elements named with "xml" must use qualified name
@@ -502,7 +503,6 @@
         String name = elem.getOutputName();
         // Resolve based on exact match
         elem.setShortName(exactMatch.getShortName());
-        elem.setShortCanonicalName(exactMatch.getShortCanonicalName());
         elem.setMetadataID(exactMatch.getMetadataID());
         elem.setType(exactMatch.getType());
         elem.setGroupSymbol(exactMatch.getGroupSymbol());

Modified: trunk/engine/src/main/java/org/teiid/query/resolver/util/ResolverUtil.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/util/ResolverUtil.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/util/ResolverUtil.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -303,7 +303,7 @@
     public static void resolveOrderBy(OrderBy orderBy, QueryCommand command, QueryMetadataInterface metadata)
         throws QueryResolverException, QueryMetadataException, TeiidComponentException {
 
-    	List<SingleElementSymbol> knownElements = command.getProjectedQuery().getSelect().getProjectedSymbols();
+    	List<Expression> knownElements = command.getProjectedQuery().getSelect().getProjectedSymbols();
     	
     	boolean isSimpleQuery = false;
     	List<GroupSymbol> fromClauseGroups = Collections.emptyList();
@@ -321,19 +321,17 @@
         List<Expression> expressions = new ArrayList<Expression>(knownElements.size());
 
         for(int i=0; i<knownElements.size(); i++) {
-            SingleElementSymbol knownSymbol = knownElements.get(i);
+            Expression knownSymbol = knownElements.get(i);
             expressions.add(SymbolMap.getExpression(knownSymbol));
-            if (knownSymbol instanceof ExpressionSymbol) {
-                continue;
+            if (knownSymbol instanceof ElementSymbol || knownSymbol instanceof AliasSymbol) {
+                String name = ((Symbol)knownSymbol).getShortName();
+                
+                knownShortNames[i] = name;
             }
-            
-            String name = knownSymbol.getShortName();
-            
-            knownShortNames[i] = name;
         }
 
         for (int i = 0; i < orderBy.getVariableCount(); i++) {
-        	SingleElementSymbol sortKey = orderBy.getVariable(i);
+        	Expression sortKey = orderBy.getVariable(i);
         	if (sortKey instanceof ElementSymbol) {
         		ElementSymbol symbol = (ElementSymbol)sortKey;
         		String groupPart = null;
@@ -344,7 +342,7 @@
         		String shortName = symbol.getShortName();
         		if (groupPart == null) {
         			int position = -1;
-    				SingleElementSymbol matchedSymbol = null;
+    				Expression matchedSymbol = null;
     				// walk the SELECT col short names, looking for a match on the current ORDER BY 'short name'
     				for(int j=0; j<knownShortNames.length; j++) {
     					if( !shortName.equalsIgnoreCase( knownShortNames[j] )) {
@@ -370,19 +368,16 @@
                         continue;
                     }
         		}
-        	} else if (sortKey instanceof ExpressionSymbol) {
+        	} else if (sortKey instanceof Constant) {
         		// check for legacy positional
-    			ExpressionSymbol es = (ExpressionSymbol)sortKey;
-        		if (es.getExpression() instanceof Constant) {
-            		Constant c = (Constant)es.getExpression();
-        		    int elementOrder = Integer.valueOf(c.getValue().toString()).intValue();
-        		    // adjust for the 1 based index.
-        		    if (elementOrder > knownElements.size() || elementOrder < 1) {
-            		    throw new QueryResolverException(QueryPlugin.Util.getString("SQLParser.non_position_constant", c)); //$NON-NLS-1$
-        		    }
-        		    orderBy.setExpressionPosition(i, elementOrder - 1);
-        		    continue;
-        		}
+        		Constant c = (Constant)sortKey;
+    		    int elementOrder = Integer.valueOf(c.getValue().toString()).intValue();
+    		    // adjust for the 1 based index.
+    		    if (elementOrder > knownElements.size() || elementOrder < 1) {
+        		    throw new QueryResolverException(QueryPlugin.Util.getString("SQLParser.non_position_constant", c)); //$NON-NLS-1$
+    		    }
+    		    orderBy.setExpressionPosition(i, elementOrder - 1);
+    		    continue;
         	}
         	//handle order by expressions        	
         	if (command instanceof SetQuery) {
@@ -469,7 +464,7 @@
 	static GroupInfo getGroupInfo(GroupSymbol group,
 			QueryMetadataInterface metadata)
 			throws TeiidComponentException, QueryMetadataException {
-		String key = GroupInfo.CACHE_PREFIX + group.getCanonicalName();
+		String key = GroupInfo.CACHE_PREFIX + group.getName();
 		GroupInfo groupInfo = (GroupInfo)metadata.getFromMetadataCache(group.getMetadataID(), key);
     	
         if (groupInfo == null) {
@@ -482,7 +477,7 @@
             for (Object elementID : elementIDs) {
             	String elementName = metadata.getName(elementID);
                 // Form an element symbol from the ID
-                ElementSymbol element = new ElementSymbol(elementName, DataTypeManager.getCanonicalString(StringUtil.toUpperCase(elementName)), group);
+                ElementSymbol element = new ElementSymbol(elementName, group);
                 element.setMetadataID(elementID);
                 element.setType( DataTypeManager.getDataTypeClass(metadata.getElementType(element.getMetadataID())) );
 
@@ -552,7 +547,7 @@
         throws TeiidComponentException, QueryResolverException {
         
         if (symbol.isImplicitTempGroupSymbol()) {
-            if (metadata.getMetadataStore().getTempElementElementIDs(symbol.getCanonicalName())==null) {
+            if (metadata.getMetadataStore().getTempElementElementIDs(symbol.getName())==null) {
                 addTempGroup(metadata, symbol, symbols, true);
             }
             ResolverUtil.resolveGroup(symbol, metadata);
@@ -561,11 +556,11 @@
 
     public static TempMetadataID addTempGroup(TempMetadataAdapter metadata,
                                     GroupSymbol symbol,
-                                    List<? extends SingleElementSymbol> symbols, boolean tempTable) throws QueryResolverException {
-        HashSet<String> names = new HashSet<String>();
-        for (SingleElementSymbol ses : symbols) {
-            if (!names.add(ses.getShortCanonicalName())) {
-                throw new QueryResolverException(QueryPlugin.Util.getString("ResolverUtil.duplicateName", symbol, ses.getShortName())); //$NON-NLS-1$
+                                    List<? extends Expression> symbols, boolean tempTable) throws QueryResolverException {
+        Set<String> names = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
+        for (Expression ses : symbols) {
+            if (!names.add(Symbol.getShortName(ses))) {
+                throw new QueryResolverException(QueryPlugin.Util.getString("ResolverUtil.duplicateName", symbol, Symbol.getShortName(ses))); //$NON-NLS-1$
             }
         }
         
@@ -578,7 +573,7 @@
     
     public static TempMetadataID addTempTable(TempMetadataAdapter metadata,
                                      GroupSymbol symbol,
-                                     List<? extends SingleElementSymbol> symbols) throws QueryResolverException {
+                                     List<? extends Expression> symbols) throws QueryResolverException {
         return addTempGroup(metadata, symbol, symbols, true);
     }
 
@@ -592,47 +587,34 @@
      */
     public static void resolveNullLiterals(List symbols) {
         for (int i = 0; i < symbols.size(); i++) {
-            SelectSymbol selectSymbol = (SelectSymbol) symbols.get(i);
+            Expression selectSymbol = (Expression) symbols.get(i);
             
-            if (!(selectSymbol instanceof SingleElementSymbol)) {
-                continue;
-            }
-            
-            SingleElementSymbol symbol = (SingleElementSymbol)selectSymbol;
-            
-            setTypeIfNull(symbol, DataTypeManager.DefaultDataClasses.STRING);
+            setTypeIfNull(selectSymbol, DataTypeManager.DefaultDataClasses.STRING);
         }
     }
 
-	public static void setTypeIfNull(SingleElementSymbol symbol,
+	public static void setTypeIfNull(Expression symbol,
 			Class<?> replacement) {
 		if(!DataTypeManager.DefaultDataClasses.NULL.equals(symbol.getType()) && symbol.getType() != null) {
             return;
         }
-		if(symbol instanceof AliasSymbol) {
-            symbol = ((AliasSymbol)symbol).getSymbol();
-        }
-		if(symbol instanceof ExpressionSymbol && !(symbol instanceof AggregateSymbol)) {
-		    ExpressionSymbol exprSymbol = (ExpressionSymbol) symbol;
-		    Expression expr = exprSymbol.getExpression();
-		   	
-		    if(expr instanceof Constant) {                	
-		        exprSymbol.setExpression(new Constant(null, replacement));
-		    } else if (expr instanceof AbstractCaseExpression) {
-		        ((AbstractCaseExpression)expr).setType(replacement);
-		    } else if (expr instanceof ScalarSubquery) {
-		        ((ScalarSubquery)expr).setType(replacement);                                        
-		    } else {
-		    	try {
-					ResolverUtil.setDesiredType(expr, replacement, symbol);
-				} catch (QueryResolverException e) {
-					//cannot happen
-				}
-		    }
-		} else if(symbol instanceof ElementSymbol) {
+		symbol = SymbolMap.getExpression(symbol);
+	    if(symbol instanceof Constant) {                	
+	    	((Constant)symbol).setType(replacement);
+	    } else if (symbol instanceof AbstractCaseExpression) {
+	        ((AbstractCaseExpression)symbol).setType(replacement);
+	    } else if (symbol instanceof ScalarSubquery) {
+	        ((ScalarSubquery)symbol).setType(replacement);                                        
+	    } else if(symbol instanceof ElementSymbol) {
 		    ElementSymbol elementSymbol = (ElementSymbol)symbol;
 	        elementSymbol.setType(replacement);
-		}
+		} else {
+	    	try {
+				ResolverUtil.setDesiredType(symbol, replacement, symbol);
+			} catch (QueryResolverException e) {
+				//cannot happen
+			}
+		}  
 	}
     
     /**
@@ -659,7 +641,7 @@
             matchedGroups.addAll(groups);
         } else {
         	for (GroupSymbol group : groups) {
-                String fullName = group.getCanonicalName();
+                String fullName = group.getName();
                 if (nameMatchesGroup(groupContext, matchedGroups, group, fullName)) {
                     if (groupContext.length() == fullName.length()) {
                         return matchedGroups;
@@ -675,7 +657,7 @@
                 String actualVdbName = metadata.getVirtualDatabaseName();
 
                 if (actualVdbName != null) {
-                    fullName = actualVdbName.toUpperCase() + ElementSymbol.SEPARATOR + fullName;
+                    fullName = actualVdbName + Symbol.SEPARATOR + fullName;
                     if (nameMatchesGroup(groupContext, matchedGroups, group, fullName)
                         && groupContext.length() == fullName.length()) {
                         return matchedGroups;
@@ -691,7 +673,7 @@
     public static boolean nameMatchesGroup(String groupContext,
                                             String fullName) {
         //if there is a name match, make sure that it is the full name or a proper qualifier
-        if (fullName.endsWith(groupContext)) {
+        if (StringUtil.endsWithIgnoreCase(fullName, groupContext)) {
             int matchIndex = fullName.length() - groupContext.length();
             if (matchIndex == 0 || fullName.charAt(matchIndex - 1) == '.') {
                 return true;
@@ -735,7 +717,7 @@
 		}
 		String exprTypeName = DataTypeManager.getDataTypeName(exprType);
 	
-		Collection<SingleElementSymbol> projectedSymbols = crit.getCommand().getProjectedSymbols();
+		Collection<Expression> projectedSymbols = crit.getCommand().getProjectedSymbols();
 		if (projectedSymbols.size() != 1){
 	        throw new QueryResolverException("ERR.015.008.0032", QueryPlugin.Util.getString("ERR.015.008.0032", crit.getCommand())); //$NON-NLS-1$ //$NON-NLS-2$
 		}
@@ -821,7 +803,6 @@
 	    } 
 	
 	    // If that didn't work, try to strip a vdb name from potentialID
-	    String vdbName = null;
 	    if(groupID == null) {
 	    	String[] parts = potentialID.split("\\.", 2); //$NON-NLS-1$
 	    	if (parts.length > 1 && parts[0].equalsIgnoreCase(metadata.getVirtualDatabaseName())) {
@@ -832,7 +813,6 @@
 	            } 
 	            if(groupID != null) {
 	            	potentialID = parts[1];
-	            	vdbName = parts[0];
 	            }
 	        }
 	    }
@@ -854,12 +834,6 @@
 			        try {
 			            // get valid GroupID for possibleID - this may throw exceptions if group is invalid
 			            groupID = metadata.getGroupID(potentialID);
-			            //set group full name
-			            if(symbol.getDefinition() != null){
-			            	symbol.setDefinition(potentialID);
-			            }else{
-			            	symbol.setName(potentialID);
-			            }
 			        } catch(QueryMetadataException e) {
 			            // didn't find this group ID
 			        } 
@@ -885,14 +859,12 @@
 	    }
 	    // set real metadata ID in the symbol
 	    symbol.setMetadataID(groupID);
-	    if(vdbName != null) {
-	        // reset name or definition to strip vdb name
-	        if(symbol.getDefinition() == null) {
-	            symbol.setName(potentialID);
-	        } else {
-	            symbol.setDefinition(potentialID);
-	        }
-	    }
+	    potentialID = metadata.getFullName(groupID);
+        if(symbol.getDefinition() == null) {
+            symbol.setName(potentialID);
+        } else {
+            symbol.setDefinition(potentialID);
+        }
 	    try {
 	        if (!symbol.isProcedure()) {
 	            symbol.setIsTempTable(metadata.isTemporaryTable(groupID));

Modified: trunk/engine/src/main/java/org/teiid/query/resolver/util/ResolverVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/util/ResolverVisitor.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/util/ResolverVisitor.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -134,9 +134,9 @@
         if (elementSymbol.getGroupSymbol() != null) {
         	groupContext = elementSymbol.getGroupSymbol().getName();
         }
-        String elementShortName = elementSymbol.getShortCanonicalName();
+        String elementShortName = elementSymbol.getShortName();
         if (groupContext != null) {
-            groupContext = elementSymbol.getGroupSymbol().getCanonicalName();
+            groupContext = elementSymbol.getGroupSymbol().getName();
         	try {
 				if (findShortName && internalResolveElementSymbol(elementSymbol, null, elementShortName, groupContext)) {
 		    		elementSymbol.setDisplayMode(DisplayMode.SHORT_OUTPUT_NAME);
@@ -220,7 +220,7 @@
         ElementSymbol resolvedSymbol = match.element;
         GroupSymbol resolvedGroup = match.group;
         String oldName = elementSymbol.getOutputName();
-        if (expectedGroupContext != null && !ResolverUtil.nameMatchesGroup(expectedGroupContext, resolvedGroup.getCanonicalName())) {
+        if (expectedGroupContext != null && !ResolverUtil.nameMatchesGroup(expectedGroupContext, resolvedGroup.getName())) {
         	return false;
         }
         elementSymbol.setIsExternalReference(isExternal);
@@ -228,7 +228,6 @@
         elementSymbol.setMetadataID(resolvedSymbol.getMetadataID());
         elementSymbol.setGroupSymbol(resolvedGroup);
         elementSymbol.setShortName(resolvedSymbol.getShortName());
-        elementSymbol.setShortCanonicalName(resolvedSymbol.getShortCanonicalName());
         elementSymbol.setOutputName(oldName);
         return true;
 	}
@@ -728,10 +727,10 @@
 	
 	    String exprTypeName = DataTypeManager.getDataTypeName(exprType);
 	    boolean changed = false;
-	    List newVals = new ArrayList();
+	    List<Expression> newVals = new ArrayList<Expression>();
 	
 	    boolean convertLeft = false;
-	    Class setType = null;
+	    Class<?> setType = null;
 	
 	    Iterator valIter = scrit.getValues().iterator();
 	    while(valIter.hasNext()) {
@@ -791,8 +790,8 @@
 	    final int whenCount = obj.getWhenCount();
 	    Expression expr = obj.getExpression();
 	
-	    Class whenType = null;
-	    Class thenType = null;
+	    Class<?> whenType = null;
+	    Class<?> thenType = null;
 	    // Get the WHEN and THEN types, and get a candidate type for each (for the next step)
 	    for (int i = 0; i < whenCount; i++) {
 	        if (whenType == null) {
@@ -897,7 +896,7 @@
 	    final int whenCount = obj.getWhenCount();
 	    // 1. Call recursively to resolve any contained CASE expressions
 	
-	    Class thenType = null;
+	    Class<?> thenType = null;
 	    // Get the WHEN and THEN types, and get a candidate type for each (for the next step)
 	    for (int i = 0; i < whenCount; i++) {
 	        if (thenType == null) {

Modified: trunk/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -158,9 +158,9 @@
 		boolean oldRewriteAggs = rewriteAggs;
 		QueryMetadataInterface oldMetadata = metadata;
         
-		Map tempMetadata = command.getTemporaryMetadata();
+		TempMetadataStore tempMetadata = command.getTemporaryMetadata();
         if(tempMetadata != null) {
-        	metadata = new TempMetadataAdapter(metadata, new TempMetadataStore(tempMetadata));
+        	metadata = new TempMetadataAdapter(metadata, tempMetadata);
         }
         
         switch(command.getType()) {
@@ -421,7 +421,7 @@
 		List<GroupSymbol> groups = query.getFrom().getGroups();
 		HashSet<String> names = new HashSet<String>();
 		for (GroupSymbol gs : groups) {
-			names.add(gs.getCanonicalName());
+			names.add(gs.getName());
 		}
 		for (Iterator<Criteria> crits = current.iterator(); crits.hasNext();) {
 			PlannedResult plannedResult = rmc.findSubquery(crits.next());
@@ -449,13 +449,13 @@
 			crits.remove();
 			
 			GroupSymbol viewName = RulePlaceAccess.recontextSymbol(new GroupSymbol("X"), names); //$NON-NLS-1$
-			viewName.setName(viewName.getCanonicalName());
+			viewName.setName(viewName.getName());
 			viewName.setDefinition(null);
 			Query q = createInlineViewQuery(viewName, plannedResult.query, metadata, plannedResult.query.getSelect().getProjectedSymbols());
 			
-			Iterator<SingleElementSymbol> iter = q.getSelect().getProjectedSymbols().iterator();
+			Iterator<Expression> iter = q.getSelect().getProjectedSymbols().iterator();
 		    HashMap<Expression, Expression> expressionMap = new HashMap<Expression, Expression>();
-		    for (SingleElementSymbol symbol : plannedResult.query.getSelect().getProjectedSymbols()) {
+		    for (Expression symbol : plannedResult.query.getSelect().getProjectedSymbols()) {
 		        expressionMap.put(SymbolMap.getExpression(symbol), SymbolMap.getExpression(iter.next()));
 		    }
 			for (int i = 0; i < plannedResult.leftExpressions.size(); i++) {
@@ -469,7 +469,7 @@
 				clause.setMakeInd(true);
 			}
 		    query.getFrom().addClause(clause);
-		    query.getTemporaryMetadata().putAll(q.getTemporaryMetadata());
+		    query.getTemporaryMetadata().getData().putAll(q.getTemporaryMetadata().getData());
 			//transform the query into an inner join 
 		}
 		query.setCriteria(Criteria.combineCriteria(query.getCriteria(), Criteria.combineCriteria(current)));
@@ -484,7 +484,7 @@
 				return false;
 			}
 		} else if (query.getSelect().isDistinct()) {
-			for (SingleElementSymbol projectSymbol : query.getSelect().getProjectedSymbols()) {
+			for (Expression projectSymbol : query.getSelect().getProjectedSymbols()) {
 				Expression ex = SymbolMap.getExpression(projectSymbol);
 	            if (FunctionCollectorVisitor.isNonDeterministic(ex)) {
 	            	return true;
@@ -516,7 +516,7 @@
 			return false;
 		}
 		HashSet<Expression> selectExpressions = new HashSet<Expression>();
-		for (SingleElementSymbol selectExpr : query.getSelect().getProjectedSymbols()) {
+		for (Expression selectExpr : query.getSelect().getProjectedSymbols()) {
 			selectExpressions.add(SymbolMap.getExpression(selectExpr));
 		}
 		for (Expression groupByExpr : groupBy.getSymbols()) {
@@ -570,7 +570,7 @@
             return queryCommand;
         }
         Select select = queryCommand.getProjectedQuery().getSelect();
-        final List<SingleElementSymbol> projectedSymbols = select.getProjectedSymbols();
+        final List<Expression> projectedSymbols = select.getProjectedSymbols();
         
         LinkedList<OrderByItem> unrelatedItems = new LinkedList<OrderByItem>();
         
@@ -584,20 +584,20 @@
 			LinkedList<OrderByItem> unrelatedItems) {
 		HashSet<Expression> previousExpressions = new HashSet<Expression>();
         for (int i = 0; i < orderBy.getVariableCount(); i++) {
-        	SingleElementSymbol querySymbol = orderBy.getVariable(i);
+        	Expression querySymbol = orderBy.getVariable(i);
         	int index = orderBy.getExpressionPosition(i);
     		boolean isUnrelated = false;
         	if (index == -1) {
     			unrelatedItems.add(orderBy.getOrderByItems().get(i));
     			isUnrelated = (querySymbol instanceof ExpressionSymbol);
         	} else {
-        		querySymbol = (SingleElementSymbol)projectedSymbols.get(index);
+        		querySymbol = (Expression)projectedSymbols.get(index);
         	}
         	Expression expr = SymbolMap.getExpression(querySymbol);
         	if (!previousExpressions.add(expr) || (queryCommand instanceof Query && EvaluatableVisitor.willBecomeConstant(expr))) {
                 orderBy.removeOrderByItem(i--);
         	} else if (!isUnrelated) {
-        		orderBy.getOrderByItems().get(i).setSymbol((SingleElementSymbol)querySymbol.clone());
+        		orderBy.getOrderByItems().get(i).setSymbol((Expression)querySymbol.clone());
         	}
         }
         if (orderBy.getVariableCount() == 0) {
@@ -632,7 +632,7 @@
 	private Insert correctDatatypes(Insert insert) {
 		boolean needsView = false;
 		for (int i = 0; !needsView && i < insert.getVariables().size(); i++) {
-		    SingleElementSymbol ses = insert.getVariables().get(i);
+		    Expression ses = insert.getVariables().get(i);
 		    if (ses.getType() != insert.getQueryExpression().getProjectedSymbols().get(i).getType()) {
 		        needsView = true;
 		    }
@@ -1216,14 +1216,14 @@
 	    		CompareCriteria cc = new CompareCriteria();
 	    		cc.setLeftExpression(criteria.getLeftExpression());
 	    		Query q = createInlineViewQuery(new GroupSymbol("X"), criteria.getCommand(), metadata, criteria.getCommand().getProjectedSymbols()); //$NON-NLS-1$
-	    		SingleElementSymbol ses = q.getProjectedSymbols().get(0);
+	    		Expression ses = q.getProjectedSymbols().get(0);
 	    		Expression expr = SymbolMap.getExpression(ses);
 	    		q.getSelect().clearSymbols();
 	    		AggregateSymbol.Type type = Type.MAX;
 	    		if (criteria.getOperator() == CompareCriteria.GT || criteria.getOperator() == CompareCriteria.GE) {
 	    			type = Type.MIN;
 	    		}
-	    		q.getSelect().addSymbol(new AggregateSymbol(ses.getName(), type.name(), false, expr));
+	    		q.getSelect().addSymbol(new AggregateSymbol(type.name(), type.name(), false, expr));
 	    		cc.setRightExpression(new ScalarSubquery(q));
 				cc.setOperator(criteria.getOperator());
 	    		return rewriteCriteria(cc);
@@ -1251,7 +1251,7 @@
         return criteria;
     }
     
-    private Criteria simplifyWithInverse(CompareCriteria criteria) throws TeiidComponentException, TeiidProcessingException{
+    private Criteria simplifyWithInverse(CompareCriteria criteria) throws TeiidProcessingException{
         Expression leftExpr = criteria.getLeftExpression();
         
         Function leftFunction = (Function) leftExpr;
@@ -1293,7 +1293,7 @@
      * @return CompareCriteria
      */
     private CompareCriteria simplifyMathematicalCriteria(CompareCriteria criteria)
-    throws TeiidComponentException, TeiidProcessingException{
+    throws TeiidProcessingException{
 
         Expression leftExpr = criteria.getLeftExpression();
         Expression rightExpr = criteria.getRightExpression();
@@ -1872,7 +1872,7 @@
 		return criteria;
 	}
 	
-	public static Expression rewriteExpression(Expression expression, CreateProcedureCommand procCommand, CommandContext context, QueryMetadataInterface metadata) throws TeiidComponentException, TeiidProcessingException{
+	public static Expression rewriteExpression(Expression expression, CommandContext context, QueryMetadataInterface metadata) throws TeiidComponentException, TeiidProcessingException{
 		return new QueryRewriter(metadata, context).rewriteExpressionDirect(expression);
 	}
 
@@ -1891,7 +1891,7 @@
 
                 if (value == null) {
                 	if (es.getGroupSymbol().getSchema() == null) {
-                        String grpName = es.getGroupSymbol().getCanonicalName();
+                        String grpName = es.getGroupSymbol().getName();
 		                if (grpName.equals(ProcedureReservedWords.CHANGING)) {
 		                    Assertion.failed("Changing value should not be null"); //$NON-NLS-1$
 		                } 
@@ -1911,7 +1911,9 @@
             return expression;
     	}
     	boolean isBindEligible = true;
-    	if(expression instanceof Function) {
+    	if (expression instanceof AggregateSymbol) {
+    		expression = rewriteExpression((AggregateSymbol)expression);	
+    	} else if(expression instanceof Function) {
     		isBindEligible = !isConstantConvert(expression);
     		expression = rewriteFunction((Function) expression);
 		} else if (expression instanceof CaseExpression) {
@@ -1932,11 +1934,7 @@
             }
             return expression;
         } else if (expression instanceof ExpressionSymbol) {
-        	if (expression instanceof AggregateSymbol) {
-        		expression = rewriteExpression((AggregateSymbol)expression);	
-        	} else {
-            	expression = rewriteExpressionDirect(((ExpressionSymbol)expression).getExpression());
-        	}
+        	expression = rewriteExpressionDirect(((ExpressionSymbol)expression).getExpression());
         } else if (expression instanceof Criteria) {
         	expression = rewriteCriteria((Criteria)expression);
         } else {
@@ -2005,7 +2003,7 @@
     		SearchedCaseExpression sce = new SearchedCaseExpression(Arrays.asList(cond), Arrays.asList(ex));
     		sce.setType(ex.getType());
     		expression.setCondition(null);
-    		expression.setExpression(sce);
+    		expression.setArgs(new Expression[] {sce});
     	}
 		return expression;
 	}
@@ -2193,6 +2191,10 @@
                 return newArgs[0]; //unnecessary conversion
             }
             
+            if (function.isImplicit()) {
+            	function.setImplicit(false);
+            }
+            
             if (!(newArgs[0] instanceof Function) || tgtType == DataTypeManager.DefaultDataClasses.OBJECT) {
             	return function;
             }
@@ -2448,7 +2450,7 @@
     public static Query createInlineViewQuery(GroupSymbol inlineGroup,
                                                Command nested,
                                                QueryMetadataInterface metadata,
-                                               List<? extends SingleElementSymbol> actualSymbols) throws QueryMetadataException,
+                                               List<? extends Expression> actualSymbols) throws QueryMetadataException,
                                                                   QueryResolverException,
                                                                   TeiidComponentException {
         Query query = new Query();
@@ -2466,19 +2468,19 @@
         inlineGroup.setMetadataID(gid);
         
         List<Class<?>> actualTypes = new ArrayList<Class<?>>(nested.getProjectedSymbols().size());
-        for (SingleElementSymbol ses : actualSymbols) {
+        for (Expression ses : actualSymbols) {
             actualTypes.add(ses.getType());
         }
-        List<SingleElementSymbol> selectSymbols = SetQuery.getTypedProjectedSymbols(ResolverUtil.resolveElementsInGroup(inlineGroup, tma), actualTypes, tma);
-        Iterator<? extends SingleElementSymbol> iter = actualSymbols.iterator();
-        for (SingleElementSymbol ses : selectSymbols) {
-        	ses = (SingleElementSymbol)ses.clone();
-        	SingleElementSymbol actual = iter.next();
-        	if (!ses.getShortCanonicalName().equals(actual.getShortCanonicalName())) {
+        List<Expression> selectSymbols = SetQuery.getTypedProjectedSymbols(ResolverUtil.resolveElementsInGroup(inlineGroup, tma), actualTypes, tma);
+        Iterator<? extends Expression> iter = actualSymbols.iterator();
+        for (Expression ses : selectSymbols) {
+        	ses = (Expression)ses.clone();
+        	Expression actual = iter.next();
+        	if (!Symbol.getShortName(ses).equals(Symbol.getShortName(actual))) {
 	        	if (ses instanceof AliasSymbol) {
-	        		((AliasSymbol)ses).setShortName(actual.getShortName());
+	        		((AliasSymbol)ses).setShortName(Symbol.getShortName(actual));
 	        	} else {
-	        		ses = new AliasSymbol(actual.getShortName(), ses);
+	        		ses = new AliasSymbol(Symbol.getShortName(actual), ses);
 	        	}
         	}
 			select.addSymbol(ses);
@@ -2492,7 +2494,7 @@
         sqfc.getGroupSymbol().setMetadataID(inlineGroup.getMetadataID());
         from.addClause(sqfc);
         //copy the metadata onto the new query so that temp metadata adapters will be used in later calls
-        query.getTemporaryMetadata().putAll(store.getData()); 
+        query.getTemporaryMetadata().getData().putAll(store.getData()); 
         return query;
     }    
     
@@ -2500,15 +2502,15 @@
         
         select.setSymbols(select.getProjectedSymbols());
         
-        List symbols = select.getSymbols();
+        List<Expression> symbols = select.getSymbols();
         
         HashSet<String> uniqueNames = new HashSet<String>();
         
         for(int i = 0; i < symbols.size(); i++) {
             
-            SingleElementSymbol symbol = (SingleElementSymbol)symbols.get(i);
+            Expression symbol = symbols.get(i);
             
-            String baseName = symbol.getShortCanonicalName(); 
+            String baseName = Symbol.getShortName(symbol); 
             String name = baseName;
 
             int exprID = 0;
@@ -2591,7 +2593,7 @@
 		query.setOrderBy(null);
 		SymbolMap expressionMapping = SymbolMap.createSymbolMap(update.getGroup(), query.getProjectedSymbols(), metadata);
 		
-		ArrayList<SingleElementSymbol> selectSymbols = mapChangeList(update, symbolMap);
+		ArrayList<Expression> selectSymbols = mapChangeList(update, symbolMap);
 		query.setSelect(new Select(selectSymbols));
 		ExpressionMappingVisitor emv = new ExpressionMappingVisitor(expressionMapping.asMap(), true);
 		PostOrderNavigator.doVisit(query.getSelect(), emv);
@@ -2607,18 +2609,18 @@
 		return createUpdateProcedure(update, query, group, correlationName);
 	}
 
-	private ArrayList<SingleElementSymbol> mapChangeList(Update update,
+	private ArrayList<Expression> mapChangeList(Update update,
 			Map<ElementSymbol, ElementSymbol> symbolMap) {
-		ArrayList<SingleElementSymbol> selectSymbols = new ArrayList<SingleElementSymbol>(update.getChangeList().getClauses().size());
+		ArrayList<Expression> selectSymbols = new ArrayList<Expression>(update.getChangeList().getClauses().size());
 		int i = 0;
 		for (SetClause clause : update.getChangeList().getClauses()) {
 			Expression ex = clause.getValue();
-			SingleElementSymbol selectSymbol = null;
+			Expression selectSymbol = null;
 			if (!EvaluatableVisitor.willBecomeConstant(ex)) {
-				if (!(ex instanceof SingleElementSymbol)) {
+				if (!(ex instanceof Expression)) {
 					selectSymbol = new ExpressionSymbol("expr", ex); //$NON-NLS-1$
 				} else {
-					selectSymbol = (SingleElementSymbol)ex;
+					selectSymbol = (Expression)ex;
 				}
 				selectSymbols.add(new AliasSymbol("s_" +i, selectSymbol)); //$NON-NLS-1$
 				ex = new ElementSymbol("s_" +i); //$NON-NLS-1$
@@ -2654,7 +2656,7 @@
 		CreateProcedureCommand cupc = new CreateProcedureCommand();
 		Block parent = new Block();
 		parent.setAtomic(true);
-		ElementSymbol rowsUpdated = new ElementSymbol(ProcedureReservedWords.VARIABLES+ElementSymbol.SEPARATOR+"ROWS_UPDATED"); //$NON-NLS-1$
+		ElementSymbol rowsUpdated = new ElementSymbol(ProcedureReservedWords.VARIABLES+Symbol.SEPARATOR+"ROWS_UPDATED"); //$NON-NLS-1$
 		DeclareStatement ds = new DeclareStatement(rowsUpdated, DataTypeManager.DefaultDataTypes.INTEGER, new Constant(0));
 		parent.addStatement(ds);
 		LoopStatement ls = new LoopStatement(b, query, "X"); //$NON-NLS-1$
@@ -2682,9 +2684,9 @@
 		List<Object> ids = metadata.getElementIDsInKey(pk);
 		List<Criteria> pkCriteria = new ArrayList<Criteria>(ids.size());
 		for (Object object : ids) {
-			ElementSymbol es = new ElementSymbol(correlationName + ElementSymbol.SEPARATOR + metadata.getName(object));
+			ElementSymbol es = new ElementSymbol(correlationName + Symbol.SEPARATOR + metadata.getName(object));
 			query.getSelect().addSymbol(new AliasSymbol("s_" +i, es)); //$NON-NLS-1$
-			es = new ElementSymbol(group.getName() + ElementSymbol.SEPARATOR + metadata.getName(object));
+			es = new ElementSymbol(group.getName() + Symbol.SEPARATOR + metadata.getName(object));
 			pkCriteria.add(new CompareCriteria(es, CompareCriteria.EQ, new ElementSymbol("X.s_" + i))); //$NON-NLS-1$
 			i++;
 		}
@@ -2755,7 +2757,7 @@
 	public static Command createUpdateProcedure(Update update, QueryMetadataInterface metadata, CommandContext context) throws QueryResolverException, QueryMetadataException, TeiidComponentException, TeiidProcessingException {
 		QueryRewriter rewriter = new QueryRewriter(metadata, context);
 		Criteria crit = update.getCriteria();
-		ArrayList<SingleElementSymbol> selectSymbols = rewriter.mapChangeList(update, null);
+		ArrayList<Expression> selectSymbols = rewriter.mapChangeList(update, null);
 		Query query = new Query(new Select(selectSymbols), new From(Arrays.asList(new UnaryFromClause(update.getGroup()))), crit, null, null);
 		return rewriter.createUpdateProcedure(update, query, update.getGroup(), update.getGroup().getName());
 	}

Modified: trunk/engine/src/main/java/org/teiid/query/sql/lang/Alter.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/lang/Alter.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/Alter.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -26,8 +26,8 @@
 
 import org.teiid.core.util.EquivalenceUtil;
 import org.teiid.core.util.HashCodeUtil;
+import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 
 public abstract class Alter<T extends Command> extends Command {
 	
@@ -56,7 +56,7 @@
 	}
 	
 	@Override
-	public List<SingleElementSymbol> getProjectedSymbols() {
+	public List<Expression> getProjectedSymbols() {
 		return Command.getUpdateCommandSymbol();
 	}
 	

Modified: trunk/engine/src/main/java/org/teiid/query/sql/lang/Command.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/lang/Command.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/Command.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -25,18 +25,17 @@
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
-import java.util.Map;
 
 import org.teiid.core.types.DataTypeManager;
 import org.teiid.core.util.EquivalenceUtil;
+import org.teiid.query.metadata.TempMetadataStore;
 import org.teiid.query.processor.ProcessorPlan;
 import org.teiid.query.sql.LanguageObject;
 import org.teiid.query.sql.symbol.ElementSymbol;
+import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 import org.teiid.query.sql.util.SymbolMap;
 import org.teiid.query.sql.visitor.CommandCollectorVisitor;
 import org.teiid.query.sql.visitor.SQLStringVisitor;
@@ -109,14 +108,14 @@
     
     public static final int TYPE_ALTER_TRIGGER = 16;
 
-    private static List<SingleElementSymbol> updateCommandSymbol;
+    private static List<Expression> updateCommandSymbol;
     
     /**
      * All temporary group IDs discovered while resolving this 
      * command.  The key is a TempMetadataID and the value is an 
      * ordered List of TempMetadataID representing the elements.
      */
-    protected Map tempGroupIDs;
+    protected TempMetadataStore tempGroupIDs;
     
     private transient GroupContext externalGroups;
 
@@ -150,11 +149,11 @@
 		this.correlatedReferences = correlatedReferences;
 	}
 
-    public void setTemporaryMetadata(Map metadata) {
+    public void setTemporaryMetadata(TempMetadataStore metadata) {
         this.tempGroupIDs = metadata;
     }
     
-    public Map getTemporaryMetadata() {
+    public TempMetadataStore getTemporaryMetadata() {
         return this.tempGroupIDs;
     }
     
@@ -220,7 +219,7 @@
             copy.externalGroups = (GroupContext)this.externalGroups.clone();
         }
         if(this.tempGroupIDs != null) {
-            copy.setTemporaryMetadata(new HashMap(this.tempGroupIDs));
+            copy.setTemporaryMetadata(this.tempGroupIDs.clone());
         }
         
         copy.setIsResolved(this.isResolved());
@@ -293,7 +292,7 @@
 	 * single column.
 	 * @return Ordered list of SingleElementSymbol
 	 */
-	public abstract List<SingleElementSymbol> getProjectedSymbols();
+	public abstract List<Expression> getProjectedSymbols();
 
 	/**
 	 * Whether the results are cachable.
@@ -301,11 +300,11 @@
 	 */
 	public abstract boolean areResultsCachable();
     
-    public static List<SingleElementSymbol> getUpdateCommandSymbol() {
+    public static List<Expression> getUpdateCommandSymbol() {
         if (updateCommandSymbol == null ) {
             ElementSymbol symbol = new ElementSymbol("Count"); //$NON-NLS-1$
             symbol.setType(DataTypeManager.DefaultDataClasses.INTEGER);
-            updateCommandSymbol = Arrays.asList((SingleElementSymbol)symbol);
+            updateCommandSymbol = Arrays.asList((Expression)symbol);
         }
         return updateCommandSymbol;
     }

Modified: trunk/engine/src/main/java/org/teiid/query/sql/lang/Criteria.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/lang/Criteria.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/Criteria.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -178,9 +178,4 @@
     	return DataTypeManager.DefaultDataClasses.BOOLEAN;
     }
     
-    @Override
-    public boolean isResolved() {
-    	return true;
-    }
-	
 }  // END CLASS

Modified: trunk/engine/src/main/java/org/teiid/query/sql/lang/Insert.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/lang/Insert.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/Insert.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -35,7 +35,6 @@
 import org.teiid.query.sql.symbol.ElementSymbol;
 import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 
 
 /**
@@ -257,7 +256,7 @@
 	 * single column.
 	 * @return Ordered list of SingleElementSymbol
 	 */
-	public List<SingleElementSymbol> getProjectedSymbols(){
+	public List<Expression> getProjectedSymbols(){
         return Command.getUpdateCommandSymbol();
 	}
 	

Modified: trunk/engine/src/main/java/org/teiid/query/sql/lang/OrderBy.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/lang/OrderBy.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/OrderBy.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -30,7 +30,7 @@
 import org.teiid.core.util.HashCodeUtil;
 import org.teiid.query.sql.LanguageObject;
 import org.teiid.query.sql.LanguageVisitor;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.visitor.SQLStringVisitor;
 
 
@@ -61,8 +61,8 @@
      * Constructs an instance of this class from an ordered list of elements.
      * @param parameters The ordered list of SingleElementSymbol
      */
-    public OrderBy( List<? extends SingleElementSymbol> parameters ) {
-    	for (SingleElementSymbol singleElementSymbol : parameters) {
+    public OrderBy( List<? extends Expression> parameters ) {
+    	for (Expression singleElementSymbol : parameters) {
 			orderByItems.add(new OrderByItem(singleElementSymbol, ASC));
 		}
     }
@@ -72,9 +72,9 @@
      * @param parameters The ordered list of SingleElementSymbol
      * @param types The list of directions by which the results are ordered (Boolean, true=ascending)
      */
-    public OrderBy( List<? extends SingleElementSymbol> parameters, List<Boolean> types ) {
+    public OrderBy( List<? extends Expression> parameters, List<Boolean> types ) {
     	Iterator<Boolean> typeIter = types.iterator();
-    	for (SingleElementSymbol singleElementSymbol : parameters) {
+    	for (Expression singleElementSymbol : parameters) {
 			orderByItems.add(new OrderByItem(singleElementSymbol, typeIter.next()));
 		}
     }
@@ -99,7 +99,7 @@
      * @param index Index to get
      * @return The element at the index
      */
-    public SingleElementSymbol getVariable( int index ) {
+    public Expression getVariable( int index ) {
         return orderByItems.get(index).getSymbol();
     }
 
@@ -116,7 +116,7 @@
      * Adds a new variable to the list of order by elements.
      * @param element Element to add
      */
-    public void addVariable( SingleElementSymbol element ) {
+    public void addVariable( Expression element ) {
     	addVariable(element, ASC);
     }
 
@@ -126,7 +126,7 @@
      * @param element Element to add
      * @param type True for ascending, false for descending
      */
-    public void addVariable( SingleElementSymbol element, boolean type ) {
+    public void addVariable( Expression element, boolean type ) {
     	if(element != null) {
             orderByItems.add(new OrderByItem(element, type));
         }
@@ -208,8 +208,8 @@
      * Get the list or sort key symbols.  Modifications to this list will not add or remove {@link OrderByItem}s.
      * @return
      */
-    public List<SingleElementSymbol> getSortKeys() {
-    	ArrayList<SingleElementSymbol> result = new ArrayList<SingleElementSymbol>(orderByItems.size());
+    public List<Expression> getSortKeys() {
+    	ArrayList<Expression> result = new ArrayList<Expression>(orderByItems.size());
     	for (OrderByItem item : orderByItems) {
 			result.add(item.getSymbol());
 		}

Modified: trunk/engine/src/main/java/org/teiid/query/sql/lang/OrderByItem.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/lang/OrderByItem.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/OrderByItem.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -25,7 +25,7 @@
 import org.teiid.language.SortSpecification.NullOrdering;
 import org.teiid.query.sql.LanguageObject;
 import org.teiid.query.sql.LanguageVisitor;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.visitor.SQLStringVisitor;
 
 public class OrderByItem implements LanguageObject {
@@ -34,10 +34,10 @@
 	
 	private Integer expressionPosition; //set during resolving to the select clause position
 	private boolean ascending = true;
-	private SingleElementSymbol symbol;
+	private Expression symbol;
 	private NullOrdering nullOrdering;
 
-	public OrderByItem(SingleElementSymbol symbol, boolean ascending) {
+	public OrderByItem(Expression symbol, boolean ascending) {
 		this.symbol = symbol;
 		this.ascending = ascending;
 	}
@@ -58,11 +58,11 @@
 		this.ascending = ascending;
 	}
 
-	public SingleElementSymbol getSymbol() {
+	public Expression getSymbol() {
 		return symbol;
 	}
 
-	public void setSymbol(SingleElementSymbol symbol) {
+	public void setSymbol(Expression symbol) {
 		this.symbol = symbol;
 	}
 	
@@ -89,7 +89,7 @@
 	
 	@Override
 	public OrderByItem clone() {
-		OrderByItem clone = new OrderByItem((SingleElementSymbol)this.symbol.clone(), ascending);
+		OrderByItem clone = new OrderByItem((Expression)this.symbol.clone(), ascending);
 		clone.expressionPosition = this.expressionPosition;
 		clone.nullOrdering = this.nullOrdering;
 		return clone;

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	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/Query.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -33,7 +33,7 @@
 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.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.visitor.AggregateSymbolCollectorVisitor;
 
 /**
@@ -76,7 +76,7 @@
     private Into into;
     
     /** xml projected symbols */
-    private List<SingleElementSymbol> selectList;
+    private List<Expression> selectList;
 	
     // =========================================================================
     //                         C O N S T R U C T O R S
@@ -292,7 +292,7 @@
 	 * single column.
 	 * @return Ordered list of SingleElementSymbol
 	 */
-	public List<SingleElementSymbol> getProjectedSymbols() {
+	public List<Expression> getProjectedSymbols() {
 		if (!getIsXML()) {
 			if(getSelect() != null) { 
                 if(getInto() != null){
@@ -304,7 +304,7 @@
 			return Collections.emptyList();
 		}
 		if(selectList == null){
-			selectList = new ArrayList<SingleElementSymbol>(1);
+			selectList = new ArrayList<Expression>(1);
 			ElementSymbol xmlElement = new ElementSymbol("xml"); //$NON-NLS-1$
 	        xmlElement.setType(DataTypeManager.DefaultDataClasses.XML);
 			selectList.add(xmlElement);
@@ -357,7 +357,7 @@
         copy.setIsXML(getIsXML());
         
         if(selectList != null){
-        	copy.selectList = LanguageObject.Util.deepClone(selectList, SingleElementSymbol.class);
+        	copy.selectList = LanguageObject.Util.deepClone(selectList, Expression.class);
         }
         
         if (into != null) {
@@ -429,8 +429,8 @@
 		return areResultsCachable(projectedSymbols);
 	}
 
-	public static boolean areResultsCachable(Collection<? extends SingleElementSymbol> projectedSymbols) {
-		for (SingleElementSymbol projectedSymbol : projectedSymbols) {
+	public static boolean areResultsCachable(Collection<? extends Expression> projectedSymbols) {
+		for (Expression projectedSymbol : projectedSymbols) {
 			if(projectedSymbol.getType() == DataTypeManager.DefaultDataClasses.OBJECT) {
 				return false;
 			}

Modified: trunk/engine/src/main/java/org/teiid/query/sql/lang/Select.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/lang/Select.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/Select.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -31,9 +31,10 @@
 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.Expression;
+import org.teiid.query.sql.symbol.ExpressionSymbol;
 import org.teiid.query.sql.symbol.MultipleElementSymbol;
-import org.teiid.query.sql.symbol.SelectSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Symbol;
 import org.teiid.query.sql.visitor.SQLStringVisitor;
 
 
@@ -44,7 +45,7 @@
 public class Select implements LanguageObject {
 
     /** The set of symbols for the data elements to be selected. */
-    private List<SelectSymbol> symbols;
+    private List<Expression> symbols = new ArrayList<Expression>();
 
     /** Flag for whether duplicate removal should be performed on the results */
     private boolean distinct;
@@ -57,15 +58,15 @@
      * Constructs a default instance of this class.
      */
     public Select() {
-        symbols = new ArrayList<SelectSymbol>();
+        
     }
 
     /**
      * Constructs an instance of this class from an ordered set of symbols.
      * @param symbols The ordered list of symbols
      */
-    public Select( List<? extends SelectSymbol> symbols ) {
-        this.symbols = new ArrayList<SelectSymbol>( symbols );
+    public Select( List<? extends Expression> symbols ) {
+        this.addSymbols(symbols);
     }
 
     // =========================================================================
@@ -91,7 +92,7 @@
      * Returns an ordered list of the symbols in the select.
      * @param Get list of SelectSymbol in SELECT
      */
-    public List<SelectSymbol> getSymbols() {
+    public List<Expression> getSymbols() {
         return symbols;
     }
     
@@ -99,8 +100,8 @@
      * Sets an ordered list of the symbols in the select.
      * @param symbols list of SelectSymbol in SELECT
      */
-    public void setSymbols(List<? extends SelectSymbol> symbols) {
-        this.symbols = new ArrayList<SelectSymbol>(symbols);
+    public void setSymbols(List<? extends Expression> symbols) {
+        this.symbols = new ArrayList<Expression>(symbols);
     }    
 
     /**
@@ -108,28 +109,26 @@
      * @param index Index to get
      * @return The variable identifier at the index
      */
-    public SelectSymbol getSymbol( int index ) {
+    public Expression getSymbol( int index ) {
         return symbols.get(index);
     }
 
     /**
-     * Adds a new symbol to the list of symbols.
      * @param symbol New symbol
      */
-    public void addSymbol( SelectSymbol symbol ) {
-    	if(symbol != null) {
-	        symbols.add(symbol);
-        }
+    public void addSymbol( Expression symbol ) {
+    	if (!(symbol instanceof Symbol) && !(symbol instanceof MultipleElementSymbol)) {
+    		symbol = new ExpressionSymbol("expr" + (this.symbols.size() + 1), symbol); //$NON-NLS-1$
+    	}
+    	this.symbols.add(symbol);
     }
-
-    /**
-     * Adds a new collection of symbols to the list of symbols.
-     * @param symbols Collection of SelectSymbols
-     */
-    public void addSymbols( Collection<? extends SelectSymbol> toAdd) {
-    	if(symbols != null) {
-	        this.symbols.addAll(toAdd);
-        }
+    
+    public void addSymbols( Collection<? extends Expression> toAdd) {
+    	if (toAdd != null) {
+    		for (Expression expression : toAdd) {
+    			this.addSymbol(expression);
+			}
+    	}
     }
     
     /**
@@ -144,7 +143,7 @@
      * @param symbol Symbol to check for
      * @return True if the Select contains the symbol
      */
-    public boolean containsSymbol( SelectSymbol symbol ) {
+    public boolean containsSymbol( Expression symbol ) {
         return symbols.contains(symbol);
     }
 
@@ -174,17 +173,17 @@
 	 * single column.
 	 * @return Ordered list of SingleElementSymbol
 	 */
-	public List<SingleElementSymbol> getProjectedSymbols() { 
-		ArrayList<SingleElementSymbol> projectedSymbols = new ArrayList<SingleElementSymbol>();
-		for (SelectSymbol symbol : symbols) {
-			if(symbol instanceof SingleElementSymbol) { 
-				projectedSymbols.add((SingleElementSymbol)symbol);
-			} else {
+	public List<Expression> getProjectedSymbols() { 
+		ArrayList<Expression> projectedSymbols = new ArrayList<Expression>();
+		for (Expression symbol : symbols) {
+			if(symbol instanceof MultipleElementSymbol) { 
 			    List<ElementSymbol> multiSymbols = ((MultipleElementSymbol)symbol).getElementSymbols();
 			    if(multiSymbols != null) { 
 			        projectedSymbols.addAll(multiSymbols);
 			    }
-			}	
+			} else {
+				projectedSymbols.add(symbol);
+			}
 		}		
 		return projectedSymbols;
 	}
@@ -198,7 +197,7 @@
 	 * @return Deep clone
 	 */
 	public Object clone() {
-		Select copy = new Select(LanguageObject.Util.deepClone(this.symbols, SelectSymbol.class));
+		Select copy = new Select(LanguageObject.Util.deepClone(this.symbols, Expression.class));
 		copy.setDistinct( isDistinct() );
 		return copy;
 	}

Modified: trunk/engine/src/main/java/org/teiid/query/sql/lang/SetQuery.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/lang/SetQuery.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/SetQuery.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -38,8 +38,8 @@
 import org.teiid.query.sql.LanguageVisitor;
 import org.teiid.query.sql.symbol.AliasSymbol;
 import org.teiid.query.sql.symbol.Expression;
-import org.teiid.query.sql.symbol.ExpressionSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Symbol;
+import org.teiid.query.sql.util.SymbolMap;
 
 
 /**
@@ -130,30 +130,22 @@
         return projectedSymbols;
     }
     
-    public static List getTypedProjectedSymbols(List acutal, List projectedTypes, QueryMetadataInterface metadata) {
-        List newProject = new ArrayList();
+    public static List<Expression> getTypedProjectedSymbols(List<? extends Expression> acutal, List<Class<?>> projectedTypes, QueryMetadataInterface metadata) {
+        List<Expression> newProject = new ArrayList<Expression>();
         for (int i = 0; i < acutal.size(); i++) {
-            SingleElementSymbol originalSymbol = (SingleElementSymbol)acutal.get(i);
-            SingleElementSymbol symbol = originalSymbol;
-            Class type = (Class)projectedTypes.get(i);
+            Expression originalSymbol = acutal.get(i);
+            Expression symbol = originalSymbol;
+            Class<?> type = projectedTypes.get(i);
             if (symbol.getType() != type) {
-                if (symbol instanceof AliasSymbol) {
-                    symbol = ((AliasSymbol)symbol).getSymbol();
-                } 
-
-                Expression expr = symbol;
-                if (symbol instanceof ExpressionSymbol) {
-                    expr = ((ExpressionSymbol)symbol).getExpression();
-                } 
-                
+            	symbol = SymbolMap.getExpression(originalSymbol);
                 try {
-                    symbol = new ExpressionSymbol(originalSymbol.getShortName(), ResolverUtil.convertExpression(expr, DataTypeManager.getDataTypeName(type), metadata));
+                    symbol = ResolverUtil.convertExpression(symbol, DataTypeManager.getDataTypeName(type), metadata);
                 } catch (QueryResolverException err) {
                     throw new TeiidRuntimeException(err);
                 }
                 
-                if (!(originalSymbol instanceof ExpressionSymbol)) {
-                    symbol = new AliasSymbol(originalSymbol.getShortName(), symbol);
+                if (originalSymbol instanceof Symbol) {
+                    symbol = new AliasSymbol(Symbol.getShortName(originalSymbol), symbol);
                 } 
             }
             newProject.add(symbol);

Modified: trunk/engine/src/main/java/org/teiid/query/sql/lang/StoredProcedure.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/lang/StoredProcedure.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/StoredProcedure.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -24,7 +24,6 @@
 
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.LinkedList;
@@ -213,9 +212,6 @@
         copy.setProcedureCallableName(getProcedureCallableName());
         copy.setProcedureID(getProcedureID());
         copy.setGroup(getGroup().clone());
-        if (getTemporaryMetadata() != null){
-            copy.setTemporaryMetadata(new HashMap(getTemporaryMetadata()));
-        }
         copy.callableName = callableName;
         copy.calledWithReturn = calledWithReturn;
         List<SPParameter> params = getParameters();

Modified: trunk/engine/src/main/java/org/teiid/query/sql/proc/Block.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/proc/Block.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/proc/Block.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -32,6 +32,7 @@
 import org.teiid.query.sql.lang.Command;
 import org.teiid.query.sql.proc.Statement.Labeled;
 import org.teiid.query.sql.symbol.ElementSymbol;
+import org.teiid.query.sql.symbol.Symbol;
 import org.teiid.query.sql.visitor.SQLStringVisitor;
 
 
@@ -98,11 +99,11 @@
 				statements.add(new CommandStatement(cmd));
 				stmt.setCommand(null);
 				stmt.setExpression(null);
-				String fullName = ProcedureReservedWords.VARIABLES+ElementSymbol.SEPARATOR+ProcedureReservedWords.ROWCOUNT;
 				if (stmt.getVariable().getShortName().equalsIgnoreCase(ProcedureReservedWords.ROWCOUNT) 
-						&& stmt.getVariable().getCanonicalName().equals(fullName)) {
+						&& stmt.getVariable().getGroupSymbol() != null && stmt.getVariable().getGroupSymbol().getName().equalsIgnoreCase(ProcedureReservedWords.VARIABLES)) {
 					return;
 				}
+				String fullName = ProcedureReservedWords.VARIABLES+Symbol.SEPARATOR+ProcedureReservedWords.ROWCOUNT;
 				stmt.setExpression(new ElementSymbol(fullName));
 			}
 		}

Modified: trunk/engine/src/main/java/org/teiid/query/sql/proc/CreateProcedureCommand.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/proc/CreateProcedureCommand.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/proc/CreateProcedureCommand.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -33,7 +33,7 @@
 import org.teiid.query.sql.lang.Query;
 import org.teiid.query.sql.lang.StoredProcedure;
 import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.visitor.SQLStringVisitor;
 
 
@@ -203,7 +203,7 @@
             //user may have not entered any query yet
             return Collections.EMPTY_LIST;
         }
-        List<? extends SingleElementSymbol> symbols = this.resultsCommand.getProjectedSymbols();
+        List<? extends Expression> symbols = this.resultsCommand.getProjectedSymbols();
         if (this.resultsCommand instanceof StoredProcedure) {
         	StoredProcedure sp = (StoredProcedure)this.resultsCommand;
         	if (sp.isCallableStatement()) {

Modified: trunk/engine/src/main/java/org/teiid/query/sql/proc/TriggerAction.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/proc/TriggerAction.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/proc/TriggerAction.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -27,7 +27,7 @@
 import org.teiid.query.sql.LanguageVisitor;
 import org.teiid.query.sql.lang.Command;
 import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.visitor.SQLStringVisitor;
 
 public class TriggerAction extends Command {
@@ -98,7 +98,7 @@
 	}
 
 	@Override
-	public List<SingleElementSymbol> getProjectedSymbols() {
+	public List<Expression> getProjectedSymbols() {
 		return Command.getUpdateCommandSymbol();
 	}
 

Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/AggregateSymbol.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/AggregateSymbol.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/AggregateSymbol.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -46,7 +46,7 @@
  * floating point expressions not of type bigdecimal return type double and bigdecimal maps to
  * bigdecimal.</p>
  */
-public class AggregateSymbol extends ExpressionSymbol {
+public class AggregateSymbol extends Function implements DerivedExpression {
 	
 	public enum Type {
 		COUNT,
@@ -107,8 +107,8 @@
      * @param canonicalName
      * @since 4.3
      */
-    protected AggregateSymbol(String name, String canonicalName, Type aggregateFunction, boolean isDistinct, Expression expression) {
-        super(name, canonicalName, expression);
+    protected AggregateSymbol(String name, Type aggregateFunction, boolean isDistinct, Expression expression) {
+        super(name, expression == null?new Expression[0]:new Expression[] {expression});
         this.aggregate = aggregateFunction;
         this.distinct = isDistinct;
     }
@@ -121,7 +121,7 @@
 	 * @param expression Contained expression
 	 */
 	public AggregateSymbol(String name, String aggregateFunction, boolean isDistinct, Expression expression) {
-		super(name, expression);
+		super(name, expression == null?new Expression[0]:new Expression[] {expression});
 		this.aggregate = Type.valueOf(aggregateFunction);
 		this.distinct = isDistinct;
 	}
@@ -235,9 +235,9 @@
 	public Object clone() {
 		AggregateSymbol copy = null;
 		if(getExpression() != null) {
-			copy = new AggregateSymbol(getName(), getCanonical(), getAggregateFunction(), isDistinct(), (Expression) getExpression().clone());
+			copy = new AggregateSymbol(getName(), getAggregateFunction(), isDistinct(), (Expression) getExpression().clone());
 		} else {
-			copy = new AggregateSymbol(getName(), getCanonical(), getAggregateFunction(), isDistinct(), null);
+			copy = new AggregateSymbol(getName(), getAggregateFunction(), isDistinct(), null);
 		}
 		if (orderBy != null) {
 			copy.setOrderBy(orderBy.clone());
@@ -334,5 +334,15 @@
 	public void setWindowed(boolean isWindowed) {
 		this.isWindowed = isWindowed;
 	}
+	
+	public Expression getExpression() {
+		if (this.getArgs().length == 0) {
+			return null;
+		}
+		if (this.getArgs().length > 1) {
+			throw new AssertionError("getExpression should not be used with a non-unary aggregate");
+		}
+		return this.getArg(0);
+	}
 
 }

Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/AliasSymbol.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/AliasSymbol.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/AliasSymbol.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -34,9 +34,9 @@
  * the type of it's underlying SingleElementSymbol.  AliasSymbols are typically
  * applied to ElementSymbol, ExpressionSymbol, and AggregateSymbol.
  */
-public class AliasSymbol extends SingleElementSymbol {
+public class AliasSymbol extends Symbol implements DerivedExpression {
 
-	private SingleElementSymbol symbol;
+	private Expression symbol;
 
     /**
      * Constructor used for cloning 
@@ -44,8 +44,8 @@
      * @param canonicalName
      * @since 4.3
      */
-    private AliasSymbol(String name, String canonicalName, SingleElementSymbol symbol) {
-        super(name, canonicalName);
+    private AliasSymbol(String name, String canonicalName, Expression symbol) {
+        super(name);
         setSymbol(symbol);
     }
     
@@ -54,16 +54,16 @@
 	 * @param name Name of the alias
 	 * @param symbol Underlying symbol
 	 */
-	public AliasSymbol(String name, SingleElementSymbol symbol) {
+	public AliasSymbol(String name, Expression symbol) {
 		super(name);
-		setSymbol(symbol);
+        setSymbol(symbol);
 	}
 
 	/**
 	 * Get the underlying symbol
 	 * @return Underlying symbol
 	 */
-	public SingleElementSymbol getSymbol() {
+	public Expression getSymbol() {
 		return this.symbol;
 	}
 
@@ -71,7 +71,7 @@
 	 * Set the underlying symbol
 	 * @param symbol New symbol
 	 */
-	public void setSymbol(SingleElementSymbol symbol) {
+	public void setSymbol(Expression symbol) {
         if(symbol instanceof AliasSymbol || symbol == null){
             Assertion.failed(QueryPlugin.Util.getString("ERR.015.010.0029")); //$NON-NLS-1$
         }
@@ -86,19 +86,6 @@
 		return this.symbol.getType();
 	}
 
-	/**
-	 * Returns true if this symbol has been completely resolved with respect
-	 * to actual runtime metadata.  A resolved symbol has been validated that
-	 * it refers to actual metadata and will have references to the real metadata
-	 * IDs if necessary.  Different types of symbols determine their resolution
-	 * in different ways, so this method is abstract and must be implemented
-	 * by subclasses.
-	 * @return True if resolved with runtime metadata
-	 */
-	public boolean isResolved() {
-		return this.symbol.isResolved();
-	}
-
     public void acceptVisitor(LanguageVisitor visitor) {
         visitor.visit(this);
     }
@@ -107,8 +94,8 @@
 	 * Return a copy of this object.
 	 */
 	public Object clone() {
-		SingleElementSymbol symbolCopy = (SingleElementSymbol) this.symbol.clone();
-		AliasSymbol result = new AliasSymbol(getName(), getCanonical(), symbolCopy);
+		Expression symbolCopy = (Expression) this.symbol.clone();
+		AliasSymbol result = new AliasSymbol(getName(), getShortName(), symbolCopy);
 		result.setOutputName(this.getOutputName());
 		return result;
 	}
@@ -125,7 +112,7 @@
             return false;
         }
         AliasSymbol other = (AliasSymbol)obj;
-        return this.getCanonicalName().equals(other.getCanonicalName()) && this.symbol.equals(other.symbol);
+        return this.getName().equals(other.getName()) && this.symbol.equals(other.symbol);
     }
 
 }

Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/CaseExpression.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/CaseExpression.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/CaseExpression.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -125,19 +125,6 @@
         setThen(then);
     }
 
-    /**
-     * @see org.teiid.query.sql.symbol.Expression#isResolved()
-     */
-    public boolean isResolved() {
-       if (!expression.isResolved()) return false;
-       for (int i = 0; i < getWhenCount(); i++) {
-           if (when.get(i) != null && !((Expression)when.get(i)).isResolved()) return false;
-           if (getThen().get(i) != null && !((Expression)getThen().get(i)).isResolved()) return false;
-       }
-       if (getElseExpression() != null && !getElseExpression().isResolved()) return false;
-       return getType() != null;
-    }
-
     public void acceptVisitor(LanguageVisitor visitor) {
         visitor.visit(this);
     }

Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/Constant.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/Constant.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/Constant.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -91,6 +91,14 @@
 	public Class<?> getType() {
 		return this.type;
 	}
+	
+	/**
+	 * TODO: remove me when a null type is supported
+	 * @param type
+	 */
+	public void setType(Class<?> type) {
+		this.type = type;
+	}
 
 	/**
 	 * Get value of constant
@@ -108,15 +116,6 @@
 		return value==null;
 	}
 
-	/**
-	 * Return true if expression has been fully resolved.  Typically the QueryResolver component
-	 * will handle resolution of an expression.
-	 * @return True if resolved
-	 */
-	public boolean isResolved() {
-		return true;
-	}
-	
     public void setMultiValued(List<?> value) {
 		this.multiValued = true;
 		this.value = value;

Added: trunk/engine/src/main/java/org/teiid/query/sql/symbol/DerivedExpression.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/DerivedExpression.java	                        (rev 0)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/DerivedExpression.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.query.sql.symbol;
+
+public interface DerivedExpression extends Expression {
+
+}


Property changes on: trunk/engine/src/main/java/org/teiid/query/sql/symbol/DerivedExpression.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/ElementSymbol.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/ElementSymbol.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/ElementSymbol.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -36,7 +36,7 @@
  * is set to false.  Common uses when this is set to true are for variables used 
  * within a command, correlated elements within a command, etc. </p>
  */
-public class ElementSymbol extends SingleElementSymbol {
+public class ElementSymbol extends Symbol implements DerivedExpression {
 
     public enum DisplayMode {
         FULLY_QUALIFIED, // symbol name 
@@ -52,16 +52,6 @@
     private DisplayMode displayMode = DisplayMode.OUTPUT_NAME;
 	
     /**
-     * Constructor used for cloning 
-     * @param name
-     * @param canonicalName
-     * @since 4.3
-     */
-    protected ElementSymbol(String name, String canonicalName) {
-        super(name, canonicalName);
-    }
-    
-    /**
      * Simple constructor taking just a name.  By default will display fully qualified name
      * @param name Name of the symbol, may or may not be fully qualified
      */
@@ -69,8 +59,8 @@
         super(name);		
     }
     
-    public ElementSymbol(String shortName, String shortCanonical, GroupSymbol group) {
-    	super(shortName, shortCanonical);
+    public ElementSymbol(String shortName, GroupSymbol group) {
+    	this.setShortName(shortName);
     	this.groupSymbol = group;
     }
     
@@ -87,20 +77,12 @@
     @Override
     public String getName() {
     	if (this.groupSymbol != null) {
-    		return this.groupSymbol.getName() + SingleElementSymbol.SEPARATOR + this.getShortName();
+    		return this.groupSymbol.getName() + Symbol.SEPARATOR + this.getShortName();
     	}
     	return super.getName();
     }
     
     @Override
-    public String getCanonicalName() {
-    	if (this.groupSymbol != null) {
-    		return this.groupSymbol.getCanonicalName() + SingleElementSymbol.SEPARATOR + this.getShortCanonicalName();
-    	}
-    	return super.getCanonicalName();
-    }
-    
-    @Override
     public boolean equals(Object obj) {
     	if (this.groupSymbol == null) {
         	return super.equals(obj);
@@ -115,13 +97,13 @@
     	if (other.groupSymbol == null) {
         	return super.equals(obj);
     	}
-    	return this.groupSymbol.equals(other.groupSymbol) && this.getShortCanonicalName().equals(other.getShortCanonicalName());
+    	return this.groupSymbol.equals(other.groupSymbol) && this.getShortName().equals(other.getShortName());
     }
     
     @Override
     public int hashCode() {
     	if (this.groupSymbol != null) {
-    		return HashCodeUtil.hashCode(this.groupSymbol.hashCode(), this.getShortCanonicalName().hashCode());
+    		return HashCodeUtil.hashCode(this.groupSymbol.hashCode(), this.getShortName().hashCode());
     	}
     	return super.hashCode();
     }
@@ -240,21 +222,12 @@
         visitor.visit(this);
     }
 
-    /**
-     * If metadataID is not null and type is not null return true, 
-     * else return false
-     * @return boolean if metadataID is null or not
-     */
-    public boolean isResolved() {
-        return(this.metadataID != null && this.type != null);
-    }
-	
 	/**
 	 * Return a deep copy of this object.
 	 * @return Deep copy of this object
 	 */
 	public ElementSymbol clone() {
-		ElementSymbol copy = new ElementSymbol(getShortName(), getCanonical());
+		ElementSymbol copy = new ElementSymbol(getShortName(), null);
 		if(getGroupSymbol() != null) { 
 			copy.setGroupSymbol(getGroupSymbol().clone());
 		}

Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/Expression.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/Expression.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/Expression.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -32,17 +32,9 @@
 public interface Expression extends LanguageObject {
 
 	/**
-	 * Return true if expression has been fully resolved.  Typically the QueryResolver component
-	 * will handle resolution of an expression.
-	 * @return True if resolved
+	 * Get the return type of this expression. 
+	 * @return Java class may be null prior to being resolved
 	 */
-	boolean isResolved();
-	
-	/**
-	 * Get the return type of this expression.  This method will not necessarily work right 
-	 * before resolution ({@link #isResolved()} returns true).
-	 * @return Java class name
-	 */
-	Class getType();
+	Class<?> getType();
 		
 }

Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/ExpressionSymbol.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/ExpressionSymbol.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/ExpressionSymbol.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -22,31 +22,12 @@
 
 package org.teiid.query.sql.symbol;
 
-import org.teiid.query.sql.*;
+import org.teiid.query.sql.LanguageVisitor;
 
-/**
- * <p>This is a subclass of Symbol representing an expression in the SELECT clause.  The
- * expression may be a constant, function, or scalar subquery.  The name of this symbol is always generated
- * and typically should not be displayed.  If necessary, the ExpressionSymbol may be 
- * wrapped by an AliasSymbol to register the name in a query.  The definition of the 
- * symbol is the functional expression.  Resolution will produce a list of groups and 
- * elements used by the expression.</p>
- */
-public class ExpressionSymbol extends SingleElementSymbol {
+public class ExpressionSymbol extends Symbol implements DerivedExpression {
 	private Expression expression;
 
     /**
-     * Constructor used for cloning 
-     * @param name
-     * @param canonicalName
-     * @since 4.3
-     */
-    protected ExpressionSymbol(String name, String canonicalName, Expression expression) {
-        super(name, canonicalName);
-        this.expression = expression;
-    }
-    
-    /**
      * Construct an ExpressionSymbol with name and expression.
      */
     public ExpressionSymbol(String name, Expression expression) {
@@ -82,14 +63,6 @@
         visitor.visit(this);
     }
 
-    /**
-     * If elementSymbols is not null return true, else return false
-     * @return boolean True if expression symbol has been resolved to element symbols
-     */
-    public boolean isResolved() {
-        return true;
-    }
-
 	/**
 	 * Return a deep copy of this object
 	 * @return Deep copy of this object
@@ -99,7 +72,7 @@
 	    if(getExpression() != null) { 
 			clonedExpr = (Expression) getExpression().clone();		
 	    }
-	    ExpressionSymbol copy = new ExpressionSymbol(getName(), getCanonical(), clonedExpr);
+	    ExpressionSymbol copy = new ExpressionSymbol(getName(), clonedExpr);
 	    return copy;
 	}
 

Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/Function.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/Function.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/Function.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -40,7 +40,7 @@
 
 	private String name;
 	private Expression[] args;
-	private Class type;
+	private Class<?> type;
 	private FunctionDescriptor descriptor;
 	private boolean implicit = false;
 	
@@ -107,6 +107,10 @@
 		return this.implicit;
 	}
 	
+	public void setImplicit(boolean implicit) {
+		this.implicit = implicit;
+	}
+	
 	/** 
 	 * Insert a conversion function at specified index.  This is a convenience 
 	 * method to insert a conversion into the function tree.
@@ -115,8 +119,8 @@
 	 */
 	public void insertConversion(int index, FunctionDescriptor functionDescriptor) { 
 		// Get target type for conversion
-		Class type = functionDescriptor.getReturnType();
-		String typeName = DataTypeManager.getDataTypeName(type);
+		Class<?> t = functionDescriptor.getReturnType();
+		String typeName = DataTypeManager.getDataTypeName(t);
 		
 		// Pull old expression at index
 		Expression newArg[] = new Expression[] { args[index], new Constant(typeName) };
@@ -127,7 +131,7 @@
 		
 		// Set function descriptor and type of new function
 		func.setFunctionDescriptor(functionDescriptor);
-		func.setType(type);
+		func.setType(t);
 		func.makeImplicit();
 	}
 
@@ -135,7 +139,7 @@
 	 * Get type of function, if known
 	 * @return Java class name of type, or null if not yet resolved
 	 */
-	public Class getType() {
+	public Class<?> getType() {
 		return this.type;
 	}
 
@@ -143,7 +147,7 @@
 	 * Set type of function
 	 * @param type New type
 	 */
-	public void setType(Class type) { 
+	public void setType(Class<?> type) { 
 		this.type = type;
 	}
 	
@@ -163,21 +167,6 @@
 		this.descriptor = fd;
 	}
 			
-	/**
-	 * Return true if expression has been fully resolved.  Typically the QueryResolver component
-	 * will handle resolution of an expression.
-	 * @return True if resolved
-	 */
-	public boolean isResolved() { 
-		boolean resolved = true;
-		for(int i=0; i<args.length; i++) {
-			if(! args[i].isResolved()) {
-				resolved = false;
-			}				
-		}
-		return resolved;
-	}
-	
     public void acceptVisitor(LanguageVisitor visitor) {
         visitor.visit(this);
     }
@@ -235,7 +224,6 @@
 	 * @return Deep copy of the object
 	 */
 	public Object clone() {	
-		Expression[] args = getArgs();
 		Expression[] copyArgs = new Expression[args.length];
 		for(int i=0; i<args.length; i++) { 
             if(args[i] != null) {

Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/GroupSymbol.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/GroupSymbol.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/GroupSymbol.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -22,10 +22,8 @@
 
 package org.teiid.query.sql.symbol;
 
-import org.teiid.core.types.DataTypeManager;
 import org.teiid.core.util.EquivalenceUtil;
 import org.teiid.core.util.HashCodeUtil;
-import org.teiid.core.util.StringUtil;
 import org.teiid.query.QueryPlugin;
 import org.teiid.query.sql.LanguageVisitor;
 
@@ -59,20 +57,7 @@
     
     private String outputDefinition;
     private String schema;
-    private String canonicalSchema;
     
-    /**
-     * Cloning constructor 
-     * @param name
-     * @param canonicalName
-     * @param definition
-     * @since 4.3
-     */
-    protected GroupSymbol(String name, String canonicalName, String definition) {
-        super(name, canonicalName);
-        setDefinition(definition);
-    }
-
 	/**
 	 * Construct a symbol with a name.
 	 * @param name Name of the symbol
@@ -93,6 +78,12 @@
 		setDefinition(definition);
 	}
 	
+	private GroupSymbol(String schmea, String shortName, String definition) {
+		this.schema = schmea;
+		this.setShortName(shortName);
+		this.setDefinition(definition);
+	}
+	
 	public Object getModelMetadataId() {
 		return modelMetadataId;
 	}
@@ -186,7 +177,7 @@
 	 * @return -1, 0, or 1 depending on how this compares to group
 	 */
     public int compareTo(GroupSymbol o) {
-    	return getCanonicalName().compareTo(o.getCanonicalName());
+    	return getName().compareTo(o.getName());
 	}
 
 	/**
@@ -194,9 +185,7 @@
 	 * @return Deep copy of the object
 	 */
 	public GroupSymbol clone() {
-		GroupSymbol copy = new GroupSymbol(getShortName(), getCanonical(), getDefinition());
-		copy.schema = this.schema;
-		copy.canonicalSchema = this.canonicalSchema;
+		GroupSymbol copy = new GroupSymbol(schema, getShortName(), getDefinition());
 		if(getMetadataID() != null) {
 			copy.setMetadataID(getMetadataID());
 		}
@@ -225,9 +214,9 @@
 		GroupSymbol other = (GroupSymbol) obj;
 
 		if (this.schema == null || other.schema == null) {
-			return this.getCanonicalName().equals(other.getCanonicalName());
+			return this.getName().equals(other.getName());
 		}
-		return EquivalenceUtil.areEqual(this.getCanonicalSchema(), other.getCanonicalSchema()) && this.getShortCanonicalName().equals(other.getShortCanonicalName());
+		return EquivalenceUtil.areEqual(this.schema, other.schema) && this.getShortName().equals(other.getShortName());
 	}
     
     public boolean hasAlias() {
@@ -280,23 +269,15 @@
     @Override
     public String getName() {
     	if (this.schema != null) {
-    		return this.schema + SingleElementSymbol.SEPARATOR + this.getShortName();
+    		return this.schema + Symbol.SEPARATOR + this.getShortName();
     	}
     	return super.getName();
     }
     
     @Override
-    public String getCanonicalName() {
-    	if (this.schema != null) {
-    		return this.getCanonicalSchema() + SingleElementSymbol.SEPARATOR + this.getShortCanonicalName();
-    	}
-    	return super.getCanonicalName();
-    }
-    
-    @Override
     public int hashCode() {
     	if (this.schema != null) {
-    		return HashCodeUtil.hashCode(this.getCanonicalSchema().hashCode(), this.getShortCanonicalName().hashCode());
+    		return HashCodeUtil.hashCode(this.schema.hashCode(), this.getShortName().hashCode());
     	}
     	return super.hashCode();
     }
@@ -309,17 +290,9 @@
     	} else {
     		this.schema = null;
     	}
-    	this.canonicalSchema = null;
     	super.setShortName(name);
     }
 
-	private String getCanonicalSchema() {
-		if (this.canonicalSchema == null && this.schema != null) {
-			this.canonicalSchema = DataTypeManager.getCanonicalString(StringUtil.toUpperCase(this.schema));
-		}
-		return canonicalSchema;
-	}
-	
 	public String getSchema() {
 		return schema;
 	}

Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/MultipleElementSymbol.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/MultipleElementSymbol.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/MultipleElementSymbol.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -34,7 +34,7 @@
 /**
  * <p>This is a subclass of Symbol representing multiple output columns.</p>
  */
-public class MultipleElementSymbol implements SelectSymbol {
+public class MultipleElementSymbol implements Expression {
     private List<ElementSymbol> elementSymbols;
     private GroupSymbol group;
 
@@ -48,6 +48,11 @@
     public MultipleElementSymbol(String name){
         this.group = new GroupSymbol(name);
     }
+    
+    @Override
+    public Class<?> getType() {
+    	return null;
+    }
 
     /**
      * Set the {@link ElementSymbol}s that this symbol refers to
@@ -76,15 +81,6 @@
 		getElementSymbols().add(symbol);
     }
 	
-    /**
-     * True if multiple element symbol has been resolved by having all referring element
-     * symbols set.
-     * @return True if symbol has been resolved
-     */
-    public boolean isResolved() {
-        return(elementSymbols != null);
-    }
-    
     public void acceptVisitor(LanguageVisitor visitor) {
         visitor.visit(this);
     }

Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/QueryString.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/QueryString.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/QueryString.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -92,14 +92,4 @@
 		return DefaultDataClasses.STRING;
 	}
 	
-	@Override
-	public boolean isResolved() {
-		for (DerivedColumn col : args) {
-			if (!col.getExpression().isResolved()) {
-				return false;
-			}
-		}
-		return true;
-	}
-	
 }

Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/Reference.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/Reference.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/Reference.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -78,15 +78,11 @@
     	this.positional = ref.positional;
     	this.type = ref.type;
     	if (ref.expression != null) {
-    		this.expression = (ElementSymbol)ref.expression.clone();
+    		this.expression = ref.expression.clone();
     	}
     	this.constraint = ref.constraint;
     }
 
-    public boolean isResolved() {
-        return (expression != null || this.type != null);
-    }
-
     public int getIndex() {
         return this.refIndex;
     }

Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/ScalarSubquery.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/ScalarSubquery.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/ScalarSubquery.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -78,13 +78,6 @@
     }
 
     /**
-     * @see org.teiid.query.sql.symbol.Expression#isResolved()
-     */
-    public boolean isResolved() {
-        return (this.getType() != null);
-    }
-
-    /**
      * @see org.teiid.query.sql.symbol.Expression#getType()
      */
     public Class<?> getType() {

Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/SearchedCaseExpression.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/SearchedCaseExpression.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/SearchedCaseExpression.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -100,17 +100,6 @@
         setThen(then);
     }
 
-    /**
-     * @see org.teiid.query.sql.symbol.Expression#isResolved()
-     */
-    public boolean isResolved() {
-        for (int i = 0; i < getWhenCount(); i++) {
-            if (getThen().get(i) != null && !((Expression)getThen().get(i)).isResolved()) return false;
-        }
-        if (getElseExpression() != null && !getElseExpression().isResolved()) return false;
-        return getType() != null;
-    }
-
     public void acceptVisitor(LanguageVisitor visitor) {
         visitor.visit(this);
     }

Deleted: trunk/engine/src/main/java/org/teiid/query/sql/symbol/SelectSymbol.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/SelectSymbol.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/SelectSymbol.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -1,35 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.query.sql.symbol;
-
-import org.teiid.query.sql.LanguageObject;
-
-/** 
- * This is the server's representation of a metadata symbol that can be used
- * in a SELECT statement.  It exists as a typing mechanism and to provide a single
- * additional method to get an ordered list of elements from each symbol.
- */
-public interface SelectSymbol extends LanguageObject {
-	
-
-}

Deleted: trunk/engine/src/main/java/org/teiid/query/sql/symbol/SingleElementSymbol.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/SingleElementSymbol.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/SingleElementSymbol.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -1,64 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.query.sql.symbol;
-
-
-
-/**
- * <p>This is a subclass of Symbol representing a single output column.</p>
- */
-public abstract class SingleElementSymbol extends Symbol implements Expression, SelectSymbol {
-
-	/**
-     * Character used to delimit name components in a symbol
-	 */
-    public static final String SEPARATOR = "."; //$NON-NLS-1$
-
-    /**
-     * Passthrough constructor used for cloning 
-     * @param name
-     * @param canonicalName
-     * @param hashcode
-     * @since 4.3
-     */
-    protected SingleElementSymbol(String name, String canonicalName) {
-        super(name, canonicalName);
-    }
-    
-    /**
-     * Construct a symbol with a name
-     * @param name Name of symbol
-     */
-    public SingleElementSymbol(String name){
-        super(name);
-    }
-
-    public static String getShortName(String name) {
-        int index = name.lastIndexOf(SEPARATOR);
-        if(index >= 0) { 
-            return name.substring(index+1);
-        }
-        return name;
-    }
-
-}

Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/Symbol.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/Symbol.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/Symbol.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -23,7 +23,6 @@
 package org.teiid.query.sql.symbol;
 
 import org.teiid.core.types.DataTypeManager;
-import org.teiid.core.util.StringUtil;
 import org.teiid.query.QueryPlugin;
 import org.teiid.query.sql.LanguageObject;
 import org.teiid.query.sql.visitor.SQLStringVisitor;
@@ -48,11 +47,6 @@
 	 */
 	private String shortName;
 
-	/** 
-	 * upper case of name
-	 */
-	private String canonicalShortName;
-	
 	/**
 	 * Prior to resolving null, after resolving it is the exact string
 	 * entered in the query.
@@ -60,21 +54,13 @@
 	 * The AliasGenerator can also set this value as necessary for the data tier.
 	 */
     protected String outputName;
-    
-    /**
-     * Constructor to be used for cloning instances. Calls to String.toUpperCase() to generate the canonical names
-     * were the big performance hit during cloning, so this method allows subclasses to simply pass in the canonical name
-     * to avoid toUpperCase().
-     * @param name
-     * @param canonicalName
-     * @since 4.3
-     */
-    protected Symbol(String name, String canonicalName) {
-        this.shortName = name;
-        this.canonicalShortName = canonicalName;
-    }
 
 	/**
+	 * Character used to delimit name components in a symbol
+	 */
+	public static final String SEPARATOR = "."; //$NON-NLS-1$
+    
+	/**
 	 * Construct a symbol with a name.
 	 * @param name Name of the symbol
 	 * @throws IllegalArgumentException If name is null
@@ -83,6 +69,10 @@
 		this.setName(name);
 	}
 	
+	public Symbol() {
+		
+	}
+	
 	protected void setName(String name) {
 		setShortName(name);
 	}
@@ -99,8 +89,6 @@
 		}
 		this.shortName = DataTypeManager.getCanonicalString(name);
 		this.outputName = null;
-        // Canonical name is lazily created
-        this.canonicalShortName = null;
 	}
 
 	/**
@@ -112,29 +100,6 @@
 	}
 
 	/**
-	 * Get canonical name for comparisons
-	 * @return Canonical name for comparisons
-	 */
-	public String getCanonicalName() {
-        return getShortCanonicalName();
-	}
-	
-	public void setShortCanonicalName(String shortCanonicalName) {
-		this.canonicalShortName = shortCanonicalName;
-	}
-    
-	/**
-	 * Returns true if this symbol has been completely resolved with respect
-	 * to actual runtime metadata.  A resolved symbol has been validated that
-	 * it refers to actual metadata and will have references to the real metadata
-	 * IDs if necessary.  Different types of symbols determine their resolution
-	 * in different ways, so this method is abstract and must be implemented
-	 * by subclasses.
-	 * @return True if resolved with runtime metadata
-	 */
-	public abstract boolean isResolved();
-
-	/**
 	 * Returns string representation of this symbol.
 	 * @return String representing the symbol
 	 */
@@ -147,7 +112,7 @@
 	 * @return Hash code
 	 */
 	public int hashCode() {
-		return this.getCanonicalName().hashCode();
+		return this.shortName.hashCode();
 	}
 
 	/**
@@ -166,8 +131,8 @@
 		if(!(obj instanceof Symbol)) {
 			return false;
 		}
-		String otherFqn = ((Symbol)obj).getCanonicalName();
-		String thisFqn = getCanonicalName();
+		String otherFqn = ((Symbol)obj).getName();
+		String thisFqn = getName();
 		return thisFqn.equals(otherFqn);
 	}
 
@@ -176,10 +141,6 @@
 	 */
 	public abstract Object clone();
     
-    protected final String getCanonical() {
-        return canonicalShortName;
-    }
-    
     public String getOutputName() {
         return this.outputName == null ? getName() : this.outputName;
     }
@@ -196,16 +157,33 @@
     	return shortName;
     }
 
-    /**
-     * Get the short name of the element
-     * @return Short name of the symbol (un-dotted)
-     */
-    public final String getShortCanonicalName() { 
-		if (canonicalShortName == null) {
-        	canonicalShortName = DataTypeManager.getCanonicalString(StringUtil.toUpperCase(shortName));
-        }
-    	return this.canonicalShortName;
-    }
+	public static String getShortName(Expression ex) {
+		if (ex instanceof Symbol) {
+			return ((Symbol)ex).getShortName();
+		}
+		return "expr"; //$NON-NLS-1$
+	}
+	
+	public static String getName(Expression ex) {
+		if (ex instanceof Symbol) {
+			return ((Symbol)ex).getName();
+		}
+		return "expr"; //$NON-NLS-1$
+	}
+	
+	public static String getOutputName(Expression ex) {
+		if (ex instanceof Symbol) {
+			return ((Symbol)ex).getOutputName();
+		}
+		return "expr"; //$NON-NLS-1$
+	}
 
+	public static String getShortName(String name) {
+	    int index = name.lastIndexOf(Symbol.SEPARATOR);
+	    if(index >= 0) { 
+	        return name.substring(index+1);
+	    }
+	    return name;
+	}
 
 }

Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/TextLine.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/TextLine.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/TextLine.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -92,16 +92,6 @@
 	}
 
 	@Override
-	public boolean isResolved() {
-		for (DerivedColumn arg : this.expressions) {
-			if (!arg.getExpression().isResolved()) {
-				return false;
-			}
-		}
-		return true;
-	}
-
-	@Override
 	public void acceptVisitor(LanguageVisitor visitor) {
 		visitor.visit(this);
 	}

Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/WindowFunction.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/WindowFunction.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/WindowFunction.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -24,22 +24,15 @@
 
 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.visitor.SQLStringVisitor;
 
-public class WindowFunction extends SingleElementSymbol {
+public class WindowFunction implements LanguageObject, DerivedExpression {
 	
 	private AggregateSymbol function;
 	private WindowSpecification windowSpecification;
 	
-	public WindowFunction(String name) {
-		super(name);
-	}
-	
-	protected WindowFunction(String name, String canonical) {
-		super(name, canonical);
-	}
-	
 	public AggregateSymbol getFunction() {
 		return function;
 	}
@@ -63,11 +56,6 @@
 	}
 
 	@Override
-	public boolean isResolved() {
-		return function.isResolved();
-	}
-
-	@Override
 	public void acceptVisitor(LanguageVisitor visitor) {
 		visitor.visit(this);
 	}
@@ -92,7 +80,7 @@
 	
 	@Override
 	public WindowFunction clone() {
-		WindowFunction clone = new WindowFunction(this.getName(), this.getCanonical());
+		WindowFunction clone = new WindowFunction();
 		clone.setFunction((AggregateSymbol) this.function.clone());
 		clone.setWindowSpecification(this.windowSpecification.clone());
 		return clone;

Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/XMLElement.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/XMLElement.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/XMLElement.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -86,16 +86,6 @@
 	}
 
 	@Override
-	public boolean isResolved() {
-		for (Expression arg : content) {
-			if (!arg.isResolved()) {
-				return false;
-			}
-		}
-		return true;
-	}
-	
-	@Override
 	public void acceptVisitor(LanguageVisitor visitor) {
 		visitor.visit(this);
 	}

Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/XMLForest.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/XMLForest.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/XMLForest.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -59,16 +59,6 @@
 	}
 
 	@Override
-	public boolean isResolved() {
-		for (DerivedColumn arg : args) {
-			if (!arg.getExpression().isResolved()) {
-				return false;
-			}
-		}
-		return true;
-	}
-	
-	@Override
 	public void acceptVisitor(LanguageVisitor visitor) {
 		visitor.visit(this);
 	}

Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/XMLParse.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/XMLParse.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/XMLParse.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -64,11 +64,6 @@
 	}
 	
 	@Override
-	public boolean isResolved() {
-		return expression.isResolved();
-	}
-	
-	@Override
 	public void acceptVisitor(LanguageVisitor visitor) {
 		visitor.visit(this);
 	}

Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/XMLQuery.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/XMLQuery.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/XMLQuery.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -33,11 +33,6 @@
 		this.emptyOnEmpty = emptyOnEmpty;
 	}
     
-    @Override
-    public boolean isResolved() {
-    	return xqueryExpression != null;
-    }
-    
     public List<DerivedColumn> getPassing() {
 		return passing;
 	}

Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/XMLSerialize.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/XMLSerialize.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/XMLSerialize.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -72,11 +72,6 @@
 	}
 	
 	@Override
-	public boolean isResolved() {
-		return expression.isResolved();
-	}
-	
-	@Override
 	public void acceptVisitor(LanguageVisitor visitor) {
 		visitor.visit(this);
 	}

Modified: trunk/engine/src/main/java/org/teiid/query/sql/util/SymbolMap.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/util/SymbolMap.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/util/SymbolMap.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -35,13 +35,11 @@
 import org.teiid.core.util.Assertion;
 import org.teiid.query.metadata.QueryMetadataInterface;
 import org.teiid.query.resolver.util.ResolverUtil;
-import org.teiid.query.sql.symbol.AggregateSymbol;
 import org.teiid.query.sql.symbol.AliasSymbol;
 import org.teiid.query.sql.symbol.ElementSymbol;
 import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.symbol.ExpressionSymbol;
 import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 
 
 public class SymbolMap {
@@ -55,7 +53,7 @@
     public SymbolMap clone() {
     	SymbolMap clonedMap = new SymbolMap();
     	for (Map.Entry<ElementSymbol, Expression> entry : map.entrySet()) {
-			clonedMap.addMapping((ElementSymbol)entry.getKey().clone(), (Expression)entry.getValue().clone());
+			clonedMap.addMapping(entry.getKey().clone(), (Expression)entry.getValue().clone());
 		}
     	return clonedMap;
     }
@@ -77,14 +75,11 @@
     }
 
     public static final Expression getExpression(Expression symbol) {
-        if (!(symbol instanceof SingleElementSymbol)) {
-            return symbol;
-        }
         if (symbol instanceof AliasSymbol) {
             symbol = ((AliasSymbol)symbol).getSymbol();
         }
 
-        if (symbol instanceof ExpressionSymbol && !(symbol instanceof AggregateSymbol)) {
+        if (symbol instanceof ExpressionSymbol) {
             ExpressionSymbol exprSymbol = (ExpressionSymbol)symbol;
             return exprSymbol.getExpression();
         }
@@ -113,7 +108,7 @@
     }
 
     public static final SymbolMap createSymbolMap(GroupSymbol virtualGroup,
-                                                  List<? extends SingleElementSymbol> projectCols, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException {
+                                                  List<? extends Expression> projectCols, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException {
         return createSymbolMap(ResolverUtil.resolveElementsInGroup(virtualGroup, metadata), projectCols);
     }
 

Modified: trunk/engine/src/main/java/org/teiid/query/sql/visitor/EvaluatableVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/visitor/EvaluatableVisitor.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/visitor/EvaluatableVisitor.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -42,6 +42,7 @@
 import org.teiid.query.sql.navigator.DeepPreOrderNavigator;
 import org.teiid.query.sql.navigator.PreOrderNavigator;
 import org.teiid.query.sql.symbol.AggregateSymbol;
+import org.teiid.query.sql.symbol.AliasSymbol;
 import org.teiid.query.sql.symbol.Constant;
 import org.teiid.query.sql.symbol.ElementSymbol;
 import org.teiid.query.sql.symbol.ExpressionSymbol;
@@ -116,6 +117,10 @@
 		evaluationNotPossible(EvaluationLevel.PUSH_DOWN);
     }
     
+    public void visit(AliasSymbol obj) {
+		evaluationNotPossible(EvaluationLevel.PUSH_DOWN);
+    }
+    
     public void visit(AggregateSymbol obj) {
 		evaluationNotPossible(EvaluationLevel.PUSH_DOWN);
     }

Modified: trunk/engine/src/main/java/org/teiid/query/sql/visitor/ExpressionMappingVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/visitor/ExpressionMappingVisitor.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/visitor/ExpressionMappingVisitor.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -33,44 +33,12 @@
 
 import org.teiid.query.sql.LanguageObject;
 import org.teiid.query.sql.LanguageVisitor;
-import org.teiid.query.sql.lang.BetweenCriteria;
-import org.teiid.query.sql.lang.CompareCriteria;
-import org.teiid.query.sql.lang.DependentSetCriteria;
-import org.teiid.query.sql.lang.DynamicCommand;
-import org.teiid.query.sql.lang.ExpressionCriteria;
-import org.teiid.query.sql.lang.GroupBy;
-import org.teiid.query.sql.lang.Insert;
-import org.teiid.query.sql.lang.IsNullCriteria;
-import org.teiid.query.sql.lang.Limit;
-import org.teiid.query.sql.lang.MatchCriteria;
-import org.teiid.query.sql.lang.OrderByItem;
-import org.teiid.query.sql.lang.SPParameter;
-import org.teiid.query.sql.lang.Select;
-import org.teiid.query.sql.lang.SetClause;
-import org.teiid.query.sql.lang.SetCriteria;
-import org.teiid.query.sql.lang.StoredProcedure;
-import org.teiid.query.sql.lang.SubqueryCompareCriteria;
-import org.teiid.query.sql.lang.SubquerySetCriteria;
-import org.teiid.query.sql.lang.XMLTable;
+import org.teiid.query.sql.lang.*;
 import org.teiid.query.sql.lang.XMLTable.XMLColumn;
 import org.teiid.query.sql.navigator.PreOrPostOrderNavigator;
 import org.teiid.query.sql.navigator.PreOrderNavigator;
 import org.teiid.query.sql.proc.AssignmentStatement;
-import org.teiid.query.sql.symbol.AggregateSymbol;
-import org.teiid.query.sql.symbol.AliasSymbol;
-import org.teiid.query.sql.symbol.CaseExpression;
-import org.teiid.query.sql.symbol.DerivedColumn;
-import org.teiid.query.sql.symbol.ElementSymbol;
-import org.teiid.query.sql.symbol.Expression;
-import org.teiid.query.sql.symbol.ExpressionSymbol;
-import org.teiid.query.sql.symbol.Function;
-import org.teiid.query.sql.symbol.QueryString;
-import org.teiid.query.sql.symbol.SearchedCaseExpression;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
-import org.teiid.query.sql.symbol.WindowSpecification;
-import org.teiid.query.sql.symbol.XMLElement;
-import org.teiid.query.sql.symbol.XMLParse;
-import org.teiid.query.sql.symbol.XMLSerialize;
+import org.teiid.query.sql.symbol.*;
 
 
 /**
@@ -101,7 +69,18 @@
     }
     
     public void visit(Select obj) {
-        replaceSymbols(obj.getSymbols(), true);
+    	List<Expression> symbols = obj.getSymbols();
+    	for (int i = 0; i < symbols.size(); i++) {
+            Expression symbol = symbols.get(i);
+            
+            if (symbol instanceof MultipleElementSymbol) {
+            	continue;
+            }
+            
+            Expression replacmentSymbol = replaceSymbol(symbol, true);
+            
+            symbols.set(i, replacmentSymbol);
+        }
     }
     
     public boolean isClone() {
@@ -141,39 +120,21 @@
     	obj.setExpression(replaceExpression(obj.getExpression()));
     }
     
-    private void replaceSymbols(List symbols, boolean alias) {
-        for (int i = 0; i < symbols.size(); i++) {
-            Object symbol = symbols.get(i);
-            
-            if (symbol instanceof SingleElementSymbol) {
-                SingleElementSymbol ses = (SingleElementSymbol)symbol;
-                SingleElementSymbol replacmentSymbol = replaceSymbol(ses, alias);
-                
-                symbols.set(i, replacmentSymbol);
-            }
-        }
-    }
-
-	private SingleElementSymbol replaceSymbol(SingleElementSymbol ses,
+	private Expression replaceSymbol(Expression ses,
 			boolean alias) {
-		SingleElementSymbol replacmentSymbol = null; 
-
 		Expression expr = ses;
-		if (ses instanceof ExpressionSymbol && !(ses instanceof AggregateSymbol)) {
+		String name = Symbol.getShortName(ses);
+		if (ses instanceof ExpressionSymbol) {
 		    expr = ((ExpressionSymbol)ses).getExpression();
 		}
 		
-		Expression replacement = replaceExpression(expr);
+		Expression replacmentSymbol = replaceExpression(expr);
 		
-		if (replacement instanceof SingleElementSymbol) {
-		    replacmentSymbol = (SingleElementSymbol)replacement;
-		} else {
-		    replacmentSymbol = new ExpressionSymbol(ses.getShortName(), replacement);
+		if (!(replacmentSymbol instanceof Symbol)) {
+			replacmentSymbol = new ExpressionSymbol(name, replacmentSymbol);
+		} else if (alias && createAliases() && !Symbol.getShortName(replacmentSymbol).equals(name)) {
+		    replacmentSymbol = new AliasSymbol(name, replacmentSymbol);
 		}
-		
-		if (alias && createAliases() && !replacmentSymbol.getShortCanonicalName().equals(ses.getShortCanonicalName())) {
-		    replacmentSymbol = new AliasSymbol(ses.getShortName(), replacmentSymbol);
-		}
 		return replacmentSymbol;
 	}
     
@@ -182,12 +143,7 @@
      */
     public void visit(AliasSymbol obj) {
         Expression replacement = replaceExpression(obj.getSymbol());
-        
-        if (replacement instanceof SingleElementSymbol) {
-            obj.setSymbol((SingleElementSymbol)replacement);
-        } else {
-            obj.setSymbol(new ExpressionSymbol(obj.getName(), replacement));
-        }
+        obj.setSymbol(replacement);
     }
     
     public void visit(ExpressionSymbol expr) {
@@ -325,9 +281,7 @@
     }
     
     public void visit(AggregateSymbol obj) {
-    	if (obj.getExpression() != null) {
-    		obj.setExpression(replaceExpression(obj.getExpression()));
-    	}
+    	visit((Function)obj);
     	if (obj.getCondition() != null) { 
     		obj.setCondition(replaceExpression(obj.getCondition()));
     	}
@@ -347,7 +301,7 @@
     
     @Override
     public void visit(OrderByItem obj) {
-    	obj.setSymbol(replaceSymbol(obj.getSymbol(), true));
+    	obj.setSymbol(replaceSymbol(obj.getSymbol(), obj.getExpressionPosition() != -1));
     }
     
     public void visit(Limit obj) {

Modified: trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -588,7 +588,7 @@
 
     @Override
     public void visit( OrderByItem obj ) {
-        SingleElementSymbol ses = obj.getSymbol();
+        Expression ses = obj.getSymbol();
         if (ses instanceof AliasSymbol) {
             AliasSymbol as = (AliasSymbol)ses;
             outputDisplayName(as.getOutputName());
@@ -810,9 +810,9 @@
         }
         beginClause(2);
 
-        Iterator<SelectSymbol> iter = obj.getSymbols().iterator();
+        Iterator<Expression> iter = obj.getSymbols().iterator();
         while (iter.hasNext()) {
-            SelectSymbol symbol = iter.next();
+            Expression symbol = iter.next();
             visitNode(symbol);
             if (iter.hasNext()) {
                 append(", "); //$NON-NLS-1$
@@ -940,7 +940,7 @@
         		append(", "); //$NON-NLS-1$
         	}
             if (obj.displayNamedParameters()) {
-                append(escapeSinglePart(ElementSymbol.getShortName(param.getParameterSymbol().getOutputName())));
+                append(escapeSinglePart(Symbol.getShortName(param.getParameterSymbol().getOutputName())));
                 append(" => "); //$NON-NLS-1$
             }
 
@@ -1189,14 +1189,14 @@
     }
 
     private void outputShortName( ElementSymbol obj ) {
-        outputDisplayName(SingleElementSymbol.getShortName(obj.getOutputName()));
+        outputDisplayName(Symbol.getShortName(obj.getOutputName()));
     }
 
     private void outputDisplayName( String name ) {
         String[] pathParts = name.split("\\."); //$NON-NLS-1$
         for (int i = 0; i < pathParts.length; i++) {
             if (i > 0) {
-                append(ElementSymbol.SEPARATOR);
+                append(Symbol.SEPARATOR);
             }
             append(escapeSinglePart(pathParts[i]));
         }

Modified: trunk/engine/src/main/java/org/teiid/query/tempdata/AlterTempTable.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/tempdata/AlterTempTable.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/tempdata/AlterTempTable.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -27,7 +27,7 @@
 import org.teiid.query.sql.LanguageVisitor;
 import org.teiid.query.sql.lang.Command;
 import org.teiid.query.sql.symbol.ElementSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Expression;
 
 public class AlterTempTable extends Command {
 	
@@ -61,7 +61,7 @@
 	}
 
 	@Override
-	public List<SingleElementSymbol> getProjectedSymbols() {
+	public List<Expression> getProjectedSymbols() {
 		return Command.getUpdateCommandSymbol();
 	}
 

Modified: trunk/engine/src/main/java/org/teiid/query/tempdata/IndexInfo.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/tempdata/IndexInfo.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/tempdata/IndexInfo.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -48,7 +48,7 @@
 import org.teiid.query.sql.lang.SetCriteria;
 import org.teiid.query.sql.symbol.Constant;
 import org.teiid.query.sql.symbol.ElementSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.visitor.ElementCollectorVisitor;
 
 /**
@@ -66,7 +66,7 @@
 	List<Criteria> nonCoveredCriteria = new LinkedList<Criteria>();
 	List<Criteria> coveredCriteria = new LinkedList<Criteria>();
 	
-	public IndexInfo(TempTable table, final List<? extends SingleElementSymbol> projectedCols, final Criteria condition, OrderBy orderBy, boolean primary) {
+	public IndexInfo(TempTable table, final List<? extends Expression> projectedCols, final Criteria condition, OrderBy orderBy, boolean primary) {
 		this.table = table;
 		if (primary || this.table.getColumnMap().keySet().containsAll(projectedCols)) {
 			covering = true;

Modified: trunk/engine/src/main/java/org/teiid/query/tempdata/TempTable.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/tempdata/TempTable.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/tempdata/TempTable.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -25,16 +25,7 @@
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
@@ -70,7 +61,7 @@
 import org.teiid.query.sql.symbol.AggregateSymbol;
 import org.teiid.query.sql.symbol.ElementSymbol;
 import org.teiid.query.sql.symbol.Expression;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.ExpressionSymbol;
 
 /**
  * A Teiid Temp Table
@@ -154,7 +145,7 @@
 		private TupleBrowser browser;
 
 		private QueryTupleSource(TupleBrowser browser, Map map,
-				List<? extends SingleElementSymbol> projectedCols, Criteria condition) {
+				List<? extends Expression> projectedCols, Criteria condition) {
 			this.browser = browser;
 			this.indexes = RelationalNode.getProjectionIndexes(map, projectedCols);
 			this.eval = new Evaluator(map, null, null);
@@ -423,11 +414,11 @@
 		return bm.reserveBuffers(leafBatchSize + (tree.getHeight() - 1)*keyBatchSize, BufferReserveMode.FORCE);
 	}
 
-	public TupleSource createTupleSource(final List<? extends SingleElementSymbol> projectedCols, final Criteria condition, OrderBy orderBy) throws TeiidComponentException, TeiidProcessingException {
+	public TupleSource createTupleSource(final List<? extends Expression> projectedCols, final Criteria condition, OrderBy orderBy) throws TeiidComponentException, TeiidProcessingException {
 		//special handling for count(*)
 		boolean agg = false;
-		for (SingleElementSymbol singleElementSymbol : projectedCols) {
-			if (singleElementSymbol instanceof AggregateSymbol) {
+		for (Expression singleElementSymbol : projectedCols) {
+			if (singleElementSymbol instanceof ExpressionSymbol && ((ExpressionSymbol)singleElementSymbol).getExpression() instanceof AggregateSymbol) {
 				agg = true;
 				break;
 			}
@@ -478,7 +469,7 @@
 	}
 
 	private TupleSource createTupleSource(
-			final List<? extends SingleElementSymbol> projectedCols,
+			final List<? extends Expression> projectedCols,
 			final Criteria condition, OrderBy orderBy, IndexInfo ii, boolean agg)
 			throws TeiidComponentException, TeiidProcessingException {
 		TupleBrowser browser = ii.createTupleBrowser();

Modified: trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -151,7 +151,7 @@
         	if (!group.isTempGroupSymbol()) {
         		return null;
         	}
-        	final String groupKey = group.getNonCorrelationName().toUpperCase();
+        	final String groupKey = group.getNonCorrelationName();
             final TempTable table = contextStore.getOrCreateTempTable(groupKey, command, bufferManager, true, true, context);
         	if (command instanceof Insert) {
         		Insert insert = (Insert)command;
@@ -183,7 +183,7 @@
         }
     	if (command instanceof Create) {
     		Create create = (Create)command;
-    		String tempTableName = create.getTable().getCanonicalName();
+    		String tempTableName = create.getTable().getName();
     		if (contextStore.hasTempTable(tempTableName)) {
                 throw new QueryProcessingException(QueryPlugin.Util.getString("TempTableStore.table_exist_error", tempTableName));//$NON-NLS-1$
             }
@@ -191,13 +191,13 @@
             return CollectionTupleSource.createUpdateCountTupleSource(0);	
     	}
     	if (command instanceof Drop) {
-    		String tempTableName = ((Drop)command).getTable().getCanonicalName();
+    		String tempTableName = ((Drop)command).getTable().getName();
     		contextStore.removeTempTableByName(tempTableName, context);
             return CollectionTupleSource.createUpdateCountTupleSource(0);
     	}
     	if (command instanceof AlterTempTable) {
     		AlterTempTable att = (AlterTempTable)command;
-    		TempTable tt = contextStore.getTempTable(att.getTempTable().toUpperCase());
+    		TempTable tt = contextStore.getTempTable(att.getTempTable());
     		Assertion.isNotNull(tt, "Table doesn't exist"); //$NON-NLS-1$
     		tt.setUpdatable(false);
     		if (att.getIndexColumns() != null && tt.getRowCount() > 2*tt.getTree().getPageSize(true)) {
@@ -349,7 +349,7 @@
 		if (!group.isTempGroupSymbol()) {
 			return null;
 		}
-		final String tableName = group.getNonCorrelationName().toUpperCase();
+		final String tableName = group.getNonCorrelationName();
 		boolean remapColumns = !tableName.equalsIgnoreCase(group.getName());
 		TempTable table = null;
 		if (group.isGlobalTable()) {
@@ -475,14 +475,18 @@
 			String returnElementName, String keyElementName, Object keyValue)
 			throws BlockedException, TeiidComponentException,
 			TeiidProcessingException {
-    	String matTableName = CODE_PREFIX + (codeTableName + ElementSymbol.SEPARATOR + keyElementName + ElementSymbol.SEPARATOR + returnElementName).toUpperCase(); 
+		//we are not using a resolved form of a lookup, so we canonicallize with upper case
+		codeTableName = codeTableName.toUpperCase();
+		keyElementName = keyElementName.toUpperCase();
+		returnElementName = returnElementName.toUpperCase();
+    	String matTableName = CODE_PREFIX + codeTableName + ElementSymbol.SEPARATOR + keyElementName + ElementSymbol.SEPARATOR + returnElementName; 
     	QueryMetadataInterface metadata = context.getMetadata();
 
     	TempMetadataID id = context.getGlobalTableStore().getCodeTableMetadataId(codeTableName,
 				returnElementName, keyElementName, matTableName);
     	
-    	ElementSymbol keyElement = new ElementSymbol(matTableName + ElementSymbol.SEPARATOR + keyElementName);
-    	ElementSymbol returnElement = new ElementSymbol(matTableName + ElementSymbol.SEPARATOR + returnElementName);
+    	ElementSymbol keyElement = new ElementSymbol(keyElementName, new GroupSymbol(matTableName));
+    	ElementSymbol returnElement = new ElementSymbol(returnElementName, new GroupSymbol(matTableName));
     	keyElement.setType(DataTypeManager.getDataTypeClass(metadata.getElementType(metadata.getElementID(codeTableName + ElementSymbol.SEPARATOR + keyElementName))));
     	returnElement.setType(DataTypeManager.getDataTypeClass(metadata.getElementType(metadata.getElementID(codeTableName + ElementSymbol.SEPARATOR + returnElementName))));
     	

Modified: trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableStore.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableStore.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableStore.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -30,6 +30,7 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentSkipListMap;
 
 import javax.transaction.RollbackException;
 import javax.transaction.Status;
@@ -175,8 +176,8 @@
     private Map<String, TempTableSynchronization> synchronizations = new ConcurrentHashMap<String, TempTableSynchronization>();
     private TransactionMode transactionMode = TransactionMode.NONE;
 	
-    private TempMetadataStore tempMetadataStore = new TempMetadataStore(new ConcurrentHashMap<String, TempMetadataID>());
-    private Map<String, TempTable> tempTables = new ConcurrentHashMap<String, TempTable>();
+    private TempMetadataStore tempMetadataStore = new TempMetadataStore(new ConcurrentSkipListMap<String, TempMetadataID>(String.CASE_INSENSITIVE_ORDER));
+    private Map<String, TempTable> tempTables = new ConcurrentSkipListMap<String, TempTable>(String.CASE_INSENSITIVE_ORDER);
     private String sessionID;
     private TempTableStore parentTempTableStore;
     

Modified: trunk/engine/src/main/java/org/teiid/query/validator/UpdateValidator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/validator/UpdateValidator.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/validator/UpdateValidator.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -48,7 +48,6 @@
 import org.teiid.query.sql.symbol.ElementSymbol;
 import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 import org.teiid.query.sql.util.SymbolMap;
 
 /**
@@ -390,10 +389,10 @@
     	
     	updateInfo.view = query;
     	
-    	List<SingleElementSymbol> projectedSymbols = query.getSelect().getProjectedSymbols();
+    	List<Expression> projectedSymbols = query.getSelect().getProjectedSymbols();
     	
     	for (int i = 0; i < projectedSymbols.size(); i++) {
-            SingleElementSymbol symbol = projectedSymbols.get(i);
+            Expression symbol = projectedSymbols.get(i);
             Expression ex = SymbolMap.getExpression(symbol);
             
             if (!metadata.elementSupports(viewSymbols.get(i).getMetadataID(), SupportConstants.Element.UPDATE)) {
@@ -401,7 +400,7 @@
             }
             if (ex instanceof ElementSymbol) {
             	ElementSymbol es = (ElementSymbol)ex;
-            	String groupName = es.getGroupSymbol().getCanonicalName();
+            	String groupName = es.getGroupSymbol().getName();
         		UpdateMapping info = updateInfo.updatableGroups.get(groupName);
         		if (es.getGroupSymbol().getDefinition() != null) {
             		ElementSymbol clone = es.clone();
@@ -447,7 +446,7 @@
 			}
 		} else {
 			for (GroupSymbol groupSymbol : allGroups) {
-				UpdateMapping info = updateInfo.updatableGroups.get(groupSymbol.getCanonicalName());
+				UpdateMapping info = updateInfo.updatableGroups.get(groupSymbol.getName());
 				if (info == null) {
 					continue; // not projected
 				}
@@ -486,7 +485,7 @@
     }
 
     private void setUpdateFlags(GroupSymbol groupSymbol) throws QueryMetadataException, TeiidComponentException {
-    	UpdateMapping info = updateInfo.updatableGroups.get(groupSymbol.getCanonicalName());
+    	UpdateMapping info = updateInfo.updatableGroups.get(groupSymbol.getName());
 
 		if (info == null) {
 			return; // not projected

Modified: trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -227,7 +227,7 @@
     	}
         this.validateRowLimitFunctionNotInInvalidCriteria(obj);
         
-		Collection<SingleElementSymbol> projSymbols = obj.getCommand().getProjectedSymbols();
+		Collection<Expression> projSymbols = obj.getCommand().getProjectedSymbols();
 
 		//Subcommand should have one projected symbol (query with one expression
 		//in SELECT or stored procedure execution that returns a single value).
@@ -358,7 +358,7 @@
     @Override
     public void visit(ScalarSubquery obj) {
     	validateSubquery(obj);
-        Collection<SingleElementSymbol> projSymbols = obj.getCommand().getProjectedSymbols();
+        Collection<Expression> projSymbols = obj.getCommand().getProjectedSymbols();
 
         //Scalar subquery should have one projected symbol (query with one expression
         //in SELECT or stored procedure execution that returns a single value).
@@ -552,7 +552,7 @@
         	AggregateSymbolCollectorVisitor.getAggregates(having, aggs, invalid, null, invalidWindowFunctions, groupSymbols);
         	hasAgg = true;
         }
-        for (SingleElementSymbol symbol : select.getProjectedSymbols()) {
+        for (Expression symbol : select.getProjectedSymbols()) {
         	AggregateSymbolCollectorVisitor.getAggregates(symbol, aggs, invalid, null, null, groupSymbols);                                            
         }
         if ((!aggs.isEmpty() || hasAgg) && !invalid.isEmpty()) {
@@ -708,13 +708,13 @@
      * @since 4.2
      */
     protected void validateSelectInto(Query query) {
-        List<SingleElementSymbol> symbols = query.getSelect().getProjectedSymbols();
+        List<Expression> symbols = query.getSelect().getProjectedSymbols();
         GroupSymbol intoGroup = query.getInto().getGroup();
         validateInto(query, symbols, intoGroup);
     }
 
     private void validateInto(LanguageObject query,
-                                List<SingleElementSymbol> symbols,
+                                List<Expression> symbols,
                                 GroupSymbol intoGroup) {
         try {
             List elementIDs = getMetadata().getElementIDsInGroupID(intoGroup.getMetadataID());
@@ -726,7 +726,7 @@
             }
             
             for (int symbolNum = 0; symbolNum < symbols.size(); symbolNum++) {
-                SingleElementSymbol symbol = symbols.get(symbolNum);
+                Expression symbol = symbols.get(symbolNum);
                 Object elementID = elementIDs.get(symbolNum);
                 // Check if supports updates
                 if (!getMetadata().elementSupports(elementID, SupportConstants.Element.UPDATE)) {

Modified: trunk/engine/src/main/java/org/teiid/query/validator/Validator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/validator/Validator.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/java/org/teiid/query/validator/Validator.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -23,7 +23,6 @@
 package org.teiid.query.validator;
 
 import java.util.Iterator;
-import java.util.Map;
 
 import org.teiid.core.TeiidComponentException;
 import org.teiid.query.metadata.QueryMetadataInterface;
@@ -107,9 +106,9 @@
 		if (obj instanceof Command) {
 			Command command = (Command)obj;
 			visitor.currentCommand = command;
-            Map tempMetadata = command.getTemporaryMetadata();
-            if(tempMetadata != null && !tempMetadata.isEmpty()) {
-            	visitor.setMetadata(new TempMetadataAdapter(metadata, new TempMetadataStore(tempMetadata)));
+			TempMetadataStore tempMetadata = command.getTemporaryMetadata();
+            if(tempMetadata != null && !tempMetadata.getData().isEmpty()) {
+            	visitor.setMetadata(new TempMetadataAdapter(metadata, tempMetadata));
             }    
 		}
 	}

Modified: trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj
===================================================================
--- trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj	2011-12-14 22:19:17 UTC (rev 3740)
@@ -1713,7 +1713,7 @@
 Select select(ParseInfo info) :
 {
 	boolean isDistinct = false;		// unless DISTINCT keyword in SELECT
-	SelectSymbol symbol = null;
+	Expression symbol = null;
 	Select select = new Select();
 }
 {
@@ -1736,9 +1736,9 @@
 	}
 }
 
-SelectSymbol selectSymbol(ParseInfo info) :
+Expression selectSymbol(ParseInfo info) :
 {
-	SelectSymbol symbol = null;	
+	Expression symbol = null;	
 }
 {
 	(
@@ -1751,7 +1751,7 @@
 	}
 }
 
-SingleElementSymbol selectExpression(ParseInfo info) :
+Expression selectExpression(ParseInfo info) :
 {
 	Expression expression = null;
     String alias = null;
@@ -1763,18 +1763,11 @@
 		[[<AS>] alias=id() ]
 	)
 	{		
-		SingleElementSymbol es = null;
-		if(!(expression instanceof SingleElementSymbol)) {
-			String functionName = generateFunctionName(info, null);
-			es = new ExpressionSymbol(functionName, expression);
-		} else {
-		    es = (SingleElementSymbol)expression;
-		}
 		if(alias != null) {
 			alias = validateAlias(alias); 
-			return new AliasSymbol(alias, es);
+			return new AliasSymbol(alias, expression);
 		}
-		return es;
+		return expression;
 	}
 }
 
@@ -1825,8 +1818,7 @@
 	condition = filterClause(info)
 	{
 		String aggName = t.image.toUpperCase();
-		String name = generateFunctionName(info, aggName);
-		AggregateSymbol	agg = new AggregateSymbol(name, aggName, false, expression);
+		AggregateSymbol	agg = new AggregateSymbol(aggName, aggName, false, expression);
 		agg.setOrderBy(orderBy);
 		agg.setCondition(condition);
 		return agg;
@@ -1884,8 +1876,7 @@
 		tf.setIncludeHeader(header);
 		tf.setExpressions(expressions);
 		tf.setEncoding(encoding);
-        String name = generateFunctionName(info, "TEXTAGG");
-		AggregateSymbol agg = new AggregateSymbol(name, "TEXTAGG", false, tf);
+		AggregateSymbol agg = new AggregateSymbol("TEXTAGG", "TEXTAGG", false, tf);
 		agg.setOrderBy(orderBy);
 		agg.setCondition(condition);
 		return agg;		
@@ -1927,13 +1918,12 @@
 	)
 	{
 		func = func.toUpperCase();
-		String name = generateFunctionName(info, func);
 		if(starToken == null) { 
 			// Aggregate
-			agg = new AggregateSymbol(name, func, isDistinct, expression);
+			agg = new AggregateSymbol(func, func, isDistinct, expression);
 		} else {
 			// COUNT(*)			
-			agg = new AggregateSymbol(name, func, false, null);
+			agg = new AggregateSymbol(func, func, false, null);
 		}
 		agg.setCondition(condition);
 		return agg;
@@ -2976,7 +2966,7 @@
 
 OrderByItem sortSpecification(ParseInfo info) :
 {
-    SingleElementSymbol ex = null;
+    Expression ex = null;
     boolean ascending = true;
     String nullOrdering = null;    
 }
@@ -2993,7 +2983,7 @@
 	}
 }
 
-SingleElementSymbol sortKey(ParseInfo info) :
+Expression sortKey(ParseInfo info) :
 {
     Expression ex = null;
 }
@@ -3012,11 +3002,7 @@
             	throw new ParseException(QueryPlugin.Util.getString("SQLParser.non_position_constant", ex)); //$NON-NLS-1$
             }
         } 
-        if(ex instanceof ElementSymbol) {
-            return (ElementSymbol)ex;
-        } 
-        String exprName = generateFunctionName(info, null);
-        return new ExpressionSymbol(exprName, ex);
+        return ex;
     }
 }
 
@@ -3380,10 +3366,7 @@
     [orderBy = orderby(info)]
     <RPAREN>
     {
-        String aggName = "win_" + ((AggregateSymbol)agg).getName();
-		String name = generateFunctionName(info, aggName);
-        
-    	WindowFunction result = new WindowFunction(aggName);
+    	WindowFunction result = new WindowFunction();
     	WindowSpecification ws = new WindowSpecification();
     	result.setFunction((AggregateSymbol)agg);
     	ws.setPartition(partitionList);

Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestScalarSubqueryImpl.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestScalarSubqueryImpl.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestScalarSubqueryImpl.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -27,7 +27,7 @@
 import org.teiid.language.ScalarSubquery;
 import org.teiid.language.Select;
 import org.teiid.query.sql.lang.Query;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Expression;
 
 
 /**
@@ -45,7 +45,7 @@
     public static org.teiid.query.sql.symbol.ScalarSubquery helpExample() {
         Query query = TestQueryImpl.helpExample(true);
         org.teiid.query.sql.symbol.ScalarSubquery ss = new org.teiid.query.sql.symbol.ScalarSubquery(query);
-        ss.setType(((SingleElementSymbol)query.getProjectedSymbols().get(0)).getType());
+        ss.setType(((Expression)query.getProjectedSymbols().get(0)).getType());
         return ss;
     }
     

Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestMetaDataProcessor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestMetaDataProcessor.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestMetaDataProcessor.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -51,9 +51,6 @@
 import org.teiid.query.sql.lang.Command;
 import org.teiid.query.unittest.RealMetadataFactory;
 
-
-/**
- */
 @SuppressWarnings({"nls", "unchecked"})
 public class TestMetaDataProcessor {
 	
@@ -89,7 +86,7 @@
     }
     
     @Test public void testSimpleQuery() throws Exception {
-        Map[] metadata = helpGetMetadata("SELECT e1 FROM pm1.g1", RealMetadataFactory.example1Cached(), RealMetadataFactory.example1VDB()); //$NON-NLS-1$
+        Map[] metadata = helpGetMetadata("SELECT pm1.g1.e1 FROM pm1.g1", RealMetadataFactory.example1Cached(), RealMetadataFactory.example1VDB()); //$NON-NLS-1$
         assertNotNull(metadata);
         assertEquals(1, metadata.length);
         assertEquals("e1", metadata[0].get(ResultsMetadataConstants.ELEMENT_NAME)); //$NON-NLS-1$
@@ -185,7 +182,7 @@
         MetadataResult response = helpTestQuery(metadata, sql, TestMetaDataProcessor.examplePrivatePhysicalModelVDB());
         helpCheckNumericAttributes(response, 0, 21, 19, 4);
         assertEquals("e1", response.getColumnMetadata()[0].get(ResultsMetadataConstants.ELEMENT_NAME)); //$NON-NLS-1$
-        assertEquals("win_min", response.getColumnMetadata()[0].get(ResultsMetadataConstants.ELEMENT_LABEL)); //$NON-NLS-1$
+        assertEquals("expr1", response.getColumnMetadata()[0].get(ResultsMetadataConstants.ELEMENT_LABEL)); //$NON-NLS-1$
     }
 
     @Test public void testMetadataGenerationForAllTypes() throws Exception {

Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourceMetadataWrapper.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourceMetadataWrapper.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourceMetadataWrapper.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -29,7 +29,7 @@
 import junit.framework.TestCase;
 
 import org.teiid.core.types.DataTypeManager;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Symbol;
 import org.teiid.query.unittest.RealMetadataFactory;
 
 
@@ -69,7 +69,7 @@
         assertEquals(0, wrapper.getPrecision(instanceElementID));
         assertEquals(0, wrapper.getScale(instanceElementID));
         assertEquals(0, wrapper.getRadix(instanceElementID));
-        assertEquals(MultiSourceElement.MULTI_SOURCE_ELEMENT_NAME, SingleElementSymbol.getShortName(fullName));
-        assertEquals(fullName, wrapper.getFullName(groupID) + SingleElementSymbol.SEPARATOR + MultiSourceElement.MULTI_SOURCE_ELEMENT_NAME);
+        assertEquals(MultiSourceElement.MULTI_SOURCE_ELEMENT_NAME, Symbol.getShortName(fullName));
+        assertEquals(fullName, wrapper.getFullName(groupID) + Symbol.SEPARATOR + MultiSourceElement.MULTI_SOURCE_ELEMENT_NAME);
     }
 }

Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -27,7 +27,6 @@
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
-import java.util.Properties;
 import java.util.Set;
 
 import org.junit.Test;
@@ -84,7 +83,7 @@
 
     private static final boolean DEBUG = false;
     
-    public void helpTestMultiSourcePlan(QueryMetadataInterface metadata, String userSql, String multiModel, int sourceCount, ProcessorDataManager dataMgr, List[] expectedResults, VDBMetaData vdb) throws Exception {
+    public void helpTestMultiSourcePlan(QueryMetadataInterface metadata, String userSql, String multiModel, int sourceCount, ProcessorDataManager dataMgr, List<?>[] expectedResults, VDBMetaData vdb) throws Exception {
         
        DQPWorkContext dqpContext = RealMetadataFactory.buildWorkContext(metadata, vdb);
      
@@ -113,7 +112,6 @@
         
         IDGenerator idGenerator = new IDGenerator();
         
-        Properties props = new Properties();
         CommandContext context = new CommandContext("0", "test", "user", null, vdb.getName(), vdb.getVersion(), false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
         context.setPlanToProcessConverter(new MultiSourcePlanToProcessConverter(metadata, idGenerator, analysis, finder, multiSourceModels, dqpContext, context));
 
@@ -132,7 +130,7 @@
         final String userSql = "SELECT * FROM MultiModel.Phys WHERE SOURCE_NAME = 'bogus'"; //$NON-NLS-1$
         final String multiModel = "MultiModel"; //$NON-NLS-1$
         final int sources = 2;
-        final List[] expected = 
+        final List<?>[] expected = 
             new List[0];
         final ProcessorDataManager dataMgr = new MultiSourceDataManager();
         helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
@@ -143,8 +141,8 @@
         final String userSql = "SELECT * FROM MultiModel.Phys WHERE SOURCE_NAME = 'a'"; //$NON-NLS-1$
         final String multiModel = "MultiModel"; //$NON-NLS-1$
         final int sources = 2;
-        final List[] expected = 
-            new List[] { Arrays.asList(new Object[] { null, null, null}) };
+        final List<?>[] expected = 
+            new List<?>[] { Arrays.asList(new Object[] { null, null, null}) };
         final HardcodedDataManager dataMgr = new MultiSourceDataManager();
         dataMgr.setMustRegisterCommands(false);
         helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
@@ -155,8 +153,8 @@
         final String userSql = "SELECT * FROM MultiModel.Phys"; //$NON-NLS-1$
         final String multiModel = "MultiModel"; //$NON-NLS-1$
         final int sources = 3;
-        final List[] expected = 
-            new List[] { Arrays.asList(new Object[] { null, null, null}),
+        final List<?>[] expected = 
+            new List<?>[] { Arrays.asList(new Object[] { null, null, null}),
                          Arrays.asList(new Object[] { null, null, null}),
                          Arrays.asList(new Object[] { null, null, null})};
         final ProcessorDataManager dataMgr = new MultiSourceDataManager();
@@ -169,7 +167,7 @@
         final String userSql = "SELECT * FROM MultiModel.Phys order by a"; //$NON-NLS-1$
         final String multiModel = "MultiModel"; //$NON-NLS-1$
         final int sources = 2;
-        final List[] expected = new List[] {
+        final List<?>[] expected = new List<?>[] {
             Arrays.asList("e", "z", "b"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             Arrays.asList("f", "z", "b"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             Arrays.asList("x", "z", "a"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -177,11 +175,11 @@
         };
         final HardcodedDataManager dataMgr = new HardcodedDataManager();
         dataMgr.addData("SELECT g_0.a, g_0.b, 'a' FROM MultiModel.Phys AS g_0", //$NON-NLS-1$
-                        new List[] {
+                        new List<?>[] {
                             Arrays.asList("y", "z", "a"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                             Arrays.asList("x", "z", "a")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
         dataMgr.addData("SELECT g_0.a, g_0.b, 'b' FROM MultiModel.Phys AS g_0", //$NON-NLS-1$
-                        new List[] {
+                        new List<?>[] {
                             Arrays.asList("e", "z", "b"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                             Arrays.asList("f", "z", "b")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
         helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
@@ -192,16 +190,16 @@
         final String userSql = "SELECT distinct * FROM MultiModel.Phys order by a limit 1"; //$NON-NLS-1$
         final String multiModel = "MultiModel"; //$NON-NLS-1$
         final int sources = 2;
-        final List[] expected = new List[] {
+        final List<?>[] expected = new List<?>[] {
             Arrays.asList("e", "z", "b"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
         };
         final HardcodedDataManager dataMgr = new HardcodedDataManager();
         dataMgr.addData("SELECT g_0.a, g_0.b, 'a' FROM MultiModel.Phys AS g_0", //$NON-NLS-1$
-                        new List[] {
+                        new List<?>[] {
                             Arrays.asList("y", "z", "a"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                             Arrays.asList("x", "z", "a")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
         dataMgr.addData("SELECT g_0.a, g_0.b, 'b' FROM MultiModel.Phys AS g_0", //$NON-NLS-1$
-                        new List[] {
+                        new List<?>[] {
                             Arrays.asList("e", "z", "b"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                             Arrays.asList("f", "z", "b")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
         helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
@@ -213,8 +211,8 @@
         final String userSql = "SELECT a.a FROM MultiModel.Phys a inner join MultiModel.Phys b makedep on (a.a = b.a) order by a"; //$NON-NLS-1$
         final String multiModel = "MultiModel"; //$NON-NLS-1$
         final int sources = 2;
-        final List[] expected = 
-            new List[] { Arrays.asList(new Object[] { "x"}), //$NON-NLS-1$
+        final List<?>[] expected = 
+            new List<?>[] { Arrays.asList(new Object[] { "x"}), //$NON-NLS-1$
                          Arrays.asList(new Object[] { "x"}), //$NON-NLS-1$
                          Arrays.asList(new Object[] { "x"}), //$NON-NLS-1$
                          Arrays.asList(new Object[] { "x"}), //$NON-NLS-1$
@@ -225,10 +223,10 @@
                          
         final HardcodedDataManager dataMgr = new HardcodedDataManager();
         dataMgr.addData("SELECT g_0.a FROM MultiModel.Phys AS g_0",  //$NON-NLS-1$
-                        new List[] { Arrays.asList(new Object[] { "x" }), //$NON-NLS-1$
+                        new List<?>[] { Arrays.asList(new Object[] { "x" }), //$NON-NLS-1$
                                      Arrays.asList(new Object[] { "y" })}); //$NON-NLS-1$
         dataMgr.addData("SELECT g_0.a FROM MultiModel.Phys AS g_0 WHERE g_0.a IN ('x', 'y')",  //$NON-NLS-1$
-                        new List[] { Arrays.asList(new Object[] { "x" }), //$NON-NLS-1$
+                        new List<?>[] { Arrays.asList(new Object[] { "x" }), //$NON-NLS-1$
                                      Arrays.asList(new Object[] { "y" })}); //$NON-NLS-1$
         helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
     }
@@ -238,7 +236,7 @@
         final String userSql = "exec Virt.sq1('a')"; //$NON-NLS-1$
         final String multiModel = "MultiModel"; //$NON-NLS-1$
         final int sources = 3;
-        final List[] expected = new List[] { Arrays.asList(new Object[] { null, null}), };
+        final List<?>[] expected = new List<?>[] { Arrays.asList(new Object[] { null, null}), };
         final ProcessorDataManager dataMgr = new MultiSourceDataManager();
         helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
     }
@@ -248,7 +246,7 @@
         final String userSql = "exec Virt.sq1(null)"; //$NON-NLS-1$
         final String multiModel = "MultiModel"; //$NON-NLS-1$
         final int sources = 3;
-        final List[] expected = new List[0];
+        final List<?>[] expected = new List[0];
         final ProcessorDataManager dataMgr = new MultiSourceDataManager();
         helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
     }
@@ -258,10 +256,10 @@
         final String userSql = "update MultiModel.Phys set a = '1' where b = 'z'"; //$NON-NLS-1$
         final String multiModel = "MultiModel"; //$NON-NLS-1$
         final int sources = 3;
-        final List[] expected = new List[] { Arrays.asList(3)};
+        final List<?>[] expected = new List<?>[] { Arrays.asList(3)};
         final MultiSourceDataManager dataMgr = new MultiSourceDataManager();
         dataMgr.setMustRegisterCommands(true);
-        dataMgr.addData("UPDATE MultiModel.Phys SET a = '1' WHERE b = 'z'", new List[] {Arrays.asList(1)}); //$NON-NLS-1$
+        dataMgr.addData("UPDATE MultiModel.Phys SET a = '1' WHERE b = 'z'", new List<?>[] {Arrays.asList(1)}); //$NON-NLS-1$
         helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
     }
     
@@ -270,10 +268,10 @@
         final String userSql = "INSERT INTO MultiModel.Phys(a, SOURCE_NAME) VALUES ('a', 'a')"; //$NON-NLS-1$
         final String multiModel = "MultiModel"; //$NON-NLS-1$
         final int sources = 3;
-        final List[] expected = new List[] { Arrays.asList(1)};
+        final List<?>[] expected = new List<?>[] { Arrays.asList(1)};
         final MultiSourceDataManager dataMgr = new MultiSourceDataManager();
         dataMgr.setMustRegisterCommands(true);
-        dataMgr.addData("INSERT INTO MultiModel.Phys (a) VALUES ('a')", new List[] {Arrays.asList(1)}); //$NON-NLS-1$
+        dataMgr.addData("INSERT INTO MultiModel.Phys (a) VALUES ('a')", new List<?>[] {Arrays.asList(1)}); //$NON-NLS-1$
         helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
     }
     
@@ -282,7 +280,7 @@
         final String userSql = "INSERT INTO MultiModel.Phys(a, SOURCE_NAME) VALUES ('a', 'x')"; //$NON-NLS-1$
         final String multiModel = "MultiModel"; //$NON-NLS-1$
         final int sources = 3;
-        final List[] expected = new List[] { Arrays.asList(0)};
+        final List<?>[] expected = new List<?>[] { Arrays.asList(0)};
         final MultiSourceDataManager dataMgr = new MultiSourceDataManager();
         dataMgr.setMustRegisterCommands(true);
         helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
@@ -293,10 +291,10 @@
         final String userSql = "INSERT INTO MultiModel.Phys(a) VALUES ('a')"; //$NON-NLS-1$
         final String multiModel = "MultiModel"; //$NON-NLS-1$
         final int sources = 3;
-        final List[] expected = new List[] { Arrays.asList(3)};
+        final List<?>[] expected = new List<?>[] { Arrays.asList(3)};
         final MultiSourceDataManager dataMgr = new MultiSourceDataManager();
         dataMgr.setMustRegisterCommands(true);
-        dataMgr.addData("INSERT INTO MultiModel.Phys (a) VALUES ('a')", new List[] {Arrays.asList(1)}); //$NON-NLS-1$
+        dataMgr.addData("INSERT INTO MultiModel.Phys (a) VALUES ('a')", new List<?>[] {Arrays.asList(1)}); //$NON-NLS-1$
         helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
     }
     
@@ -305,10 +303,10 @@
         final String userSql = "exec MultiModel.proc('b', 'a')"; //$NON-NLS-1$
         final String multiModel = "MultiModel"; //$NON-NLS-1$
         final int sources = 3;
-        final List[] expected = new List[] { Arrays.asList(1)};
+        final List<?>[] expected = new List<?>[] { Arrays.asList(1)};
         final MultiSourceDataManager dataMgr = new MultiSourceDataManager();
         dataMgr.setMustRegisterCommands(true);
-        dataMgr.addData("EXEC MultiModel.proc('b')", new List[] {Arrays.asList(1)}); //$NON-NLS-1$
+        dataMgr.addData("EXEC MultiModel.proc('b')", new List<?>[] {Arrays.asList(1)}); //$NON-NLS-1$
         helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
     }
     
@@ -317,10 +315,10 @@
         final String userSql = "exec MultiModel.proc(\"in\"=>'b')"; //$NON-NLS-1$
         final String multiModel = "MultiModel"; //$NON-NLS-1$
         final int sources = 3;
-        final List[] expected = new List[] { Arrays.asList(1), Arrays.asList(1), Arrays.asList(1)};
+        final List<?>[] expected = new List<?>[] { Arrays.asList(1), Arrays.asList(1), Arrays.asList(1)};
         final MultiSourceDataManager dataMgr = new MultiSourceDataManager();
         dataMgr.setMustRegisterCommands(true);
-        dataMgr.addData("EXEC MultiModel.proc('b')", new List[] {Arrays.asList(1)}); //$NON-NLS-1$
+        dataMgr.addData("EXEC MultiModel.proc('b')", new List<?>[] {Arrays.asList(1)}); //$NON-NLS-1$
         helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
     }
 

Modified: trunk/engine/src/test/java/org/teiid/dqp/service/AutoGenDataService.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/service/AutoGenDataService.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/dqp/service/AutoGenDataService.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -41,7 +41,7 @@
 import org.teiid.query.optimizer.TestOptimizer;
 import org.teiid.query.optimizer.capabilities.SourceCapabilities;
 import org.teiid.query.processor.relational.RelationalNodeUtil;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Expression;
 import org.teiid.translator.DataNotAvailableException;
 import org.teiid.translator.TranslatorException;
 
@@ -180,7 +180,7 @@
             List row = new ArrayList();        
             Iterator iter = symbols.iterator();
             while(iter.hasNext()) {
-                SingleElementSymbol symbol = (SingleElementSymbol) iter.next();
+                Expression symbol = (Expression) iter.next();
                 Class type = symbol.getType();
                 row.add( getValue(type, i) );
             }

Modified: trunk/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -22,15 +22,16 @@
 
 package org.teiid.query.metadata;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.*;
 
-import java.util.*;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
 
 import org.jboss.vfs.VFS;
-import org.jboss.vfs.VirtualFile;
 import org.junit.Test;
-import org.mockito.Mockito;
 import org.teiid.adminapi.Model;
 import org.teiid.adminapi.impl.ModelMetaData;
 import org.teiid.adminapi.impl.VDBMetaData;

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -105,7 +105,7 @@
         
         String sql = "SELECT a12.intkey, MAX(a12.stringkey), MIN(a11.intnum+a12.intnum) FROM bqt1.smalla AS a11 INNER JOIN bqt2.smalla AS a12 ON a11.stringkey = a12.stringkey GROUP BY a12.intkey"; //$NON-NLS-1$
         ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), null, capFinder, 
-                                      new String[] {"SELECT g_0.stringkey, g_0.intkey, g_0.intnum FROM bqt2.smalla AS g_0 GROUP BY g_0.stringkey, g_0.intkey, g_0.intnum", "SELECT g_0.stringkey, g_0.intnum FROM bqt1.smalla AS g_0"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$ 
+                                      new String[] {"SELECT g_0.stringkey, g_0.intkey, g_0.intnum FROM BQT2.SmallA AS g_0 GROUP BY g_0.stringkey, g_0.intkey, g_0.intnum", "SELECT g_0.stringkey, g_0.intnum FROM BQT1.SmallA AS g_0"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$ 
         
         TestOptimizer.checkNodeTypes(plan, new int[] {
             2,      // Access
@@ -136,7 +136,7 @@
         
         String sql = "SELECT a12.intkey, MAX(a12.stringkey), SUM(a11.intnum+a12.intnum) FROM bqt1.smalla AS a11 INNER JOIN bqt2.smalla AS a12 ON a11.stringkey = a12.stringkey GROUP BY a12.intkey"; //$NON-NLS-1$
         ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), null, capFinder, 
-                                      new String[] {"SELECT g_0.stringkey, g_0.intkey, g_0.intnum FROM bqt2.smalla AS g_0", "SELECT g_0.stringkey, g_0.intnum FROM bqt1.smalla AS g_0"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$ 
+                                      new String[] {"SELECT g_0.stringkey, g_0.intkey, g_0.intnum FROM BQT2.SmallA AS g_0", "SELECT g_0.stringkey, g_0.intnum FROM BQT1.SmallA AS g_0"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$ 
         
         TestOptimizer.checkNodeTypes(plan, new int[] {
             2,      // Access
@@ -203,7 +203,7 @@
         String sql = "select sum(a11.intnum) Profit, (sum(a11.intnum) / sum(a11.floatnum)) WJXBFS2 from bqt1.smalla a11 join bqt2.smallb a12 on a11.intkey=a12.intkey group by a12.intkey"; //$NON-NLS-1$
         
         ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), null, capFinder, 
-                                      new String[] {"SELECT g_0.intkey, SUM(g_0.intnum), SUM(g_0.floatnum) FROM bqt1.smalla AS g_0 GROUP BY g_0.intkey", "SELECT g_0.intkey FROM bqt2.smallb AS g_0"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$ 
+                                      new String[] {"SELECT g_0.intkey, SUM(g_0.intnum), SUM(g_0.floatnum) FROM BQT1.SmallA AS g_0 GROUP BY g_0.intkey", "SELECT g_0.intkey FROM BQT2.SmallB AS g_0"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$ 
         
         TestOptimizer.checkNodeTypes(plan, new int[] {
             2,      // Access
@@ -520,7 +520,7 @@
         String sql = "select a11.intkey ITEM_ID, sum(a11.intnum) WJXBFS1 from bqt1.smalla a11 join bqt2.smalla a12 on (a11.stringkey = a12.stringkey) join bqt2.smallb a13 on (a11.intkey = a13.intkey) where a13.intnum in (10) group by a11.intkey"; //$NON-NLS-1$
         
         ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), null, capFinder, 
-                                      new String[] {"SELECT g_0.stringkey FROM bqt2.smalla AS g_0", "SELECT g_0.stringkey, g_0.intkey, SUM(g_0.intnum) FROM bqt1.smalla AS g_0 GROUP BY g_0.stringkey, g_0.intkey", "SELECT g_0.intkey FROM bqt2.smallb AS g_0 WHERE g_0.intnum = 10"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 
+                                      new String[] {"SELECT g_0.stringkey, g_0.intkey, SUM(g_0.intnum) FROM BQT1.SmallA AS g_0 GROUP BY g_0.stringkey, g_0.intkey", "SELECT g_0.stringkey FROM BQT2.SmallA AS g_0", "SELECT g_0.intkey FROM BQT2.SmallB AS g_0 WHERE g_0.intnum = 10"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 
         
         TestOptimizer.checkNodeTypes(plan, new int[] {
             3,      // Access
@@ -573,7 +573,7 @@
               "select stringkey, max(intkey) from bqt1.smalla group by stringkey having count(intkey) = 1",  //$NON-NLS-1$
               metadata, null, capFinder,
               new String[] { 
-                "SELECT COUNT(g_0.intkey), g_0.stringkey, MAX(g_0.intkey) FROM bqt1.smalla AS g_0 GROUP BY g_0.stringkey"},  //$NON-NLS-1$
+                "SELECT COUNT(g_0.intkey), g_0.stringkey, MAX(g_0.intkey) FROM BQT1.SmallA AS g_0 GROUP BY g_0.stringkey"},  //$NON-NLS-1$
                 ComparisonMode.EXACT_COMMAND_STRING); 
                   
         TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -692,9 +692,9 @@
         ProcessorPlan plan = helpPlan(sql,  
                                       metadata,
                                       null, capFinder,
-                                      new String[] {"SELECT g_0.\"MONTH\" AS c_0, g_0.\"YEAR\" AS c_1 FROM msModel.\"TIME\" AS g_0 WHERE g_0.\"YEAR\" = '1999' ORDER BY c_0", //$NON-NLS-1$
-                                                    "SELECT g_0.\"MONTH\" AS c_0, g_0.CITY AS c_1, SUM(g_0.SALES) AS c_2 FROM db2model.SALES AS g_0 WHERE (g_0.\"MONTH\" IN (<dependent values>)) AND (g_0.CITY IN (<dependent values>)) GROUP BY g_0.\"MONTH\", g_0.CITY ORDER BY c_0", //$NON-NLS-1$ 
-                                                    "SELECT g_0.CITY AS c_0, g_0.REGION AS c_1 FROM oraclemodel.GEOGRAPHY AS g_0 WHERE g_0.REGION IN ('BORDEAUX', 'POLINESIA') ORDER BY c_0"},  //$NON-NLS-1$
+                                      new String[] {"SELECT g_0.\"MONTH\" AS c_0, g_0.\"YEAR\" AS c_1 FROM msmodel.\"TIME\" AS g_0 WHERE g_0.\"YEAR\" = '1999' ORDER BY c_0", 
+        		"SELECT g_0.\"MONTH\" AS c_0, g_0.CITY AS c_1, SUM(g_0.SALES) AS c_2 FROM db2model.SALES AS g_0 WHERE (g_0.\"MONTH\" IN (<dependent values>)) AND (g_0.CITY IN (<dependent values>)) GROUP BY g_0.\"MONTH\", g_0.CITY ORDER BY c_0", 
+        		"SELECT g_0.CITY AS c_0, g_0.REGION AS c_1 FROM oraclemodel.GEOGRAPHY AS g_0 WHERE g_0.REGION IN ('BORDEAUX', 'POLINESIA') ORDER BY c_0"},  //$NON-NLS-1$
                                       ComparisonMode.EXACT_COMMAND_STRING );
 
         checkNodeTypes(plan, new int[] {
@@ -740,9 +740,9 @@
         ProcessorPlan plan = helpPlan(sql,  
                                       metadata,
                                       null, capFinder,
-                                      new String[] {"SELECT g_0.\"MONTH\" AS c_0, g_0.\"YEAR\" AS c_1 FROM msModel.\"TIME\" AS g_0 WHERE g_0.\"YEAR\" = '1999' ORDER BY c_0", //$NON-NLS-1$
-                                          "SELECT g_0.\"MONTH\" AS c_0, g_0.CITY AS c_1, SUM(g_0.SALES) AS c_2 FROM db2model.SALES AS g_0 WHERE (g_0.\"MONTH\" IN (<dependent values>)) AND (g_0.CITY IN (<dependent values>)) GROUP BY g_0.\"MONTH\", g_0.CITY ORDER BY c_0", //$NON-NLS-1$ 
-                                          "SELECT g_0.CITY AS c_0, g_0.REGION AS c_1 FROM oraclemodel.GEOGRAPHY AS g_0 WHERE g_0.REGION IN ('BORDEAUX', 'POLINESIA') ORDER BY c_0"},  //$NON-NLS-1$
+                                      new String[] {"SELECT g_0.\"MONTH\" AS c_0, g_0.\"YEAR\" AS c_1 FROM msmodel.\"TIME\" AS g_0 WHERE g_0.\"YEAR\" = '1999' ORDER BY c_0", 
+        		"SELECT g_0.\"MONTH\" AS c_0, g_0.CITY AS c_1, SUM(g_0.SALES) AS c_2 FROM db2model.SALES AS g_0 WHERE (g_0.\"MONTH\" IN (<dependent values>)) AND (g_0.CITY IN (<dependent values>)) GROUP BY g_0.\"MONTH\", g_0.CITY ORDER BY c_0", 
+        		"SELECT g_0.CITY AS c_0, g_0.REGION AS c_1 FROM oraclemodel.GEOGRAPHY AS g_0 WHERE g_0.REGION IN ('BORDEAUX', 'POLINESIA') ORDER BY c_0"},  //$NON-NLS-1$
                                       ComparisonMode.EXACT_COMMAND_STRING );
 
         checkNodeTypes(plan, new int[] {
@@ -788,8 +788,8 @@
         ProcessorPlan plan = helpPlan(sql,  
                                       metadata,
                                       null, capFinder,
-                                      new String[] {"SELECT g_0.\"MONTH\" AS c_0, g_1.REGION AS c_1, SUM(g_0.SALES) AS c_2 FROM db2model.SALES AS g_0, db2model.GEOGRAPHY2 AS g_1 WHERE (g_0.CITY = g_1.CITY) AND (g_1.REGION IN ('BORDEAUX', 'POLINESIA')) AND (g_0.\"MONTH\" IN (<dependent values>)) GROUP BY g_0.\"MONTH\", g_1.REGION ORDER BY c_0", //$NON-NLS-1$ 
-                                                    "SELECT g_0.\"MONTH\" AS c_0, g_0.\"YEAR\" AS c_1 FROM msModel.\"TIME\" AS g_0 WHERE g_0.\"YEAR\" = '1999' ORDER BY c_0"},  //$NON-NLS-1$
+                                      new String[] {"SELECT g_0.\"MONTH\" AS c_0, g_0.\"YEAR\" AS c_1 FROM msmodel.\"TIME\" AS g_0 WHERE g_0.\"YEAR\" = '1999' ORDER BY c_0", 
+        		"SELECT g_0.\"MONTH\" AS c_0, g_1.REGION AS c_1, SUM(g_0.SALES) AS c_2 FROM db2model.SALES AS g_0, db2model.GEOGRAPHY2 AS g_1 WHERE (g_0.CITY = g_1.CITY) AND (g_1.REGION IN ('BORDEAUX', 'POLINESIA')) AND (g_0.\"MONTH\" IN (<dependent values>)) GROUP BY g_0.\"MONTH\", g_1.REGION ORDER BY c_0"},  //$NON-NLS-1$
                                                     ComparisonMode.EXACT_COMMAND_STRING );
 
         checkNodeTypes(plan, new int[] {
@@ -1056,7 +1056,7 @@
         capFinder.addCapabilities("pm2", getAggregateCapabilities()); //$NON-NLS-1$
         
         ProcessorPlan plan = TestOptimizer.helpPlan("select max(e2), case when e1 is null then 0 else 1 end from (select e1, e2 from pm1.g1 union all select e1, e2 from pm2.g2) z group by case when e1 is null then 0 else 1 end", RealMetadataFactory.example1Cached(), null, capFinder,  //$NON-NLS-1$
-            new String[]{"SELECT v_1.c_1, MAX(v_1.c_0) FROM (SELECT v_0.c_1 AS c_0, CASE WHEN v_0.c_0 IS NULL THEN 0 ELSE 1 END AS c_1 FROM (SELECT g_0.e1 AS c_0, g_0.e2 AS c_1 FROM pm1.g1 AS g_0) AS v_0) AS v_1 GROUP BY v_1.c_1", //$NON-NLS-1$
+            new String[]{"SELECT v_1.c_0, MAX(v_1.c_1) FROM (SELECT CASE WHEN v_0.c_0 IS NULL THEN 0 ELSE 1 END AS c_0, v_0.c_1 FROM (SELECT g_0.e1 AS c_0, g_0.e2 AS c_1 FROM pm1.g1 AS g_0) AS v_0) AS v_1 GROUP BY v_1.c_0", //$NON-NLS-1$
         	"SELECT g_0.e1, g_0.e2 FROM pm2.g2 AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
         TestOptimizer.checkNodeTypes(plan, new int[] {
             2,      // Access
@@ -1083,8 +1083,8 @@
         capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
         
         ProcessorPlan plan = TestOptimizer.helpPlan("select max(e2), case when e1 is null then 0 else 1 end from (select e1, e2, 1 as part from pm1.g1 union all select e1, e2, 2 as part from pm1.g2) z group by case when e1 is null then 0 else 1 end, part", RealMetadataFactory.example1Cached(), null, capFinder,  //$NON-NLS-1$
-            new String[]{"SELECT MAX(v_1.c_0), v_1.c_1 FROM (SELECT v_0.c_2 AS c_0, CASE WHEN v_0.c_0 IS NULL THEN 0 ELSE 1 END AS c_1, v_0.c_1 AS c_2 FROM (SELECT g_0.e1 AS c_0, 1 AS c_1, g_0.e2 AS c_2 FROM pm1.g1 AS g_0) AS v_0) AS v_1 GROUP BY v_1.c_1, v_1.c_2", 
-        "SELECT MAX(v_1.c_0), v_1.c_1 FROM (SELECT v_0.c_2 AS c_0, CASE WHEN v_0.c_0 IS NULL THEN 0 ELSE 1 END AS c_1, v_0.c_1 AS c_2 FROM (SELECT g_0.e1 AS c_0, 2 AS c_1, g_0.e2 AS c_2 FROM pm1.g2 AS g_0) AS v_0) AS v_1 GROUP BY v_1.c_1, v_1.c_2"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+            new String[]{"SELECT MAX(v_1.c_2), v_1.c_0 FROM (SELECT CASE WHEN v_0.c_0 IS NULL THEN 0 ELSE 1 END AS c_0, v_0.c_1, v_0.c_2 FROM (SELECT g_0.e1 AS c_0, 2 AS c_1, g_0.e2 AS c_2 FROM pm1.g2 AS g_0) AS v_0) AS v_1 GROUP BY v_1.c_0, v_1.c_1", 
+        	"SELECT MAX(v_1.c_2), v_1.c_0 FROM (SELECT CASE WHEN v_0.c_0 IS NULL THEN 0 ELSE 1 END AS c_0, v_0.c_1, v_0.c_2 FROM (SELECT g_0.e1 AS c_0, 1 AS c_1, g_0.e2 AS c_2 FROM pm1.g1 AS g_0) AS v_0) AS v_1 GROUP BY v_1.c_0, v_1.c_1"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
         TestOptimizer.checkNodeTypes(plan, new int[] {
             2,      // Access
             0,      // DependentAccess
@@ -1114,7 +1114,7 @@
         ProcessorPlan plan = TestOptimizer.helpPlan(sql,  
                 RealMetadataFactory.exampleBQTCached(),
                 null, getAggregatesFinder(),
-                new String[] {"SELECT g_0.DateValue FROM bqt1.smallb AS g_0"},  
+                new String[] {"SELECT g_0.DateValue FROM BQT1.SmallB AS g_0"},  
                               TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING );
 
         TestOptimizer.checkNodeTypes(plan, new int[] {

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestDependentJoins.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestDependentJoins.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestDependentJoins.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -802,7 +802,7 @@
             "SELECT max(a.stringkey) from bqt1.smalla a, bqt2.smalla a2, bqt1.smalla a1 where a.intnum = a2.intnum and a1.stringnum = a2.stringnum and a.floatnum = a1.floatnum",  //$NON-NLS-1$
             metadata,
             null, capFinder,
-            new String[] {"SELECT g_1.stringnum AS c_0, g_0.intnum AS c_1, MAX(g_0.stringkey) AS c_2 FROM bqt1.smalla AS g_0, bqt1.smalla AS g_1 WHERE g_0.floatnum = g_1.floatnum GROUP BY g_1.stringnum, g_0.intnum ORDER BY c_0, c_1", "SELECT DISTINCT g_0.stringnum AS c_0, g_0.intnum AS c_1 FROM bqt2.smalla AS g_0 WHERE (g_0.stringnum IN (<dependent values>)) AND (g_0.intnum IN (<dependent values>)) ORDER BY c_0, c_1"},
+            new String[] {"SELECT g_1.stringnum AS c_0, g_0.intnum AS c_1, MAX(g_0.stringkey) AS c_2 FROM BQT1.SmallA AS g_0, BQT1.SmallA AS g_1 WHERE g_0.floatnum = g_1.floatnum GROUP BY g_1.stringnum, g_0.intnum ORDER BY c_0, c_1", "SELECT DISTINCT g_0.stringnum AS c_0, g_0.intnum AS c_1 FROM BQT2.SmallA AS g_0 WHERE (g_0.stringnum IN (<dependent values>)) AND (g_0.intnum IN (<dependent values>)) ORDER BY c_0, c_1"},
             TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING );
 
         TestOptimizer.checkNodeTypes(plan, new int[] {

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestInlineView.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestInlineView.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestInlineView.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -39,7 +39,7 @@
 import org.teiid.query.processor.ProcessorPlan;
 import org.teiid.query.unittest.RealMetadataFactory;
 
-
+ at SuppressWarnings("nls")
 public class TestInlineView  {
     
     public static FakeCapabilitiesFinder getInliveViewCapabilitiesFinder() {
@@ -93,7 +93,7 @@
 	
 	public static InlineViewCase createANSIJoinInlineView()  throws Exception {
 		String userQuery = "select q1.a from (select count(bqt1.smalla.intkey) as a, bqt1.smalla.intkey from bqt1.smalla group by bqt1.smalla.intkey) q1 left outer join bqt1.smallb on q1.a = bqt1.smallb.intkey where q1.intkey = 1"; //$NON-NLS-1$
-		String optimizedQuery = "SELECT v_0.c_0 FROM (SELECT COUNT(g_0.intkey) AS c_0 FROM bqt1.smalla AS g_0 WHERE g_0.intkey = 1 GROUP BY g_0.intkey) AS v_0 LEFT OUTER JOIN bqt1.smallb AS g_1 ON v_0.c_0 = g_1.intkey"; //$NON-NLS-1$
+		String optimizedQuery = "SELECT v_0.c_0 FROM (SELECT COUNT(g_0.intkey) AS c_0 FROM BQT1.SmallA AS g_0 WHERE g_0.intkey = 1 GROUP BY g_0.intkey) AS v_0 LEFT OUTER JOIN BQT1.SmallB AS g_1 ON v_0.c_0 = g_1.intkey"; //$NON-NLS-1$
 		
 		List<List<?>> expectedResults = new ArrayList<List<?>>();
 		expectedResults.add(Arrays.asList(1));
@@ -113,7 +113,7 @@
 	public static InlineViewCase createInlineView()  throws Exception {
 		String userQuery = "select bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa from (select count(bqt1.smalla.intkey) as aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, bqt1.smalla.intkey from bqt1.smalla group by bqt1.smalla.intkey) bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb, bqt1.smallb " + //$NON-NLS-1$
 				"where bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.intkey = 1 and bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = bqt1.smallb.intkey"; //$NON-NLS-1$
-		String optimizedQuery = "SELECT v_0.c_0 FROM (SELECT COUNT(g_0.intkey) AS c_0 FROM bqt1.smalla AS g_0 WHERE g_0.intkey = 1 GROUP BY g_0.intkey) AS v_0, bqt1.smallb AS g_1 WHERE v_0.c_0 = g_1.intkey"; //$NON-NLS-1$
+		String optimizedQuery = "SELECT v_0.c_0 FROM (SELECT COUNT(g_0.intkey) AS c_0 FROM BQT1.SmallA AS g_0 WHERE g_0.intkey = 1 GROUP BY g_0.intkey) AS v_0, BQT1.SmallB AS g_1 WHERE v_0.c_0 = g_1.intkey"; //$NON-NLS-1$
 		
 		List<List<?>> expectedResults = new ArrayList<List<?>>();
 		expectedResults.add(Arrays.asList(1));
@@ -131,7 +131,7 @@
 	
 	public static InlineViewCase createInlineViewWithDistinctAndOrderBy() throws Exception {
 		String userQuery = "select Q1.a from (select distinct count(bqt1.smalla.intkey) as a, bqt1.smalla.intkey from bqt1.smalla group by bqt1.smalla.intkey order by bqt1.smalla.intkey) q1 inner join bqt1.smallb as q2 on q1.intkey = q2.intkey where q1.a = 1 and q1.a + q1.intkey = 2"; //$NON-NLS-1$
-        String optimizedQuery = "SELECT v_0.c_1 FROM (SELECT g_0.intkey AS c_0, COUNT(g_0.intkey) AS c_1 FROM bqt1.smalla AS g_0 GROUP BY g_0.intkey HAVING (COUNT(g_0.intkey) = 1) AND ((COUNT(g_0.intkey) + g_0.intkey) = 2)) AS v_0, bqt1.smallb AS g_1 WHERE v_0.c_0 = g_1.intkey"; //$NON-NLS-1$
+        String optimizedQuery = "SELECT v_0.c_1 FROM (SELECT g_0.intkey AS c_0, COUNT(g_0.intkey) AS c_1 FROM BQT1.SmallA AS g_0 GROUP BY g_0.intkey HAVING (COUNT(g_0.intkey) = 1) AND ((COUNT(g_0.intkey) + g_0.intkey) = 2)) AS v_0, BQT1.SmallB AS g_1 WHERE v_0.c_0 = g_1.intkey"; //$NON-NLS-1$
 
         List<List<?>> expectedResults = new ArrayList<List<?>>();
 		expectedResults.add(Arrays.asList(1));
@@ -150,7 +150,7 @@
 	
 	public static InlineViewCase createInlineViewOfVirtual() throws Exception{
 		String userQuery = "select q1.A from (select count(intkey) as a, intkey, stringkey from vqt.smalla group by intkey, stringkey) q1 inner join vqt.smallb as q2 on q1.intkey = q2.a12345 where q1.a = 2"; //$NON-NLS-1$
-		String optimizedQuery = "SELECT v_0.c_1 FROM (SELECT g_0.IntKey AS c_0, COUNT(g_0.IntKey) AS c_1 FROM BQT1.SmallA AS g_0 GROUP BY g_0.IntKey, g_0.StringKey HAVING COUNT(g_0.IntKey) = 2) AS v_0, BQT1.SmallA AS g_1 WHERE v_0.c_0 = Concat(g_1.StringKey, g_1.StringNum)"; //$NON-NLS-1$
+		String optimizedQuery = "SELECT v_0.c_1 FROM (SELECT g_0.IntKey AS c_0, COUNT(g_0.IntKey) AS c_1 FROM BQT1.SmallA AS g_0 GROUP BY g_0.IntKey, g_0.StringKey HAVING COUNT(g_0.IntKey) = 2) AS v_0, BQT1.SmallA AS g_1 WHERE convert(v_0.c_0, string) = Concat(g_1.StringKey, g_1.StringNum)"; //$NON-NLS-1$
 
 		List<List<?>> expectedResults = new ArrayList<List<?>>();
 				
@@ -167,7 +167,7 @@
 	
 	public static InlineViewCase createInlineViewWithOuterOrderAndGroup() throws Exception {
 		String userQuery = "select count(Q1.a) b from (select distinct count(bqt1.smalla.intkey) as a, bqt1.smalla.intkey from bqt1.smalla group by bqt1.smalla.intkey order by bqt1.smalla.intkey) q1 inner join bqt1.smallb as q2 on q1.intkey = q2.intkey where q1.a = 1 and q1.a + q1.intkey = 2 group by Q1.a order by b"; //$NON-NLS-1$
-		String optimizedQuery = "SELECT COUNT(v_0.c_1) AS c_0 FROM (SELECT g_0.intkey AS c_0, COUNT(g_0.intkey) AS c_1 FROM bqt1.smalla AS g_0 GROUP BY g_0.intkey HAVING (COUNT(g_0.intkey) = 1) AND ((COUNT(g_0.intkey) + g_0.intkey) = 2)) AS v_0, bqt1.smallb AS g_1 WHERE v_0.c_0 = g_1.intkey GROUP BY v_0.c_1 ORDER BY c_0"; //$NON-NLS-1$
+		String optimizedQuery = "SELECT COUNT(v_0.c_1) AS c_0 FROM (SELECT g_0.intkey AS c_0, COUNT(g_0.intkey) AS c_1 FROM BQT1.SmallA AS g_0 GROUP BY g_0.intkey HAVING (COUNT(g_0.intkey) = 1) AND ((COUNT(g_0.intkey) + g_0.intkey) = 2)) AS v_0, BQT1.SmallB AS g_1 WHERE v_0.c_0 = g_1.intkey GROUP BY v_0.c_1 ORDER BY c_0"; //$NON-NLS-1$
 
 		List<List<?>> expectedResults = new ArrayList<List<?>>();
 		expectedResults.add(Arrays.asList(1));
@@ -185,7 +185,7 @@
 	
 	public static InlineViewCase crateInlineViewsInUnions() throws Exception {
 		String userQuery = "select q1.a from (select count(bqt1.smalla.intkey) as a, bqt1.smalla.intkey from bqt1.smalla group by bqt1.smalla.intkey) q1 left outer join bqt1.smallb on q1.a = bqt1.smallb.intkey where q1.intkey = 1 union all (select count(Q1.a) b from (select distinct count(bqt1.smalla.intkey) as a, bqt1.smalla.intkey from bqt1.smalla group by bqt1.smalla.intkey order by bqt1.smalla.intkey) q1 inner join bqt1.smallb as q2 on q1.intkey = q2.intkey where q1.a = 1 and q1.a + q1.intkey = 2 group by Q1.a order by b)"; //$NON-NLS-1$
-		String optimizedQuery = "SELECT v_1.c_0 FROM (SELECT COUNT(g_2.intkey) AS c_0 FROM bqt1.smalla AS g_2 WHERE g_2.intkey = 1 GROUP BY g_2.intkey) AS v_1 LEFT OUTER JOIN bqt1.smallb AS g_3 ON v_1.c_0 = g_3.intkey UNION ALL SELECT COUNT(v_0.c_1) AS c_0 FROM (SELECT g_0.IntKey AS c_0, COUNT(g_0.IntKey) AS c_1 FROM bqt1.smalla AS g_0 GROUP BY g_0.IntKey HAVING (COUNT(g_0.IntKey) = 1) AND ((COUNT(g_0.IntKey) + g_0.IntKey) = 2)) AS v_0, bqt1.smallb AS g_1 WHERE v_0.c_0 = g_1.intkey GROUP BY v_0.c_1"; //$NON-NLS-1$
+		String optimizedQuery = "SELECT v_1.c_0 FROM (SELECT COUNT(g_2.intkey) AS c_0 FROM BQT1.SmallA AS g_2 WHERE g_2.intkey = 1 GROUP BY g_2.intkey) AS v_1 LEFT OUTER JOIN BQT1.SmallB AS g_3 ON v_1.c_0 = g_3.intkey UNION ALL SELECT COUNT(v_0.c_1) AS c_0 FROM (SELECT g_0.IntKey AS c_0, COUNT(g_0.IntKey) AS c_1 FROM BQT1.SmallA AS g_0 GROUP BY g_0.IntKey HAVING (COUNT(g_0.IntKey) = 1) AND ((COUNT(g_0.IntKey) + g_0.IntKey) = 2)) AS v_0, BQT1.SmallB AS g_1 WHERE v_0.c_0 = g_1.intkey GROUP BY v_0.c_1"; //$NON-NLS-1$
 
 		List<List<?>> expectedResults = new ArrayList<List<?>>();
 		expectedResults.add(Arrays.asList(1));
@@ -206,7 +206,7 @@
 	public static InlineViewCase createUnionInInlineView() throws Exception{
 		
 	    String userQuery = "select t1.intkey from (select case when q1.a=1 then 2 else 1 end as a from (select count(bqt1.smalla.intkey) as a, bqt1.smalla.intkey from bqt1.smalla group by bqt1.smalla.intkey) q1 left outer join bqt1.smallb on q1.a = bqt1.smallb.intkey where q1.intkey = 1 union all (select count(Q1.a) b from (select distinct count(bqt1.smalla.intkey) as a, bqt1.smalla.intkey from bqt1.smalla group by bqt1.smalla.intkey order by bqt1.smalla.intkey) q1 inner join bqt1.smallb as q2 on q1.intkey = q2.intkey where q1.a = 1 and q1.a + q1.intkey = 2 group by Q1.a order by b)) as q3, bqt1.smallb as t1 where q3.a = t1.intkey order by t1.intkey"; //$NON-NLS-1$
-		String optimizedQuery = "SELECT g_4.intkey AS c_0 FROM (SELECT CASE WHEN v_1.c_0 = 1 THEN 2 ELSE 1 END AS c_0 FROM (SELECT COUNT(g_2.intkey) AS c_0 FROM bqt1.smalla AS g_2 WHERE g_2.intkey = 1 GROUP BY g_2.intkey) AS v_1 LEFT OUTER JOIN bqt1.smallb AS g_3 ON v_1.c_0 = g_3.intkey UNION ALL SELECT COUNT(v_0.c_1) AS c_0 FROM (SELECT g_0.IntKey AS c_0, COUNT(g_0.IntKey) AS c_1 FROM bqt1.smalla AS g_0 GROUP BY g_0.IntKey HAVING (COUNT(g_0.IntKey) = 1) AND ((COUNT(g_0.IntKey) + g_0.IntKey) = 2)) AS v_0, bqt1.smallb AS g_1 WHERE v_0.c_0 = g_1.intkey GROUP BY v_0.c_1) AS v_2, bqt1.smallb AS g_4 WHERE v_2.c_0 = g_4.intkey ORDER BY c_0"; //$NON-NLS-1$
+		String optimizedQuery = "SELECT g_4.intkey AS c_0 FROM (SELECT CASE WHEN v_1.c_0 = 1 THEN 2 ELSE 1 END AS c_0 FROM (SELECT COUNT(g_2.intkey) AS c_0 FROM BQT1.SmallA AS g_2 WHERE g_2.intkey = 1 GROUP BY g_2.intkey) AS v_1 LEFT OUTER JOIN BQT1.SmallB AS g_3 ON v_1.c_0 = g_3.intkey UNION ALL SELECT COUNT(v_0.c_1) AS c_0 FROM (SELECT g_0.IntKey AS c_0, COUNT(g_0.IntKey) AS c_1 FROM BQT1.SmallA AS g_0 GROUP BY g_0.IntKey HAVING (COUNT(g_0.IntKey) = 1) AND ((COUNT(g_0.IntKey) + g_0.IntKey) = 2)) AS v_0, BQT1.SmallB AS g_1 WHERE v_0.c_0 = g_1.intkey GROUP BY v_0.c_1) AS v_2, BQT1.SmallB AS g_4 WHERE v_2.c_0 = g_4.intkey ORDER BY c_0"; //$NON-NLS-1$
 
 		List<List<?>> expectedResults = new ArrayList<List<?>>();
 		expectedResults.add(Arrays.asList(1));
@@ -264,8 +264,8 @@
         QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
         
         ProcessorPlan plan = helpPlan("select * from (select count(bqt1.smalla.intkey) as a, bqt1.smalla.intkey from bqt1.smalla group by bqt1.smalla.intkey) q1 inner join (select count(bqt2.smallb.intkey) as a, bqt2.smallb.intkey from bqt2.smallb group by bqt2.smallb.intkey) as q2 on q1.intkey = q2.intkey where q1.a = 1", //$NON-NLS-1$
-                metadata, null, capFinder, new String[] {"SELECT v_0.c_0, v_0.c_1 FROM (SELECT g_0.intkey AS c_0, COUNT(g_0.intkey) AS c_1 FROM bqt2.smallb AS g_0 GROUP BY g_0.intkey) AS v_0 ORDER BY c_0", //$NON-NLS-1$
-                                                         "SELECT v_0.c_0, v_0.c_1 FROM (SELECT g_0.intkey AS c_0, COUNT(g_0.intkey) AS c_1 FROM bqt1.smalla AS g_0 GROUP BY g_0.intkey HAVING COUNT(g_0.intkey) = 1) AS v_0 ORDER BY c_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+                metadata, null, capFinder, new String[] {"SELECT v_0.c_0, v_0.c_1 FROM (SELECT g_0.intkey AS c_0, COUNT(g_0.intkey) AS c_1 FROM BQT1.SmallA AS g_0 GROUP BY g_0.intkey HAVING COUNT(g_0.intkey) = 1) AS v_0 ORDER BY c_0", 
+        		"SELECT v_0.c_0, v_0.c_1 FROM (SELECT g_0.intkey AS c_0, COUNT(g_0.intkey) AS c_1 FROM BQT2.SmallB AS g_0 GROUP BY g_0.intkey) AS v_0 ORDER BY c_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
 
         checkNodeTypes(plan, new int[] {
                 2,      // Access

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestJoinOptimization.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestJoinOptimization.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestJoinOptimization.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -295,7 +295,7 @@
         String sql = "select bqt1.smalla.intkey from bqt1.smalla left outer join (select bqt3.smalla.intkey from bqt3.smalla where bqt3.smalla.intkey = 1) foo on bqt1.smalla.intkey = foo.intkey"; //$NON-NLS-1$
 
         // Plan query
-        ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), new String[] {"SELECT 1 FROM bqt3.smalla AS g_0 WHERE g_0.intkey = 1", "SELECT g_0.intkey FROM bqt1.smalla AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$ 
+        ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), new String[] {"SELECT 1 FROM BQT3.SmallA AS g_0 WHERE g_0.intkey = 1", "SELECT g_0.intkey FROM BQT1.SmallA AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$ 
 
         TestOptimizer.checkNodeTypes(plan, new int[] {
             2,      // Access
@@ -426,7 +426,7 @@
         
         // Plan query
         ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), null, capFinder, 
-                                                    new String[] {"SELECT g_3.intkey, g_0.intkey FROM ((bqt1.smallb AS g_0 CROSS JOIN bqt1.mediuma AS g_1) INNER JOIN bqt1.mediumb AS g_2 ON ((g_0.intkey + g_1.intkey) + g_2.intkey) = 1) LEFT OUTER JOIN bqt1.smalla AS g_3 ON g_3.stringkey = g_0.stringkey"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+                                                    new String[] {"SELECT g_3.intkey, g_0.intkey FROM ((BQT1.SmallB AS g_0 CROSS JOIN BQT1.MediumA AS g_1) INNER JOIN BQT1.MediumB AS g_2 ON ((g_0.intkey + g_1.intkey) + g_2.intkey) = 1) LEFT OUTER JOIN BQT1.SmallA AS g_3 ON g_3.stringkey = g_0.stringkey"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
 
         TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);        
     }
@@ -517,7 +517,7 @@
         String sql = "select b.intkey from (select intkey from bqt1.smalla) a left outer join (select intkey from bqt1.smallb) b on (1 = 1)"; //$NON-NLS-1$
         
         ProcessorPlan plan = TestOptimizer.helpPlan(sql, metadata, 
-                                                    new String[]{"SELECT g_1.intkey FROM bqt1.smalla AS g_0 LEFT OUTER JOIN bqt1.smallb AS g_1 ON 1 = 1"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+                                                    new String[]{"SELECT g_1.intkey FROM BQT1.SmallA AS g_0 LEFT OUTER JOIN BQT1.SmallB AS g_1 ON 1 = 1"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
         
         TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
     }
@@ -1041,9 +1041,9 @@
             "SELECT BQT1.SmallA.IntKey FROM BQT1.SmallB, BQT1.Smalla, bqt2.smallb where bqt2.smallb.intkey = bqt1.smallb.intkey and bqt2.smallb.intkey = bqt1.smalla.intkey",  //$NON-NLS-1$
             metadata,
             null, capFinder,
-            new String[] {"SELECT g_0.intkey AS c_0 FROM BQT1.Smalla AS g_0 ORDER BY c_0", 
+            new String[] {"SELECT g_0.intkey AS c_0 FROM BQT1.SmallA AS g_0 ORDER BY c_0", 
             		"SELECT g_0.intkey AS c_0 FROM BQT1.SmallB AS g_0 ORDER BY c_0", 
-            		"SELECT g_0.intkey AS c_0 FROM bqt2.smallb AS g_0 ORDER BY c_0"}, //$NON-NLS-1$ //$NON-NLS-2$
+            		"SELECT g_0.intkey AS c_0 FROM BQT2.SmallB AS g_0 ORDER BY c_0"}, //$NON-NLS-1$ //$NON-NLS-2$
             ComparisonMode.EXACT_COMMAND_STRING );
 
     }

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestJoinWithFunction.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestJoinWithFunction.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestJoinWithFunction.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -24,6 +24,8 @@
 
 import java.util.List;
 
+import junit.framework.TestCase;
+
 import org.teiid.api.exception.query.QueryParserException;
 import org.teiid.api.exception.query.QueryResolverException;
 import org.teiid.api.exception.query.QueryValidatorException;
@@ -31,13 +33,12 @@
 import org.teiid.query.optimizer.TestOptimizer.ComparisonMode;
 import org.teiid.query.processor.ProcessorPlan;
 import org.teiid.query.processor.relational.RelationalPlan;
-import org.teiid.query.sql.symbol.AliasSymbol;
 import org.teiid.query.sql.symbol.Constant;
+import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.symbol.ExpressionSymbol;
+import org.teiid.query.sql.util.SymbolMap;
 
-import junit.framework.TestCase;
 
-
 /**
  * <p><code>TestCase</code> to cover planning and optimization of JOINs which 
  * use a scalar function as a symbol or as part of the JOIN criteria.</p>
@@ -323,7 +324,7 @@
 		Constant expectedConst = new Constant(new Double(10.0));
 		assertEquals("Did not get expected constant value for SqrtTop in root node of plan: ",  //$NON-NLS-1$
 				expectedConst, 
-				((ExpressionSymbol) ((AliasSymbol) elem.get(8)).getSymbol()).getExpression()  // should be a AliasSymbol containing an expression 
+				SymbolMap.getExpression((Expression)elem.get(8))  // should be a AliasSymbol containing an expression 
 			);
 	}
 
@@ -461,11 +462,11 @@
 		Constant expectedConst = new Constant(new Double(10.0));
 		assertEquals("Did not get expected constant value for SqrtLeft in root node of plan: ",  //$NON-NLS-1$
 				expectedConst, 
-				((ExpressionSymbol) elem.get(8)).getExpression()  // should be a AliasSymbol containing an expression 
+				SymbolMap.getExpression((Expression)elem.get(8))  // should be a AliasSymbol containing an expression 
 			); 
 		assertEquals("Did not get expected constant value for SqrtTop in root node of plan: ",  //$NON-NLS-1$
 				expectedConst, 
-				((ExpressionSymbol) ((AliasSymbol) elem.get(9)).getSymbol()).getExpression()  // should be a AliasSymbol containing an expression 
+				SymbolMap.getExpression((Expression)elem.get(9))  // should be a AliasSymbol containing an expression 
 			);
 	}
 }

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -1014,7 +1014,7 @@
         List bindings = new ArrayList();
         bindings.add("pm1.g2.e1"); //$NON-NLS-1$
         helpPlan("select e1 FROM pm1.g1 WHERE e1 LIKE ?", example1(), bindings, null,  //$NON-NLS-1$
-            new String[] { "SELECT g_0.e1 FROM pm1.g1 AS g_0 WHERE g_0.e1 LIKE PM1.G2.e1" }, ComparisonMode.EXACT_COMMAND_STRING ); //$NON-NLS-1$
+            new String[] { "SELECT g_0.e1 FROM pm1.g1 AS g_0 WHERE g_0.e1 LIKE pm1.g2.e1" }, ComparisonMode.EXACT_COMMAND_STRING ); //$NON-NLS-1$
     }
     
     @Test public void testDefect6517() {
@@ -2106,7 +2106,7 @@
             "SELECT MAX(sa.datevalue) FROM bqt1.smalla AS sb " + //$NON-NLS-1$
             "WHERE (sb.intkey = sa.intkey) AND (sa.stringkey = sb.stringkey) ))"; //$NON-NLS-1$
 
-        String sqlOut = "SELECT g_0.intkey FROM bqt1.smalla AS g_0 WHERE (g_0.intkey = 46) AND (g_0.stringkey = '46') AND (g_0.datevalue = (SELECT MAX(g_0.datevalue) FROM bqt1.smalla AS g_1 WHERE (g_1.intkey = g_0.intkey) AND (g_1.stringkey = g_0.stringkey)))"; //$NON-NLS-1$
+        String sqlOut = "SELECT g_0.intkey FROM BQT1.SmallA AS g_0 WHERE (g_0.intkey = 46) AND (g_0.stringkey = '46') AND (g_0.datevalue = (SELECT MAX(g_0.datevalue) FROM BQT1.SmallA AS g_1 WHERE (g_1.intkey = g_0.intkey) AND (g_1.stringkey = g_0.stringkey)))"; //$NON-NLS-1$
 
         ProcessorPlan plan = helpPlan(sqlIn, 
             RealMetadataFactory.exampleBQTCached(),
@@ -3451,7 +3451,7 @@
     }
     
     @Test public void testBQT9500_126() throws Exception {
-        String sql = "SELECT IntKey, LongNum, expr FROM (SELECT IntKey, LongNum, concat(LongNum, 'abc') FROM BQT2.SmallA ) AS x ORDER BY IntKey"; //$NON-NLS-1$
+        String sql = "SELECT IntKey, LongNum, expr FROM (SELECT IntKey, LongNum, concat(LongNum, 'abc') as expr FROM BQT2.SmallA ) AS x ORDER BY IntKey"; //$NON-NLS-1$
         ProcessorPlan plan = helpPlan(sql, RealMetadataFactory.exampleBQTCached(), 
                                       new String[] { 
                                           "SELECT g_0.IntKey AS c_0, g_0.LongNum AS c_1 FROM BQT2.SmallA AS g_0 ORDER BY c_0" }, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ 
@@ -4268,7 +4268,7 @@
         ProcessorPlan plan = helpPlan(sql,  
                                       RealMetadataFactory.exampleBQTCached(),
                                       null, capFinder,
-                                      new String[] {"SELECT g_1.longnum, g_2.datevalue, g_0.IntKEy, g_1.IntKEy, g_2.IntKey FROM bqt1.smalla AS g_0, bqt1.smallb AS g_1, bqt1.mediuma AS g_2 WHERE (g_0.StringKey = g_1.StringKey) AND (g_2.IntKey = g_0.IntKey) AND (g_0.IntNum > (SELECT SUM(g_3.IntNum) FROM bqt1.smalla AS g_3))"}, //$NON-NLS-1$ 
+                                      new String[] {"SELECT g_1.longnum, g_2.datevalue, g_0.IntKEy, g_1.IntKEy, g_2.IntKey FROM BQT1.SmallA AS g_0, BQT1.SmallB AS g_1, BQT1.MediumA AS g_2 WHERE (g_0.StringKey = g_1.StringKey) AND (g_2.IntKey = g_0.IntKey) AND (convert(g_0.IntNum, long) > (SELECT SUM(g_3.IntNum) FROM BQT1.SmallA AS g_3))"}, //$NON-NLS-1$ 
                                       ComparisonMode.EXACT_COMMAND_STRING );
 
         checkNodeTypes(plan, new int[] {
@@ -4512,7 +4512,7 @@
         RelationalPlan plan = (RelationalPlan)helpPlan(sql,  
                                       RealMetadataFactory.exampleBQTCached(),
                                       null, capFinder,
-                                      new String[] {"SELECT bqt1.smalla.datevalue, bqt1.smalla.intkey, bqt1.smalla.stringkey, bqt1.smalla.objectvalue FROM bqt1.smalla WHERE (bqt1.smalla.intkey = 46) AND (bqt1.smalla.stringkey = '46')"}, //$NON-NLS-1$
+                                      new String[] {"SELECT BQT1.SmallA.datevalue, BQT1.SmallA.intkey, BQT1.SmallA.stringkey, BQT1.SmallA.objectvalue FROM BQT1.SmallA WHERE (BQT1.SmallA.intkey = 46) AND (BQT1.SmallA.stringkey = '46')"}, //$NON-NLS-1$
                                       SHOULD_SUCCEED );
 
         checkNodeTypes(plan, new int[] {
@@ -4538,7 +4538,7 @@
         Set<String> actualQueries = getAtomicQueries(subplan);
         
         // Compare atomic queries
-        HashSet<String> expectedQueries = new HashSet<String>(Arrays.asList(new String[] { "SELECT bqt1.smalla.datevalue FROM bqt1.smalla WHERE (bqt1.smalla.intkey = bqt1.smalla.intkey) AND (bqt1.smalla.stringkey = bqt1.smalla.stringkey)"})); //$NON-NLS-1$
+        HashSet<String> expectedQueries = new HashSet<String>(Arrays.asList(new String[] { "SELECT BQT1.SmallA.datevalue FROM BQT1.SmallA WHERE (BQT1.SmallA.intkey = BQT1.SmallA.intkey) AND (BQT1.SmallA.stringkey = BQT1.SmallA.stringkey)"})); //$NON-NLS-1$
         assertEquals("Did not get expected atomic queries for subplan: ", expectedQueries, actualQueries); //$NON-NLS-1$
 
         checkNodeTypes(subplan, new int[] {
@@ -5276,7 +5276,7 @@
         ProcessorPlan plan = helpPlan(sql,  
                                       metadata,
                                       null, capFinder,
-                                      new String[] {"SELECT g_0.intkey FROM bqt1.smalla AS g_0 ORDER BY g_0.intkey"},  //$NON-NLS-1$
+                                      new String[] {"SELECT g_0.intkey FROM BQT1.SmallA AS g_0 ORDER BY g_0.intkey"},  //$NON-NLS-1$
                                       ComparisonMode.EXACT_COMMAND_STRING );
 
         checkNodeTypes(plan, FULL_PUSHDOWN);
@@ -5396,7 +5396,7 @@
         ProcessorPlan plan = helpPlan(sql,  
                                       metadata,
                                       null, capFinder,
-                                      new String[] {"SELECT g_2.intkey FROM ((bqt1.SmallA AS g_0 CROSS JOIN bqt1.smalla AS g_1) CROSS JOIN bqt1.mediuma AS g_2) LEFT OUTER JOIN bqt1.mediumb AS g_3 ON g_2.intkey = g_3.intkey"},  //$NON-NLS-1$
+                                      new String[] {"SELECT g_2.intkey FROM ((BQT1.SmallA AS g_0 CROSS JOIN BQT1.SmallA AS g_1) CROSS JOIN BQT1.MediumA AS g_2) LEFT OUTER JOIN BQT1.MediumB AS g_3 ON g_2.intkey = g_3.intkey"},  //$NON-NLS-1$
                                       ComparisonMode.EXACT_COMMAND_STRING );
         
         checkNodeTypes(plan, FULL_PUSHDOWN);        
@@ -5538,7 +5538,7 @@
         helpPlan(sql,  
                                       metadata, 
                                       null, capFinder, 
-                                      new String[] {"SELECT g_0.intkey, g_1.IntKey FROM bqt2.smalla AS g_0, bqt2.smalla AS g_1 WHERE g_0.intkey = g_1.IntKey"},  //$NON-NLS-1$ 
+                                      new String[] {"SELECT g_0.intkey, g_1.IntKey FROM BQT2.SmallA AS g_0, BQT2.SmallA AS g_1 WHERE g_0.intkey = g_1.IntKey"},  //$NON-NLS-1$ 
                                       ComparisonMode.EXACT_COMMAND_STRING ); 
              
     } 
@@ -6255,7 +6255,7 @@
         String sql = "select a.e1 from (select 1 e1) a, (select e1, 1 as a, x from (select e1, CASE WHEN e1 = 'a' THEN e2 ELSE e3 END as x from pm1.g2) y group by e1, x) b where a.e1 = b.x"; //$NON-NLS-1$
         
         ProcessorPlan plan = helpPlan(sql, metadata, null, capFinder, 
-                                      new String[] {"SELECT v_0.c_0 FROM (SELECT CASE WHEN g_0.e1 = 'a' THEN g_0.e2 ELSE g_0.e3 END AS c_0 FROM pm1.g2 AS g_0 GROUP BY g_0.e1, CASE WHEN g_0.e1 = 'a' THEN g_0.e2 ELSE g_0.e3 END) AS v_0 WHERE v_0.c_0 IN (<dependent values>) ORDER BY c_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ 
+                                      new String[] {"SELECT v_0.c_0 FROM (SELECT CASE WHEN g_0.e1 = 'a' THEN g_0.e2 ELSE convert(g_0.e3, integer) END AS c_0 FROM pm1.g2 AS g_0 GROUP BY g_0.e1, CASE WHEN g_0.e1 = 'a' THEN g_0.e2 ELSE convert(g_0.e3, integer) END) AS v_0 WHERE v_0.c_0 IN (<dependent values>) ORDER BY c_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ 
         
         checkNodeTypes(plan, new int[] {
             0,      // Access
@@ -6451,7 +6451,7 @@
      * <p>
      * Related Defects: JBEDSP-1137
      */
-    @Test public void testAmbiguousAliasFunctionInSubQuerySource() {
+    @Test public void testAmbiguousAliasFunctionInSubQuerySource() throws Exception {
         // Create query
     	String sql = "SELECT CONVERT(A.e2, biginteger) AS e2 FROM (" + //$NON-NLS-1$
     	"   SELECT CONVERT(e2, long) AS e2 FROM pm1.g1 AS A" + //$NON-NLS-1$
@@ -6469,8 +6469,8 @@
         capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
         
         helpPlan(sql, metadata, null, capFinder,
-            new String[] {"SELECT CONVERT(CONVERT(e2, long), biginteger) FROM pm1.g1 AS A"}, //$NON-NLS-1$
-            SHOULD_SUCCEED );
+            new String[] {"SELECT CONVERT(CONVERT(g_0.e2, long), biginteger) FROM pm1.g1 AS g_0"}, //$NON-NLS-1$
+            ComparisonMode.EXACT_COMMAND_STRING );
     }
     
     @Test public void testNestedTable() throws Exception {
@@ -6569,7 +6569,7 @@
         ProcessorPlan plan = TestOptimizer.helpPlan("SELECT e1 from pm1.g1 where e1 = e2 and e1 = e3", //$NON-NLS-1$
                                       RealMetadataFactory.example1Cached(), null, new DefaultCapabilitiesFinder(caps),
                                       new String[] {
-                                          "SELECT pm1.g1.e1, pm1.g1.e3 FROM pm1.g1 WHERE pm1.g1.e1 = pm1.g1.e2"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+                                          "SELECT pm1.g1.e1, pm1.g1.e3 FROM pm1.g1 WHERE pm1.g1.e1 = convert(pm1.g1.e2, string)"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
     
         checkNodeTypes(plan, new int[] {
                 1,      // Access

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestRuleMergeVirtual.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestRuleMergeVirtual.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestRuleMergeVirtual.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -352,7 +352,7 @@
         // Plan query
         ProcessorPlan plan = TestOptimizer.helpPlan(sql, metadata, 
             null, capFinder,
-            new String[] { "SELECT v_0.c_0 FROM (SELECT convert(g_0.TimestampValue, date) AS c_0 FROM bqt1.smalla AS g_0, bqt1.smallb AS g_1 WHERE g_0.stringkey = g_1.stringkey) AS v_0 GROUP BY v_0.c_0" },  //$NON-NLS-1$
+            new String[] { "SELECT v_0.c_0 FROM (SELECT convert(g_0.TimestampValue, date) AS c_0 FROM BQT1.SmallA AS g_0, BQT1.SmallB AS g_1 WHERE g_0.stringkey = g_1.stringkey) AS v_0 GROUP BY v_0.c_0" },  //$NON-NLS-1$
             TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING);
         TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);         
     } 

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestRuleRaiseNull.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestRuleRaiseNull.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestRuleRaiseNull.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -164,7 +164,7 @@
         String sql = "select b.intkey, b.x from (select intkey, intnum as x from bqt1.smalla where 1 = 0 union all select 1 as z, intkey as b from bqt1.smallb) b inner join bqt1.smalla on b.intkey = bqt1.smalla.intkey"; //$NON-NLS-1$
         
         ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(),  
-                                                    new String[]{"SELECT g_0.intkey FROM bqt1.smallb AS g_0, bqt1.smalla AS g_1 WHERE g_1.IntKey = 1"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+                                                    new String[]{"SELECT g_0.intkey FROM BQT1.SmallB AS g_0, BQT1.SmallA AS g_1 WHERE g_1.IntKey = 1"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
         TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
     }
     
@@ -255,7 +255,7 @@
         String sql = "select max(intkey), intnum from (select intkey, intnum from bqt2.smalla where 1 = 0 union all select intnum, intnum from bqt2.smalla union all select intkey, stringkey from bqt2.smalla) x group by intnum"; //$NON-NLS-1$
         
         ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), null, capFinder, 
-                                                    new String[]{"SELECT MAX(v_0.c_1), v_0.c_0 FROM (SELECT g_1.IntNum AS c_0, g_1.IntNum AS c_1 FROM bqt2.smalla AS g_1 UNION ALL SELECT g_0.StringKey AS c_0, g_0.IntKey AS c_1 FROM bqt2.smalla AS g_0) AS v_0 GROUP BY v_0.c_0"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+                                                    new String[]{"SELECT MAX(v_0.c_1), v_0.c_0 FROM (SELECT convert(g_1.IntNum, string) AS c_0, g_1.IntNum AS c_1 FROM BQT2.SmallA AS g_1 UNION ALL SELECT g_0.StringKey AS c_0, g_0.IntKey AS c_1 FROM BQT2.SmallA AS g_0) AS v_0 GROUP BY v_0.c_0"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
         TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
     }
     

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestSubqueryPushdown.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestSubqueryPushdown.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestSubqueryPushdown.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -786,11 +786,11 @@
     }
     
     @Test public void testSubqueryRewriteToJoin2() throws Exception {
-        TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e1 in /*+ mj */ (select distinct pm1.g1.e1 || 1 FROM pm1.g1)", "SELECT e1 FROM pm3.g1, (SELECT DISTINCT concat(pm1.g1.e1, '1') AS EXPR FROM pm1.g1) AS X__1 WHERE pm3.g1.e1 = X__1.EXPR", RealMetadataFactory.example4());
+        TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e1 in /*+ mj */ (select distinct pm1.g1.e1 || 1 FROM pm1.g1)", "SELECT e1 FROM pm3.g1, (SELECT DISTINCT concat(pm1.g1.e1, '1') AS expr1 FROM pm1.g1) AS X__1 WHERE pm3.g1.e1 = X__1.expr1", RealMetadataFactory.example4());
     }
 
     @Test public void testSubqueryRewriteToJoin2a() throws Exception {
-        TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e1 in /*+ mj */ (select pm1.g1.e1 || 1 FROM pm1.g1)", "SELECT e1 FROM pm3.g1, (SELECT DISTINCT concat(pm1.g1.e1, '1') AS EXPR FROM pm1.g1) AS X__1 WHERE pm3.g1.e1 = X__1.EXPR", RealMetadataFactory.example4());
+        TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e1 in /*+ mj */ (select pm1.g1.e1 || 1 FROM pm1.g1)", "SELECT e1 FROM pm3.g1, (SELECT DISTINCT concat(pm1.g1.e1, '1') AS expr1 FROM pm1.g1) AS X__1 WHERE pm3.g1.e1 = X__1.expr1", RealMetadataFactory.example4());
     }
 
     /**
@@ -811,7 +811,7 @@
 
     @Test public void testSubqueryRewriteToJoinWithAggregate() throws Exception {
     	System.setProperty(RuleMergeCriteria.UNNEST_DEFAULT, Boolean.TRUE.toString());
-        TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e2 < (select max(e2) FROM pm1.g1 where pm3.g1.e1 = e1)", "SELECT e1 FROM pm3.g1, (SELECT MAX(e2) AS MAX, e1 FROM pm1.g1 GROUP BY e1) AS X__1 WHERE (pm3.g1.e2 < X__1.MAX) AND (pm3.g1.e1 = X__1.e1)", RealMetadataFactory.example4());
+        TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e2 < (select max(e2) FROM pm1.g1 where pm3.g1.e1 = e1)", "SELECT e1 FROM pm3.g1, (SELECT MAX(e2) AS expr1, e1 FROM pm1.g1 GROUP BY e1) AS X__1 WHERE (pm3.g1.e2 < X__1.expr1) AND (pm3.g1.e1 = X__1.e1)", RealMetadataFactory.example4());
     }
     
     /**
@@ -824,12 +824,12 @@
     
     @Test public void testSubqueryRewriteToJoinWithAggregate2() throws Exception {
     	System.setProperty(RuleMergeCriteria.UNNEST_DEFAULT, Boolean.TRUE.toString());
-        TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e2 < (select max(e2) FROM pm1.g1 WHERE pm3.g1.e1 = e1 HAVING min(e3) < pm3.g1.e3)", "SELECT e1 FROM pm3.g1, (SELECT MAX(e2) AS MAX, e1, MIN(e3) AS MIN FROM pm1.g1 GROUP BY e1) AS X__1 WHERE (X__1.MIN < pm3.g1.e3) AND (pm3.g1.e2 < X__1.MAX) AND (pm3.g1.e1 = X__1.e1)", RealMetadataFactory.example4());
+        TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e2 < (select max(e2) FROM pm1.g1 WHERE pm3.g1.e1 = e1 HAVING min(e3) < pm3.g1.e3)", "SELECT e1 FROM pm3.g1, (SELECT MAX(e2) AS expr1, e1, MIN(e3) AS expr3 FROM pm1.g1 GROUP BY e1) AS X__1 WHERE (X__1.expr3 < pm3.g1.e3) AND (pm3.g1.e2 < X__1.expr1) AND (pm3.g1.e1 = X__1.e1)", RealMetadataFactory.example4());
     }
     
     @Test public void testSubqueryRewriteToJoinWithGroupingExpression() throws Exception {
     	System.setProperty(RuleMergeCriteria.UNNEST_DEFAULT, Boolean.TRUE.toString());
-        TestQueryRewriter.helpTestRewriteCommand("Select distinct e1 from pm3.g1 where exists (select 1 FROM pm1.g1 group by e4 || 'x' HAVING min(e3) || (e4 || 'x') = pm3.g1.e3)", "SELECT DISTINCT e1 FROM pm3.g1, (SELECT 1 AS EXPR, MIN(e3) AS MIN, concat(e4, 'x') AS EXPR_0, concat(MIN(e3), concat(e4, 'x')) AS EXPR_1 FROM pm1.g1 GROUP BY concat(e4, 'x')) AS X__1 WHERE pm3.g1.e3 = X__1.EXPR_1", RealMetadataFactory.example4());
+        TestQueryRewriter.helpTestRewriteCommand("Select distinct e1 from pm3.g1 where exists (select 1 FROM pm1.g1 group by e4 || 'x' HAVING min(e3) || (e4 || 'x') = pm3.g1.e3)", "SELECT DISTINCT e1 FROM pm3.g1, (SELECT 1 AS expr1, MIN(e3) AS expr2, concat(convert(e4, string), 'x') AS expr3, concat(convert(MIN(e3), string), concat(convert(e4, string), 'x')) AS expr FROM pm1.g1 GROUP BY concat(convert(e4, string), 'x')) AS X__1 WHERE convert(pm3.g1.e3, string) = X__1.expr", RealMetadataFactory.example4());
     }
 
     /**
@@ -866,7 +866,7 @@
 
     @Test public void testSubqueryExpressionJoin() throws Exception {
     	System.setProperty(RuleMergeCriteria.UNNEST_DEFAULT, Boolean.TRUE.toString());
-        TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e2 < (Select max(e2) from pm2.g2 where e1 = pm3.g1.e1 having convert(min(e2), string) > pm3.g1.e1)", "SELECT e1 FROM pm3.g1, (SELECT MAX(e2) AS MAX, e1, MIN(e2) AS MIN FROM pm2.g2 GROUP BY e1) AS X__1 WHERE (convert(X__1.MIN, string) > pm3.g1.e1) AND (pm3.g1.e2 < X__1.MAX) AND (pm3.g1.e1 = X__1.e1)", RealMetadataFactory.example4());
+        TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e2 < (Select max(e2) from pm2.g2 where e1 = pm3.g1.e1 having convert(min(e2), string) > pm3.g1.e1)", "SELECT e1 FROM pm3.g1, (SELECT MAX(e2) AS expr1, e1, MIN(e2) AS expr3 FROM pm2.g2 GROUP BY e1) AS X__1 WHERE (convert(X__1.expr3, string) > pm3.g1.e1) AND (pm3.g1.e2 < X__1.expr1) AND (pm3.g1.e1 = X__1.e1)", RealMetadataFactory.example4());
     }
 
     /**
@@ -1029,7 +1029,7 @@
     }
 
     @Test public void testInvalidGeneratedSemijoinQuery1() throws Exception {
-    	TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e2 IN /*+ mj */ (Select max(e2) from pm2.g2 where e1 = pm3.g1.e1)", "SELECT e1 FROM pm3.g1, (SELECT MAX(e2) AS MAX, e1 FROM pm2.g2 GROUP BY e1) AS X__1 WHERE (pm3.g1.e1 = X__1.e1) AND (pm3.g1.e2 = X__1.MAX)", RealMetadataFactory.example4());
+    	TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e2 IN /*+ mj */ (Select max(e2) from pm2.g2 where e1 = pm3.g1.e1)", "SELECT e1 FROM pm3.g1, (SELECT MAX(e2) AS expr1, e1 FROM pm2.g2 GROUP BY e1) AS X__1 WHERE (pm3.g1.e1 = X__1.e1) AND (pm3.g1.e2 = X__1.expr1)", RealMetadataFactory.example4());
     }
     
     @Test public void testCompareSubquery2() throws Exception {

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestUnionPlanning.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestUnionPlanning.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestUnionPlanning.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -235,7 +235,7 @@
         ProcessorPlan plan = TestOptimizer.helpPlan("select * from (select * from (SELECT IntKey, intnum FROM BQT1.SmallA UNION ALL SELECT intkey, intnum FROM BQT2.SmallA) A where intkey in (1, 2, 3, 4) UNION ALL select intkey, intnum from bqt2.smallb where intkey in (6)) B inner join (SELECT IntKey, intnum FROM BQT1.SmallA where intkey in (1, 2) UNION ALL SELECT intkey, intnum FROM BQT2.SmallA where intkey in (5, 6)) C on b.intkey = c.intkey", RealMetadataFactory.exampleBQTCached(), null, TestInlineView.getInliveViewCapabilitiesFinder(),//$NON-NLS-1$
             new String[] { "SELECT g_0.intkey, g_0.intnum FROM BQT2.SmallA AS g_0 WHERE g_0.intkey IN (1, 2)",
         	"SELECT g_0.IntKey, g_0.intnum FROM BQT1.SmallA AS g_0 WHERE g_0.IntKey IN (1, 2)",
-        	"SELECT g_1.IntKey, g_1.IntNum, g_0.intkey, g_0.intnum FROM bqt2.smallb AS g_0, BQT2.SmallA AS g_1 WHERE (g_0.intkey = g_1.IntKey) AND (g_0.intkey = 6) AND (g_1.IntKey = 6)",
+        	"SELECT g_1.IntKey, g_1.IntNum, g_0.intkey, g_0.intnum FROM BQT2.SmallB AS g_0, BQT2.SmallA AS g_1 WHERE (g_0.intkey = g_1.IntKey) AND (g_0.intkey = 6) AND (g_1.IntKey = 6)",
         	"SELECT g_0.IntKey AS c_0, g_0.IntNum AS c_1 FROM BQT1.SmallA AS g_0 WHERE g_0.IntKey IN (1, 2) ORDER BY c_0" }, ComparisonMode.EXACT_COMMAND_STRING); 
 
         TestOptimizer.checkNodeTypes(plan, new int[] {

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/relational/TestAliasGenerator.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/relational/TestAliasGenerator.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/relational/TestAliasGenerator.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -36,6 +36,7 @@
 import org.teiid.query.sql.lang.Query;
 import org.teiid.query.sql.symbol.ElementSymbol;
 import org.teiid.query.sql.symbol.GroupSymbol;
+import org.teiid.query.sql.symbol.Symbol;
 import org.teiid.query.unittest.RealMetadataFactory;
 
 @SuppressWarnings("nls")
@@ -65,7 +66,7 @@
     
     @Test public void testLongOrderByAlias() throws Exception {
         String sql = "select pm1.g1.e1 || pm1.g1.e2 as asfasdfadfasdfasdfadfasdfadsfasdfasdfasdfasdfasdfadfa, pm1.g1.e2 from pm1.g1 order by asfasdfadfasdfasdfadfasdfadsfasdfasdfasdfasdfasdfadfa"; //$NON-NLS-1$
-        String expected = "SELECT concat(g_0.e1, g_0.e2) AS c_0, g_0.e2 AS c_1 FROM pm1.g1 AS g_0 ORDER BY c_0"; //$NON-NLS-1$
+        String expected = "SELECT concat(g_0.e1, convert(g_0.e2, string)) AS c_0, g_0.e2 AS c_1 FROM pm1.g1 AS g_0 ORDER BY c_0"; //$NON-NLS-1$
         helpTest(sql, expected, true, false, RealMetadataFactory.example1Cached());
     }
     
@@ -73,19 +74,19 @@
         String sql = "select e1 from pm1.g1 order by e1"; //$NON-NLS-1$
         String expected = "SELECT g_0.e1 AS c_0 FROM pm1.g1 AS g_0 ORDER BY c_0"; //$NON-NLS-1$
         Query command = (Query)helpTest(sql, expected, true, false, RealMetadataFactory.example1Cached());
-        assertEquals(command.getOrderBy().getSortKeys().get(0).getName(), "e1"); //$NON-NLS-1$
-        assertEquals(command.getProjectedSymbols().get(0).getShortName(), "e1"); //$NON-NLS-1$
+        assertEquals(((Symbol)command.getOrderBy().getSortKeys().get(0)).getName(), "e1"); //$NON-NLS-1$
+        assertEquals(((Symbol)command.getProjectedSymbols().get(0)).getShortName(), "e1"); //$NON-NLS-1$
     }
     
     @Test public void testInlineViewWithSubQuery() throws Exception {
         String sql = "select intnum from (select intnum from bqt1.smallb where intnum in (select intnum a from bqt1.smalla)) b"; //$NON-NLS-1$
-        String expected = "SELECT v_0.c_0 FROM (SELECT g_0.intnum AS c_0 FROM bqt1.smallb AS g_0 WHERE g_0.intnum IN (SELECT g_1.intnum FROM bqt1.smalla AS g_1)) AS v_0"; //$NON-NLS-1$
+        String expected = "SELECT v_0.c_0 FROM (SELECT g_0.intnum AS c_0 FROM BQT1.SmallB AS g_0 WHERE g_0.intnum IN (SELECT g_1.intnum FROM BQT1.SmallA AS g_1)) AS v_0"; //$NON-NLS-1$
         helpTest(sql, expected, true, false, RealMetadataFactory.exampleBQTCached());
     }
     
     @Test public void testInlineViewOrderBy() throws Exception {
         String sql = "select intnum from (select intnum from bqt1.smallb) b order by b.intnum"; //$NON-NLS-1$
-        String expected = "SELECT v_0.c_0 FROM (SELECT g_0.intnum AS c_0 FROM bqt1.smallb AS g_0) AS v_0 ORDER BY c_0"; //$NON-NLS-1$
+        String expected = "SELECT v_0.c_0 FROM (SELECT g_0.intnum AS c_0 FROM BQT1.SmallB AS g_0) AS v_0 ORDER BY c_0"; //$NON-NLS-1$
         Command command = helpTest(sql, expected, true, false, RealMetadataFactory.exampleBQTCached());
         LanguageBridgeFactory lbf = new LanguageBridgeFactory(RealMetadataFactory.exampleBQTCached());
         org.teiid.language.Command c = lbf.translate(command);
@@ -94,19 +95,19 @@
     
     @Test public void testNestedInlineViewOrderBy() throws Exception {
         String sql = "select x from (select intnum x from (select intnum from bqt1.smallb) b order by x) y order by x"; //$NON-NLS-1$
-        String expected = "SELECT v_1.c_0 FROM (SELECT v_0.c_0 FROM (SELECT g_0.intnum AS c_0 FROM bqt1.smallb AS g_0) AS v_0) AS v_1 ORDER BY c_0"; //$NON-NLS-1$
+        String expected = "SELECT v_1.c_0 FROM (SELECT v_0.c_0 FROM (SELECT g_0.intnum AS c_0 FROM BQT1.SmallB AS g_0) AS v_0) AS v_1 ORDER BY c_0"; //$NON-NLS-1$
         helpTest(sql, expected, true, false, RealMetadataFactory.exampleBQTCached());
     }
     
     @Test public void testInlineViewWithOnClause() throws Exception {
         String sql = "select abcd.efg from (select intkey as efg from bqt1.smalla) abcd inner join (select intnum from bqt1.smallb) b on (b.intnum = abcd.efg)"; //$NON-NLS-1$
-        String expected = "SELECT v_0.c_0 FROM (SELECT g_0.intkey AS c_0 FROM bqt1.smalla AS g_0) AS v_0 INNER JOIN (SELECT g_1.intnum AS c_0 FROM bqt1.smallb AS g_1) AS v_1 ON v_1.c_0 = v_0.c_0"; //$NON-NLS-1$
+        String expected = "SELECT v_0.c_0 FROM (SELECT g_0.intkey AS c_0 FROM BQT1.SmallA AS g_0) AS v_0 INNER JOIN (SELECT g_1.intnum AS c_0 FROM BQT1.SmallB AS g_1) AS v_1 ON v_1.c_0 = v_0.c_0"; //$NON-NLS-1$
         helpTest(sql, expected, true, false, RealMetadataFactory.exampleBQTCached());
     }
 
     @Test public void testUnionOrderBy() throws Exception {
         String sql = "select e1, e2 as c_0 from pm1.g1 union all select 1, e1 from pm1.g2 order by e1"; //$NON-NLS-1$
-        String expected = "SELECT g_1.e1 AS c_0, g_1.e2 AS c_1 FROM pm1.g1 AS g_1 UNION ALL SELECT '1' AS c_0, g_0.e1 AS c_1 FROM pm1.g2 AS g_0 ORDER BY c_0"; //$NON-NLS-1$
+        String expected = "SELECT g_1.e1 AS c_0, convert(g_1.e2, string) AS c_1 FROM pm1.g1 AS g_1 UNION ALL SELECT '1' AS c_0, g_0.e1 AS c_1 FROM pm1.g2 AS g_0 ORDER BY c_0"; //$NON-NLS-1$
         helpTest(sql, expected, true, false, RealMetadataFactory.example1Cached());
     }
     
@@ -118,19 +119,19 @@
     
     @Test public void testCorrelatedRefernce() throws Exception {
     	String sql = "select intnum, stringnum from (select intnum, stringnum from bqt1.smallb) b where intnum in (select b.stringnum || b.intnum from (select intnum from bqt1.smalla) b) "; //$NON-NLS-1$
-        String expected = "SELECT v_0.c_0, v_0.c_1 FROM (SELECT g_0.intnum AS c_0, g_0.stringnum AS c_1 FROM bqt1.smallb AS g_0) AS v_0 WHERE v_0.c_0 IN (SELECT concat(v_0.c_1, v_1.c_0) FROM (SELECT g_1.intnum AS c_0 FROM bqt1.smalla AS g_1) AS v_1)"; //$NON-NLS-1$
+        String expected = "SELECT v_0.c_0, v_0.c_1 FROM (SELECT g_0.intnum AS c_0, g_0.stringnum AS c_1 FROM BQT1.SmallB AS g_0) AS v_0 WHERE convert(v_0.c_0, string) IN (SELECT concat(v_0.c_1, convert(v_1.c_0, string)) FROM (SELECT g_1.intnum AS c_0 FROM BQT1.SmallA AS g_1) AS v_1)"; //$NON-NLS-1$
         helpTest(sql, expected, true, false, RealMetadataFactory.exampleBQTCached());
     }
 
     @Test public void testCorrelatedRefernce1() throws Exception {
     	String sql = "select intnum, stringnum from bqt1.smallb where intnum in (select stringnum || b.intnum from (select intnum from bqt1.smalla) b) "; //$NON-NLS-1$
-        String expected = "SELECT g_0.intnum, g_0.stringnum FROM bqt1.smallb AS g_0 WHERE g_0.intnum IN (SELECT concat(g_0.stringnum, v_0.c_0) FROM (SELECT g_1.intnum AS c_0 FROM bqt1.smalla AS g_1) AS v_0)"; //$NON-NLS-1$
+        String expected = "SELECT g_0.intnum, g_0.stringnum FROM BQT1.SmallB AS g_0 WHERE convert(g_0.intnum, string) IN (SELECT concat(g_0.stringnum, convert(v_0.c_0, string)) FROM (SELECT g_1.intnum AS c_0 FROM BQT1.SmallA AS g_1) AS v_0)"; //$NON-NLS-1$
         helpTest(sql, expected, true, false, RealMetadataFactory.exampleBQTCached());
     }
     
     @Test public void testGroupAliasNotSupported() throws Exception {
     	String sql = "select b.intkey from bqt1.smalla b"; //$NON-NLS-1$
-        String expected = "SELECT bqt1.smalla.intkey FROM bqt1.smalla"; //$NON-NLS-1$
+        String expected = "SELECT BQT1.SmallA.intkey FROM BQT1.SmallA"; //$NON-NLS-1$
         helpTest(sql, expected, false, false, RealMetadataFactory.exampleBQTCached());
     }
     
@@ -152,6 +153,12 @@
         helpTest(sql, expected, true, false, RealMetadataFactory.exampleBQTCached());
     }
     
+    @Test public void testUnrelatedOrderBy2() throws Exception {
+    	String sql = "SELECT b.IntKey FROM (select intkey, stringkey from BQT1.SmallA) a, (select intkey, stringkey from BQT1.SmallA) b ORDER BY a.StringKey || b.intKey"; //$NON-NLS-1$
+        String expected = "SELECT v_1.c_0 FROM (SELECT g_0.intkey AS c_0, g_0.stringkey AS c_1 FROM BQT1.SmallA AS g_0) AS v_0, (SELECT g_1.intkey AS c_0, g_1.stringkey AS c_1 FROM BQT1.SmallA AS g_1) AS v_1 ORDER BY (v_0.c_1 || v_1.c_0)"; //$NON-NLS-1$
+        helpTest(sql, expected, true, false, RealMetadataFactory.exampleBQTCached());
+    }
+    
     @Test public void testStripAliases() throws Exception {
     	String sql = "select intkey as a, stringkey as b from BQT1.SmallA ORDER BY a, b"; //$NON-NLS-1$
         String expected = "SELECT g_0.intkey, g_0.stringkey FROM BQT1.SmallA AS g_0 ORDER BY g_0.intkey, g_0.stringkey"; //$NON-NLS-1$

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRulePushSelectCriteria.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRulePushSelectCriteria.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRulePushSelectCriteria.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -46,7 +46,7 @@
 import org.teiid.query.parser.QueryParser;
 import org.teiid.query.sql.lang.Command;
 import org.teiid.query.sql.symbol.ElementSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.util.SymbolMap;
 import org.teiid.query.unittest.RealMetadataFactory;
 import org.teiid.query.util.CommandContext;
@@ -77,7 +77,7 @@
     	PlanNode child = p.generatePlan(subCommand, false);
     	PlanNode sourceNode = NodeEditor.findNodePreOrder(root, NodeConstants.Types.SOURCE);
     	sourceNode.addFirstChild(child);
-        sourceNode.setProperty(NodeConstants.Info.SYMBOL_MAP, SymbolMap.createSymbolMap(sourceNode.getGroups().iterator().next(), (List<SingleElementSymbol>)child.getFirstChild().getProperty(Info.PROJECT_COLS), metadata));
+        sourceNode.setProperty(NodeConstants.Info.SYMBOL_MAP, SymbolMap.createSymbolMap(sourceNode.getGroups().iterator().next(), (List<Expression>)child.getFirstChild().getProperty(Info.PROJECT_COLS), metadata));
     	//add a dummy access node
         PlanNode accessNode = NodeFactory.getNewNode(NodeConstants.Types.ACCESS);
         accessNode.addGroups(child.getFirstChild().getGroups());

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/xml/TestXMLNodeMappingVisitor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/xml/TestXMLNodeMappingVisitor.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/xml/TestXMLNodeMappingVisitor.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -66,7 +66,7 @@
         mappingDoc = SourceNodeGenaratorVisitor.extractSourceNodes(mappingDoc);
     
 		// Create criteria
-       	ElementSymbol es = new ElementSymbol("Catalogs.Catalog.Items.Item.Name", null, doc); //$NON-NLS-1$
+       	ElementSymbol es = new ElementSymbol("Catalogs.Catalog.Items.Item.Name", doc); //$NON-NLS-1$
         ResolverVisitor.resolveLanguageObject(es, metadata);
 		CompareCriteria crit = new CompareCriteria(es, CompareCriteria.EQ, new Constant("abc")); //$NON-NLS-1$
 	

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/xml/TestXMLPlanner.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/xml/TestXMLPlanner.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/xml/TestXMLPlanner.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -218,192 +218,45 @@
 
         // Create virtual documents
         // DOC 1
-        Table doc1 = RealMetadataFactory.createXmlDocument("doc1", vm1, doc1()); //$NON-NLS-1$
-        RealMetadataFactory.createElements(
-                doc1,
-                new String[] {
-                    "a0", //$NON-NLS-1$
-                    "a0.a1", //$NON-NLS-1$
-                    "a0.a1.a1", //$NON-NLS-1$
-                    "a0.a1.b1", //$NON-NLS-1$
-                    "a0.a1.c1" }, //$NON-NLS-1$
-                new String[] {
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING });
-
+        RealMetadataFactory.createXmlDocument("doc1", vm1, doc1()); //$NON-NLS-1$
         // DOC 2 
-        Table doc2 = RealMetadataFactory.createXmlDocument("doc2", vm1, doc2()); //$NON-NLS-1$
-        RealMetadataFactory.createElements(
-                doc2,
-                new String[] { "a1" }, //$NON-NLS-1$
-                new String[] { DataTypeManager.DefaultDataTypes.STRING });
-
+        RealMetadataFactory.createXmlDocument("doc2", vm1, doc2()); //$NON-NLS-1$
         // DOC 3
-        Table doc3 = RealMetadataFactory.createXmlDocument("doc3", vm1, doc3()); //$NON-NLS-1$
-        RealMetadataFactory.createElements(
-                doc3,
-                new String[] {
-                    "root", //$NON-NLS-1$
-                    "root.n1", //$NON-NLS-1$
-                    "root.n1.m1", //$NON-NLS-1$
-                    "root.n1.m1.n2", //$NON-NLS-1$
-                    "root.n1.m1.n2.leaf1" }, //$NON-NLS-1$
-                new String[] {
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING });
-
+        RealMetadataFactory.createXmlDocument("doc3", vm1, doc3()); //$NON-NLS-1$
         // DOC 4
-        Table doc4 = RealMetadataFactory.createXmlDocument("doc4", vm1, doc4()); //$NON-NLS-1$
-        RealMetadataFactory.createElements(
-                doc4,
-                new String[] {
-                    "root", //$NON-NLS-1$
-                    "root.n4a", //$NON-NLS-1$
-                    "root.n4a.n4b", //$NON-NLS-1$
-                    "root.n4a.n4c", //$NON-NLS-1$
-                    "root.n4a.fake", //$NON-NLS-1$
-                    "root.n4a.n4c.n4d", //$NON-NLS-1$
-                    "root.n4a.n4c.n4e", //$NON-NLS-1$
-                    "root.n4a.n4c.n4e.n4f" }, //$NON-NLS-1$
-                new String[] {
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING });
-
+        RealMetadataFactory.createXmlDocument("doc4", vm1, doc4()); //$NON-NLS-1$
         // DOC 5
-        Table doc5 = RealMetadataFactory.createXmlDocument("doc5", vm1, doc5()); //$NON-NLS-1$
-        RealMetadataFactory.createElements(
-                doc5,
-                new String[] {
-                    "root", //$NON-NLS-1$
-                    "root.nodea", //$NON-NLS-1$
-                    "root.nodea.nodeb", //$NON-NLS-1$
-                    "root.nodea.nodec", //$NON-NLS-1$
-                    "root.nodea.nodec.noded", //$NON-NLS-1$
-                    "root.nodea.nodec.nodee", //$NON-NLS-1$
-                    "root.nodea.nodec.nodee.nodef", //$NON-NLS-1$
-                    "root.nodea.nodec.nodee.nodeg", //$NON-NLS-1$
-                    "root.nodea.nodec.nodee.nodeg.nodeh", //$NON-NLS-1$
-                    "root.nodea.nodec.nodee.nodeg.nodeI", //$NON-NLS-1$
-                    "root.nodea.nodec.nodee.nodeg.nodeI.nodeJ" }, //$NON-NLS-1$
-                new String[] {
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING });
-
+        RealMetadataFactory.createXmlDocument("doc5", vm1, doc5()); //$NON-NLS-1$
         // DOC 6
-        Table doc6 = RealMetadataFactory.createXmlDocument("doc6", vm1, doc6()); //$NON-NLS-1$
-        RealMetadataFactory.createElements(
-                doc6,
-                new String[] { "tempGroupTest" }, //$NON-NLS-1$
-                new String[] { DataTypeManager.DefaultDataTypes.STRING });
+        RealMetadataFactory.createXmlDocument("doc6", vm1, doc6()); //$NON-NLS-1$
 
         // DOC with excluded fragment
-        Table docWithExcluded = RealMetadataFactory.createXmlDocument(
+        RealMetadataFactory.createXmlDocument(
                 "vm1.docWithExcluded", //$NON-NLS-1$
                 vm1,
                 docWithExcluded());
-        RealMetadataFactory.createElements(
-                docWithExcluded,
-                new String[] {
-                    "root", //$NON-NLS-1$
-                    "root.n1", //$NON-NLS-1$
-                    "root.n1.m1", //$NON-NLS-1$
-                    "root.n1.m1.n2", //$NON-NLS-1$
-                    "root.n1.m1.n2.leaf1" }, //$NON-NLS-1$
-                new String[] {
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING });
 
         // DOC 2 with excluded fragment
-        Table doc2WithExcluded = RealMetadataFactory.createXmlDocument(
+        RealMetadataFactory.createXmlDocument(
                 "vm1.docWithExcluded2", //$NON-NLS-1$
                 vm1,
                 docWithExcluded2());
-        RealMetadataFactory.createElements(
-                doc2WithExcluded,
-                new String[] {
-                    "root", //$NON-NLS-1$
-                    "root.n1", //$NON-NLS-1$
-                    "root.n1.m1", //$NON-NLS-1$
-                    "root.n1.m2", //$NON-NLS-1$
-                    "root.n1.m3" }, //$NON-NLS-1$
-                new String[] {
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING });
 
-
         // DOC with attribute
-        Table docWithAttribute = RealMetadataFactory.createXmlDocument(
+        RealMetadataFactory.createXmlDocument(
                 "vm1.docWithAttribute", //$NON-NLS-1$
                 vm1,
                 docTestConvertCriteriaWithAttribute());
-        Table docWithAttribute3 = RealMetadataFactory.createXmlDocument(
+        RealMetadataFactory.createXmlDocument(
                 "vm1.docWithAttribute3", //$NON-NLS-1$
                 vm1,
                 docTestCriteriaWithAttribute());
-        RealMetadataFactory.createElements(
-               docWithAttribute,
-                new String[] {
-                    "root", //$NON-NLS-1$
-                    "root.myElement", //$NON-NLS-1$
-                    "root. at myAttribute"}, //$NON-NLS-1$
-                new String[] {
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING });
         // DOC with attribute2
-        Table docWithAttribute2 = RealMetadataFactory.createXmlDocument(
+        RealMetadataFactory.createXmlDocument(
                 "vm1.docWithAttribute2", //$NON-NLS-1$
                 vm1,
                 docTestConvertCriteriaWithAttribute2());
-        RealMetadataFactory.createElements(
-                docWithAttribute2,
-                new String[] {
-                    "root", //$NON-NLS-1$
-                    "root.myElement", //$NON-NLS-1$
-                    "root. at myAttribute"}, //$NON-NLS-1$
-                new String[] {
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING });
         
-        RealMetadataFactory.createElements(
-                docWithAttribute3,
-                new String[] {
-                    "root", //$NON-NLS-1$
-                    "root.myElement", //$NON-NLS-1$
-                    "root. at type"}, //$NON-NLS-1$
-                new String[] {
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING,
-                    DataTypeManager.DefaultDataTypes.STRING });
-        
         // Create the facade from the store
         return RealMetadataFactory.createTransformationMetadata(metadataStore, "example1");
     }

Modified: trunk/engine/src/test/java/org/teiid/query/parser/TestParser.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/parser/TestParser.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/parser/TestParser.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -47,6 +47,7 @@
 import org.teiid.query.sql.proc.*;
 import org.teiid.query.sql.proc.BranchingStatement.BranchingMode;
 import org.teiid.query.sql.symbol.*;
+import org.teiid.query.sql.util.SymbolMap;
 
 @SuppressWarnings("nls")
 public class TestParser {
@@ -506,9 +507,8 @@
 		from.addGroup(g);
 
 		Function f = new Function("CONVERT", new Expression[] {new ElementSymbol("a", false), new Constant("string")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-		ExpressionSymbol es = new ExpressionSymbol("expr", f); //$NON-NLS-1$
 		Select select = new Select();
-		select.addSymbol(es);
+		select.addSymbol(f);
 
 		Query query = new Query();
 		query.setSelect(select);
@@ -526,9 +526,8 @@
 
 		Function f = new Function("CONVERT", new Expression[] {new ElementSymbol("a", false), new Constant("timestamp")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 		Function f2 = new Function("CONVERT", new Expression[] {f, new Constant("string")}); //$NON-NLS-1$ //$NON-NLS-2$
-		ExpressionSymbol es = new ExpressionSymbol("expr", f2); //$NON-NLS-1$
 		Select select = new Select();
-		select.addSymbol(es);
+		select.addSymbol(f2);
 
 		Query query = new Query();
 		query.setSelect(select);
@@ -549,9 +548,8 @@
 		Function f = new Function("concat", new Expression[] {new ElementSymbol("a", false), new Constant("x")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 		Function f2 = new Function("length", new Expression[] {f}); //$NON-NLS-1$
 		Function f3 = new Function("+", new Expression[] {new Constant(new Integer(5)), f2}); //$NON-NLS-1$
-		ExpressionSymbol es = new ExpressionSymbol("expr", f3); //$NON-NLS-1$
 		Select select = new Select();
-		select.addSymbol(es);
+		select.addSymbol(f3);
 
 		Query query = new Query();
 		query.setSelect(select);
@@ -568,8 +566,7 @@
 		from.addGroup(g);
 
 		Function f = new Function("replace", new Expression[] {new ElementSymbol("a", false), new Constant("x"), new Constant("y")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-		ExpressionSymbol es = new ExpressionSymbol("y", f); //$NON-NLS-1$
-		AliasSymbol as = new AliasSymbol("y", es); //$NON-NLS-1$
+		AliasSymbol as = new AliasSymbol("y", f); //$NON-NLS-1$
 		Select select = new Select();
 		select.addSymbol(as);
 
@@ -588,9 +585,8 @@
 		from.addGroup(g);
 
 		Function f = new Function("cast", new Expression[] {new ElementSymbol("a", false), new Constant("string")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 
-		ExpressionSymbol es = new ExpressionSymbol("expr", f); //$NON-NLS-1$
 		Select select = new Select();
-		select.addSymbol(es);
+		select.addSymbol(f);
 
 		Query query = new Query();
 		query.setSelect(select);
@@ -608,9 +604,8 @@
 
 		Function f = new Function("cast", new Expression[] {new ElementSymbol("a", false), new Constant("timestamp")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 
 		Function f2 = new Function("cast", new Expression[] {f, new Constant("string")}); //$NON-NLS-1$ //$NON-NLS-2$
-		ExpressionSymbol es = new ExpressionSymbol("expr", f2); //$NON-NLS-1$
 		Select select = new Select();
-		select.addSymbol(es);
+		select.addSymbol(f2);
 
 		Query query = new Query();
 		query.setSelect(select);
@@ -627,8 +622,7 @@
         from.addGroup(g);
 
         Function f = new Function("left", new Expression[] {new ElementSymbol("fullname", false), new Constant(new Integer(3))}); //$NON-NLS-1$ //$NON-NLS-2$
-        ExpressionSymbol es = new ExpressionSymbol("expr", f); //$NON-NLS-1$
-        AliasSymbol as = new AliasSymbol("x", es); //$NON-NLS-1$
+        AliasSymbol as = new AliasSymbol("x", f); //$NON-NLS-1$
         Select select = new Select();
         select.addSymbol(as);
 
@@ -647,8 +641,7 @@
         from.addGroup(g);
 
         Function f = new Function("right", new Expression[] {new ElementSymbol("fullname", false), new Constant(new Integer(3))}); //$NON-NLS-1$ //$NON-NLS-2$
-        ExpressionSymbol es = new ExpressionSymbol("expr", f); //$NON-NLS-1$
-        AliasSymbol as = new AliasSymbol("x", es); //$NON-NLS-1$
+        AliasSymbol as = new AliasSymbol("x", f); //$NON-NLS-1$
         Select select = new Select();
         select.addSymbol(as);
 
@@ -667,8 +660,7 @@
         from.addGroup(g);
 
         Function f = new Function("char", new Expression[] { new Constant("x")}); //$NON-NLS-1$ //$NON-NLS-2$
-        ExpressionSymbol es = new ExpressionSymbol("expr", f); //$NON-NLS-1$
-        AliasSymbol as = new AliasSymbol("x", es); //$NON-NLS-1$
+        AliasSymbol as = new AliasSymbol("x", f); //$NON-NLS-1$
         Select select = new Select();
         select.addSymbol(as);
 
@@ -687,8 +679,7 @@
         from.addGroup(g);
 
         Function f = new Function("insert", new Expression[] { new Constant("x"), new Constant(new Integer(1)), new Constant("a")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        ExpressionSymbol es = new ExpressionSymbol("expr", f); //$NON-NLS-1$
-        AliasSymbol as = new AliasSymbol("x", es); //$NON-NLS-1$
+        AliasSymbol as = new AliasSymbol("x", f); //$NON-NLS-1$
         Select select = new Select();
         select.addSymbol(as);
 
@@ -712,8 +703,7 @@
         insert.setGroup(groupSymbol);
         
         Select select = new Select();
-//        select.addSymbol( new ExpressionSymbol( new Constant( new Integer(1) ) ) );
-        select.addSymbol(  new ExpressionSymbol( "exp", new Constant( new Integer(1) ) ) );    //$NON-NLS-1$
+        select.addSymbol( new Constant( 1 ) );    //$NON-NLS-1$
 
         Query query = new Query();
         query.setSelect(select);
@@ -732,9 +722,8 @@
         from.addGroup(g);
 
         Function f = new Function("translate", new Expression[] { new Constant("x"), new Constant("x"), new Constant("y")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-        ExpressionSymbol es = new ExpressionSymbol("expr", f); //$NON-NLS-1$
         Select select = new Select();
-        select.addSymbol(es);
+        select.addSymbol(f);
 
         Query query = new Query();
         query.setSelect(select);
@@ -752,8 +741,7 @@
 
         Function f = new Function("timestampadd", new Expression[] { //$NON-NLS-1$
             new Constant("SQL_TSI_FRAC_SECOND"), new Constant(new Integer(10)), new Constant("2003-05-01 10:20:30")}); //$NON-NLS-1$ //$NON-NLS-2$
-        ExpressionSymbol es = new ExpressionSymbol("expr", f); //$NON-NLS-1$
-        AliasSymbol as = new AliasSymbol("x", es); //$NON-NLS-1$
+        AliasSymbol as = new AliasSymbol("x", f); //$NON-NLS-1$
         Select select = new Select();
         select.addSymbol(as);
 
@@ -773,8 +761,7 @@
 
         Function f = new Function("timestampadd", new Expression[] { //$NON-NLS-1$
             new Constant("SQL_TSI_SECOND"), new Constant(new Integer(10)), new Constant("2003-05-01 10:20:30")}); //$NON-NLS-1$ //$NON-NLS-2$
-        ExpressionSymbol es = new ExpressionSymbol("expr", f); //$NON-NLS-1$
-        AliasSymbol as = new AliasSymbol("x", es); //$NON-NLS-1$
+        AliasSymbol as = new AliasSymbol("x", f); //$NON-NLS-1$
         Select select = new Select();
         select.addSymbol(as);
 
@@ -794,8 +781,7 @@
 
         Function f = new Function("timestampadd", new Expression[] { //$NON-NLS-1$
             new Constant("SQL_TSI_MINUTE"), new Constant(new Integer(10)), new Constant("2003-05-01 10:20:30")}); //$NON-NLS-1$ //$NON-NLS-2$
-        ExpressionSymbol es = new ExpressionSymbol("expr", f); //$NON-NLS-1$
-        AliasSymbol as = new AliasSymbol("x", es); //$NON-NLS-1$
+        AliasSymbol as = new AliasSymbol("x", f); //$NON-NLS-1$
         Select select = new Select();
         select.addSymbol(as);
 
@@ -815,8 +801,7 @@
 
         Function f = new Function("timestampadd", new Expression[] { //$NON-NLS-1$
             new Constant("SQL_TSI_HOUR"), new Constant(new Integer(10)), new Constant("2003-05-01 10:20:30")}); //$NON-NLS-1$ //$NON-NLS-2$
-        ExpressionSymbol es = new ExpressionSymbol("expr", f); //$NON-NLS-1$
-        AliasSymbol as = new AliasSymbol("x", es); //$NON-NLS-1$
+        AliasSymbol as = new AliasSymbol("x", f); //$NON-NLS-1$
         Select select = new Select();
         select.addSymbol(as);
 
@@ -836,8 +821,7 @@
 
         Function f = new Function("timestampadd", new Expression[] { //$NON-NLS-1$
             new Constant("SQL_TSI_DAY"), new Constant(new Integer(10)), new Constant("2003-05-01 10:20:30")}); //$NON-NLS-1$ //$NON-NLS-2$
-        ExpressionSymbol es = new ExpressionSymbol("expr", f); //$NON-NLS-1$
-        AliasSymbol as = new AliasSymbol("x", es); //$NON-NLS-1$
+        AliasSymbol as = new AliasSymbol("x", f); //$NON-NLS-1$
         Select select = new Select();
         select.addSymbol(as);
 
@@ -857,8 +841,7 @@
 
         Function f = new Function("timestampadd", new Expression[] { //$NON-NLS-1$
             new Constant("SQL_TSI_WEEK"), new Constant(new Integer(10)), new Constant("2003-05-01 10:20:30")}); //$NON-NLS-1$ //$NON-NLS-2$
-        ExpressionSymbol es = new ExpressionSymbol("expr", f); //$NON-NLS-1$
-        AliasSymbol as = new AliasSymbol("x", es); //$NON-NLS-1$
+        AliasSymbol as = new AliasSymbol("x", f); //$NON-NLS-1$
         Select select = new Select();
         select.addSymbol(as);
 
@@ -878,8 +861,7 @@
 
         Function f = new Function("timestampadd", new Expression[] { //$NON-NLS-1$
             new Constant("SQL_TSI_QUARTER"), new Constant(new Integer(10)), new Constant("2003-05-01 10:20:30")}); //$NON-NLS-1$ //$NON-NLS-2$
-        ExpressionSymbol es = new ExpressionSymbol("expr", f); //$NON-NLS-1$
-        AliasSymbol as = new AliasSymbol("x", es); //$NON-NLS-1$
+        AliasSymbol as = new AliasSymbol("x", f); //$NON-NLS-1$
         Select select = new Select();
         select.addSymbol(as);
 
@@ -899,8 +881,7 @@
 
         Function f = new Function("timestampadd", new Expression[] { //$NON-NLS-1$
             new Constant("SQL_TSI_YEAR"), new Constant(new Integer(10)), new Constant("2003-05-01 10:20:30")}); //$NON-NLS-1$ //$NON-NLS-2$
-        ExpressionSymbol es = new ExpressionSymbol("expr", f); //$NON-NLS-1$
-        AliasSymbol as = new AliasSymbol("x", es); //$NON-NLS-1$
+        AliasSymbol as = new AliasSymbol("x", f); //$NON-NLS-1$
         Select select = new Select();
         select.addSymbol(as);
 
@@ -920,8 +901,7 @@
 
         Function f = new Function("timestampdiff", new Expression[] { //$NON-NLS-1$
             new Constant("SQL_TSI_FRAC_SECOND"), new Constant("2003-05-01 10:20:10"), new Constant("2003-05-01 10:20:30")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        ExpressionSymbol es = new ExpressionSymbol("expr", f); //$NON-NLS-1$
-        AliasSymbol as = new AliasSymbol("x", es); //$NON-NLS-1$
+        AliasSymbol as = new AliasSymbol("x", f); //$NON-NLS-1$
         Select select = new Select();
         select.addSymbol(as);
 
@@ -941,9 +921,8 @@
 
         Function f = new Function("+", new Expression[] {new Constant(new Integer(5)), new Constant(new Integer(2))}); //$NON-NLS-1$
         Function f2 = new Function("+", new Expression[] {f, new Constant(new Integer(3))}); //$NON-NLS-1$
-        ExpressionSymbol es = new ExpressionSymbol("expr", f2); //$NON-NLS-1$
         Select select = new Select();
-        select.addSymbol(es);
+        select.addSymbol(f2);
 
         Query query = new Query();
         query.setSelect(select);
@@ -961,9 +940,8 @@
 
         Function f = new Function("+", new Expression[] {new Constant(new Integer(5)), new Constant(new Integer(2))}); //$NON-NLS-1$
         Function f2 = new Function("-", new Expression[] {f, new Constant(new Integer(3))}); //$NON-NLS-1$
-        ExpressionSymbol es = new ExpressionSymbol("expr", f2); //$NON-NLS-1$
         Select select = new Select();
-        select.addSymbol(es);
+        select.addSymbol(f2);
 
         Query query = new Query();
         query.setSelect(select);
@@ -982,9 +960,8 @@
         Function f = new Function("*", new Expression[] {new Constant(new Integer(2)), new Constant(new Integer(3))}); //$NON-NLS-1$
         Function f2 = new Function("+", new Expression[] {new Constant(new Integer(5)), f}); //$NON-NLS-1$
         
-        ExpressionSymbol es = new ExpressionSymbol("expr", f2); //$NON-NLS-1$
         Select select = new Select();
-        select.addSymbol(es);
+        select.addSymbol(f2);
 
         Query query = new Query();
         query.setSelect(select);
@@ -1002,9 +979,8 @@
 
         Function f = new Function("*", new Expression[] {new Constant(new Integer(5)), new Constant(new Integer(2))}); //$NON-NLS-1$
         Function f2 = new Function("+", new Expression[] {f, new Constant(new Integer(3))}); //$NON-NLS-1$
-        ExpressionSymbol es = new ExpressionSymbol("expr", f2); //$NON-NLS-1$
         Select select = new Select();
-        select.addSymbol(es);
+        select.addSymbol(f2);
 
         Query query = new Query();
         query.setSelect(select);
@@ -1022,9 +998,8 @@
 
         Function f = new Function("*", new Expression[] {new Constant(new Integer(5)), new Constant(new Integer(2))}); //$NON-NLS-1$
         Function f2 = new Function("*", new Expression[] {f, new Constant(new Integer(3))}); //$NON-NLS-1$
-        ExpressionSymbol es = new ExpressionSymbol("expr", f2); //$NON-NLS-1$
         Select select = new Select();
-        select.addSymbol(es);
+        select.addSymbol(f2);
 
         Query query = new Query();
         query.setSelect(select);
@@ -1044,9 +1019,8 @@
         Function f2 = new Function("*", new Expression[] {new Constant(new Integer(4)), new Constant(new Integer(5))}); //$NON-NLS-1$
         Function f3 = new Function("+", new Expression[] {new Constant(new Integer(1)), f}); //$NON-NLS-1$
         Function f4 = new Function("+", new Expression[] {f3, f2}); //$NON-NLS-1$
-        ExpressionSymbol es = new ExpressionSymbol("expr", f4); //$NON-NLS-1$
         Select select = new Select();
-        select.addSymbol(es);
+        select.addSymbol(f4);
 
         Query query = new Query();
         query.setSelect(select);
@@ -1066,9 +1040,8 @@
         Function f2 = new Function("*", new Expression[] {new Constant(new Integer(3)), new Constant(new Integer(4))}); //$NON-NLS-1$
         Function f3 = new Function("+", new Expression[] {f, f2}); //$NON-NLS-1$
         Function f4 = new Function("+", new Expression[] {f3, new Constant(new Integer(5))}); //$NON-NLS-1$
-        ExpressionSymbol es = new ExpressionSymbol("expr", f4); //$NON-NLS-1$
         Select select = new Select();
-        select.addSymbol(es);
+        select.addSymbol(f4);
 
         Query query = new Query();
         query.setSelect(select);
@@ -1087,9 +1060,8 @@
         Function f = new Function("-", new Expression[] {new Constant(new Integer(5)), new Constant(new Integer(4))}); //$NON-NLS-1$
         Function f2 = new Function("-", new Expression[] {f, new Constant(new Integer(3))}); //$NON-NLS-1$
         Function f3 = new Function("-", new Expression[] {f2, new Constant(new Integer(2))}); //$NON-NLS-1$
-        ExpressionSymbol es = new ExpressionSymbol("expr", f3); //$NON-NLS-1$
         Select select = new Select();
-        select.addSymbol(es);
+        select.addSymbol(f3);
 
         Query query = new Query();
         query.setSelect(select);
@@ -1108,9 +1080,8 @@
         Function f = new Function("/", new Expression[] {new Constant(new Integer(5)), new Constant(new Integer(4))}); //$NON-NLS-1$
         Function f2 = new Function("/", new Expression[] {f, new Constant(new Integer(3))}); //$NON-NLS-1$
         Function f3 = new Function("/", new Expression[] {f2, new Constant(new Integer(2))}); //$NON-NLS-1$
-        ExpressionSymbol es = new ExpressionSymbol("expr", f3); //$NON-NLS-1$
         Select select = new Select();
-        select.addSymbol(es);
+        select.addSymbol(f3);
 
         Query query = new Query();
         query.setSelect(select);
@@ -1128,9 +1099,8 @@
 
         Function f = new Function("||", new Expression[] {new Constant("a"), new Constant("b")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
         Function f2 = new Function("||", new Expression[] {f, new Constant("c")}); //$NON-NLS-1$ //$NON-NLS-2$
-        ExpressionSymbol es = new ExpressionSymbol("expr", f2); //$NON-NLS-1$
         Select select = new Select();
-        select.addSymbol(es);
+        select.addSymbol(f2);
 
         Query query = new Query();
         query.setSelect(select);
@@ -1150,9 +1120,8 @@
         Function f2 = new Function("+", new Expression[] {new Constant(new Integer(5)), f}); //$NON-NLS-1$
         Function f3 = new Function("+", new Expression[] {new Constant(new Integer(2)), new Constant(new Integer(3))}); //$NON-NLS-1$
         Function f4 = new Function("||", new Expression[] {f3, f2}); //$NON-NLS-1$
-        ExpressionSymbol es = new ExpressionSymbol("expr", f4); //$NON-NLS-1$
         Select select = new Select();
-        select.addSymbol(es);
+        select.addSymbol(f4);
 
         Query query = new Query();
         query.setSelect(select);
@@ -1337,8 +1306,7 @@
         AggregateSymbol agg1 = new AggregateSymbol("count", "COUNT", false, new ElementSymbol("a", false)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
         AggregateSymbol agg2 = new AggregateSymbol("sum", "SUM", false, new ElementSymbol("a", false)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
         Function f = new Function("*", new Expression[] { agg1, agg2 }); //$NON-NLS-1$
-        ExpressionSymbol expr = new ExpressionSymbol("expr", f); //$NON-NLS-1$
-        AliasSymbol alias = new AliasSymbol("c", expr); //$NON-NLS-1$
+        AliasSymbol alias = new AliasSymbol("c", f); //$NON-NLS-1$
         select.addSymbol(alias);        
                 
         Query query = new Query();
@@ -1357,9 +1325,7 @@
 		from.addGroup(g);
 
 		Select select = new Select();
-		select.addSymbol(new ExpressionSymbol(
-			"expr",  //$NON-NLS-1$
-			new Function("-", new Expression[] { new Constant(new Integer(5)), new Constant(null) }) ) ); //$NON-NLS-1$
+		select.addSymbol(new Function("-", new Expression[] { new Constant(new Integer(5)), new Constant(null) }) ); //$NON-NLS-1$
 		select.addSymbol(new ElementSymbol("a.g1.c1")); //$NON-NLS-1$
 						
 		Query query = new Query();
@@ -1378,7 +1344,7 @@
 		from.addGroup(g);
 
 		Select select = new Select();
-		select.addSymbol(new ExpressionSymbol("expr", new Constant("abc"))); //$NON-NLS-1$ //$NON-NLS-2$
+		select.addSymbol(new Constant("abc")); //$NON-NLS-1$ //$NON-NLS-2$
 						
 		Query query = new Query();
 		query.setSelect(select);
@@ -1397,7 +1363,7 @@
 		from.addGroup(g);
 
 		Select select = new Select();
-		select.addSymbol(new ExpressionSymbol("expr", new Constant("O'Leary"))); //$NON-NLS-1$ //$NON-NLS-2$
+		select.addSymbol(new Constant("O'Leary")); //$NON-NLS-1$ //$NON-NLS-2$
 						
 		Query query = new Query();
 		query.setSelect(select);
@@ -1415,7 +1381,7 @@
 		from.addGroup(g);
 
 		Select select = new Select();
-		select.addSymbol(new ExpressionSymbol("expr", new Constant("'abc'"))); //$NON-NLS-1$ //$NON-NLS-2$
+		select.addSymbol(new Constant("'abc'")); //$NON-NLS-1$ //$NON-NLS-2$
 						
 		Query query = new Query();
 		query.setSelect(select);
@@ -1433,7 +1399,7 @@
 		from.addGroup(g);
 
 		Select select = new Select();
-		select.addSymbol(new ExpressionSymbol("expr", new Constant("a'b'c"))); //$NON-NLS-1$ //$NON-NLS-2$
+		select.addSymbol(new Constant("a'b'c")); //$NON-NLS-1$ //$NON-NLS-2$
 						
 		Query query = new Query();
 		query.setSelect(select);
@@ -1469,7 +1435,7 @@
 		from.addGroup(g);
 
 		Select select = new Select();
-		select.addSymbol(new ExpressionSymbol("expr", new Constant(new Long(123456789012L)))); //$NON-NLS-1$
+		select.addSymbol(new Constant(new Long(123456789012L))); //$NON-NLS-1$
 						
 		Query query = new Query();
 		query.setSelect(select);
@@ -1487,7 +1453,7 @@
 		from.addGroup(g);
 
 		Select select = new Select();
-		select.addSymbol(new ExpressionSymbol("expr", new Constant(new BigInteger("1000000000000000000000000")))); //$NON-NLS-1$ //$NON-NLS-2$
+		select.addSymbol(new Constant(new BigInteger("1000000000000000000000000"))); //$NON-NLS-1$ //$NON-NLS-2$
 						
 		Query query = new Query();
 		query.setSelect(select);
@@ -1505,7 +1471,7 @@
 		from.addGroup(g);
 
 		Select select = new Select();
-		select.addSymbol(new ExpressionSymbol("expr", new Constant(new Double(1.3e8)))); //$NON-NLS-1$
+		select.addSymbol(new Constant(new Double(1.3e8))); //$NON-NLS-1$
 						
 		Query query = new Query();
 		query.setSelect(select);
@@ -1523,7 +1489,7 @@
 		from.addGroup(g);
 
 		Select select = new Select();
-		select.addSymbol(new ExpressionSymbol("expr", new Constant(new Double(-1.3e-6)))); //$NON-NLS-1$
+		select.addSymbol(new Constant(new Double(-1.3e-6))); //$NON-NLS-1$
 						
 		Query query = new Query();
 		query.setSelect(select);
@@ -1541,7 +1507,7 @@
 		from.addGroup(g);
 
 		Select select = new Select();
-		select.addSymbol(new ExpressionSymbol("expr", new Constant(new Double(-1.3e+8)))); //$NON-NLS-1$
+		select.addSymbol(new Constant(new Double(-1.3e+8))); //$NON-NLS-1$
 						
 		Query query = new Query();
 		query.setSelect(select);
@@ -1559,7 +1525,7 @@
         from.addGroup(g);
 
         Select select = new Select();
-        select.addSymbol(new ExpressionSymbol("expr", new Constant(java.sql.Date.valueOf("2002-10-02")))); //$NON-NLS-1$ //$NON-NLS-2$
+        select.addSymbol(new Constant(java.sql.Date.valueOf("2002-10-02"))); //$NON-NLS-1$ //$NON-NLS-2$
                         
         Query query = new Query();
         query.setSelect(select);
@@ -1577,7 +1543,7 @@
         from.addGroup(g);
 
         Select select = new Select();
-        select.addSymbol(new ExpressionSymbol("expr", new Constant(java.sql.Date.valueOf("2002-09-01")))); //$NON-NLS-1$ //$NON-NLS-2$
+        select.addSymbol(new Constant(java.sql.Date.valueOf("2002-09-01"))); //$NON-NLS-1$ //$NON-NLS-2$
                         
         Query query = new Query();
         query.setSelect(select);
@@ -1600,7 +1566,7 @@
         from.addGroup(g);
 
         Select select = new Select();
-        select.addSymbol(new ExpressionSymbol("expr", new Constant(java.sql.Time.valueOf("11:10:00")))); //$NON-NLS-1$ //$NON-NLS-2$
+        select.addSymbol(new Constant(java.sql.Time.valueOf("11:10:00"))); //$NON-NLS-1$ //$NON-NLS-2$
                         
         Query query = new Query();
         query.setSelect(select);
@@ -1618,7 +1584,7 @@
         from.addGroup(g);
 
         Select select = new Select();
-        select.addSymbol(new ExpressionSymbol("expr", new Constant(java.sql.Time.valueOf("5:10:00")))); //$NON-NLS-1$ //$NON-NLS-2$
+        select.addSymbol(new Constant(java.sql.Time.valueOf("5:10:00"))); //$NON-NLS-1$ //$NON-NLS-2$
                         
         Query query = new Query();
         query.setSelect(select);
@@ -1641,7 +1607,7 @@
         from.addGroup(g);
 
         Select select = new Select();
-        select.addSymbol(new ExpressionSymbol("expr", new Constant(java.sql.Timestamp.valueOf("2002-10-02 19:00:02.50")))); //$NON-NLS-1$ //$NON-NLS-2$
+        select.addSymbol(new Constant(java.sql.Timestamp.valueOf("2002-10-02 19:00:02.50"))); //$NON-NLS-1$ //$NON-NLS-2$
                         
         Query query = new Query();
         query.setSelect(select);
@@ -1665,7 +1631,7 @@
 	private void helpTestLiteral(Boolean expected, Class<?> expectedType,
 			String sql, String expectedSql) {
 		Select select = new Select();
-        select.addSymbol(new ExpressionSymbol("expr", new Constant(expected, expectedType))); //$NON-NLS-1$
+        select.addSymbol(new Constant(expected, expectedType)); //$NON-NLS-1$
                         
         Query query = new Query();
         query.setSelect(select);
@@ -2103,7 +2069,7 @@
 		from.addGroup(g);
 
 		Select select = new Select();
-		select.addSymbol(new ExpressionSymbol("expr", new Constant("g\".\"a"))); //$NON-NLS-1$ //$NON-NLS-2$
+		select.addSymbol(new Constant("g\".\"a")); //$NON-NLS-1$ //$NON-NLS-2$
 
 		Query query = new Query();
 		query.setSelect(select);
@@ -2724,9 +2690,8 @@
     @Test public void testNoFromClause(){
         Select select = new Select();
         ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$
-        ExpressionSymbol b = new ExpressionSymbol("expr", new Constant(new Integer(5), Integer.class)); //$NON-NLS-1$
         select.addSymbol(a);
-        select.addSymbol(b);
+        select.addSymbol(new Constant(new Integer(5), Integer.class));
         Query query = new Query();
         query.setSelect(select);
         helpTest("SELECT a, 5", "SELECT a, 5", query);       //$NON-NLS-1$ //$NON-NLS-2$
@@ -2752,7 +2717,7 @@
 	/** SELECT a or b from g */
 	@Test public void testOrInSelect(){
 		Query query = new Query();
-		query.setSelect(new Select(Arrays.asList(new ExpressionSymbol("foo", new CompoundCriteria(CompoundCriteria.OR, Arrays.asList(new ExpressionCriteria(new ElementSymbol("a")), new ExpressionCriteria(new ElementSymbol("b")))))))); 
+		query.setSelect(new Select(Arrays.asList(new CompoundCriteria(CompoundCriteria.OR, Arrays.asList(new ExpressionCriteria(new ElementSymbol("a")), new ExpressionCriteria(new ElementSymbol("b"))))))); 
 		helpTest("select a or b", "SELECT (a) OR (b)", query);
 	}
 	
@@ -2835,8 +2800,7 @@
 
         Select select = new Select();
         Reference ref0 = new Reference(0);
-        ExpressionSymbol expr = new ExpressionSymbol("expr", ref0); //$NON-NLS-1$
-        select.addSymbol(expr);
+        select.addSymbol(ref0);
 
         Reference ref1 = new Reference(1);
         Criteria crit = new MatchCriteria(new ElementSymbol("b"), ref1); //$NON-NLS-1$
@@ -2984,7 +2948,7 @@
         from.addClause(sfc);
         
         Select select = new Select();
-        select.addSymbol(new ElementSymbol("x.a")); //$NON-NLS-1$
+        select.addSymbol(new ElementSymbol("X.A")); //$NON-NLS-1$
         
         Query query = new Query();
         query.setSelect(select);
@@ -3012,7 +2976,7 @@
         from.addClause(sfc);
         
         Select select = new Select();
-        select.addSymbol(new ElementSymbol("x.a")); //$NON-NLS-1$
+        select.addSymbol(new ElementSymbol("X.A")); //$NON-NLS-1$
         
         Query query = new Query();
         query.setSelect(select);
@@ -3487,7 +3451,7 @@
 		Query query = new Query();
 		Select select = new Select();
 		Constant c = new Constant("\u05e0"); //$NON-NLS-1$
-		select.addSymbol(new ExpressionSymbol("expr", c)); //$NON-NLS-1$
+		select.addSymbol(c); //$NON-NLS-1$
 		query.setSelect(select);
 
 		helpTest(sql, query.toString(), query);
@@ -3587,8 +3551,7 @@
         Query query = new Query();
         Select select = new Select();
         Function func1 = new Function("yowza_yowza", new Expression[] { }); //$NON-NLS-1$
-        ExpressionSymbol exprSymbol = new ExpressionSymbol("expr", func1); //$NON-NLS-1$
-        select.addSymbol(exprSymbol);        
+        select.addSymbol(func1);        
         query.setSelect(select);
         
         From from = new From();
@@ -3911,7 +3874,7 @@
 
         Select s2 = new Select();
         s2.addSymbol(new ElementSymbol("e1")); //$NON-NLS-1$
-        s2.addSymbol(new ExpressionSymbol("expr", new ScalarSubquery(q1))); //$NON-NLS-1$
+        s2.addSymbol(new ScalarSubquery(q1)); //$NON-NLS-1$
         From f2 = new From();
         f2.addGroup(new GroupSymbol("m.g2"));        //$NON-NLS-1$
         Query q2 = new Query();
@@ -3934,7 +3897,7 @@
         q1.setFrom(f1);
 
         Select s2 = new Select();
-        s2.addSymbol(new ExpressionSymbol("expr", new ScalarSubquery(q1))); //$NON-NLS-1$
+        s2.addSymbol(new ScalarSubquery(q1)); //$NON-NLS-1$
         From f2 = new From();
         f2.addGroup(new GroupSymbol("m.g2"));        //$NON-NLS-1$
         Query q2 = new Query();
@@ -3957,7 +3920,7 @@
         q1.setFrom(f1);
 
         Select s2 = new Select();
-        s2.addSymbol(new ExpressionSymbol("expr", new ScalarSubquery(q1))); //$NON-NLS-1$
+        s2.addSymbol(new ScalarSubquery(q1)); //$NON-NLS-1$
         s2.addSymbol(new ElementSymbol("e1")); //$NON-NLS-1$
         From f2 = new From();
         f2.addGroup(new GroupSymbol("m.g2"));        //$NON-NLS-1$
@@ -3982,7 +3945,7 @@
 
         Select s2 = new Select();
         s2.addSymbol(new ElementSymbol("e1")); //$NON-NLS-1$
-        s2.addSymbol(new AliasSymbol("X", new ExpressionSymbol("expr", new ScalarSubquery(q1)))); //$NON-NLS-1$ //$NON-NLS-2$
+        s2.addSymbol(new AliasSymbol("X", new ScalarSubquery(q1))); //$NON-NLS-1$ //$NON-NLS-2$
         From f2 = new From();
         f2.addGroup(new GroupSymbol("m.g2"));        //$NON-NLS-1$
         Query q2 = new Query();
@@ -3998,7 +3961,7 @@
         Select s2 = new Select();
         s2.addSymbol(new ElementSymbol("e1")); //$NON-NLS-1$
        
-        s2.addSymbol(new AliasSymbol("X", new ExpressionSymbol("expr", QueryParser.getQueryParser().parseExpression("(SELECT e1 FROM m.g1) + 2")))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+        s2.addSymbol(new AliasSymbol("X", QueryParser.getQueryParser().parseExpression("(SELECT e1 FROM m.g1) + 2"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 
         From f2 = new From();
         f2.addGroup(new GroupSymbol("m.g2"));        //$NON-NLS-1$
@@ -4015,7 +3978,7 @@
         Select s2 = new Select();
         s2.addSymbol(new ElementSymbol("e1")); //$NON-NLS-1$
         
-        s2.addSymbol(new AliasSymbol("X", new ExpressionSymbol("expr", QueryParser.getQueryParser().parseExpression("3 + (SELECT e1 FROM m.g1)")))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+        s2.addSymbol(new AliasSymbol("X", QueryParser.getQueryParser().parseExpression("3 + (SELECT e1 FROM m.g1)"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 
         From f2 = new From();
         f2.addGroup(new GroupSymbol("m.g2"));        //$NON-NLS-1$
@@ -4032,7 +3995,7 @@
         Select s2 = new Select();
         s2.addSymbol(new ElementSymbol("e1")); //$NON-NLS-1$
         
-        s2.addSymbol(new AliasSymbol("X", new ExpressionSymbol("expr", QueryParser.getQueryParser().parseExpression("(SELECT e1 FROM m.g1) + (SELECT e3 FROM m.g3)")))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+        s2.addSymbol(new AliasSymbol("X", QueryParser.getQueryParser().parseExpression("(SELECT e1 FROM m.g1) + (SELECT e3 FROM m.g3)"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 
         From f2 = new From();
         f2.addGroup(new GroupSymbol("m.g2"));        //$NON-NLS-1$
@@ -4049,7 +4012,7 @@
         Select s2 = new Select();
         s2.addSymbol(new ElementSymbol("e1")); //$NON-NLS-1$
         
-        s2.addSymbol(new AliasSymbol("X", new ExpressionSymbol("expr", QueryParser.getQueryParser().getQueryParser().parseExpression("length((SELECT e1 FROM m.g1))")))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+        s2.addSymbol(new AliasSymbol("X", QueryParser.getQueryParser().parseExpression("length((SELECT e1 FROM m.g1))"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 
         From f2 = new From();
         f2.addGroup(new GroupSymbol("m.g2"));        //$NON-NLS-1$
@@ -4226,7 +4189,7 @@
         select.addSymbol(new ElementSymbol("y")); //$NON-NLS-1$
         select.addSymbol(new ElementSymbol("z")); //$NON-NLS-1$
         // The parser hard-codes the name "expr"
-        select.addSymbol(new ExpressionSymbol("expr", expr)); //$NON-NLS-1$
+        select.addSymbol(expr); //$NON-NLS-1$
         From from = new From();
         from.addGroup(new GroupSymbol("m.g")); //$NON-NLS-1$
         Query q = new Query();
@@ -4253,7 +4216,7 @@
         select.addSymbol(new ElementSymbol("y")); //$NON-NLS-1$
         select.addSymbol(new ElementSymbol("z")); //$NON-NLS-1$
         // The parser hard-codes the name "expr"
-        select.addSymbol(new ExpressionSymbol("expr", expr)); //$NON-NLS-1$
+        select.addSymbol(expr); //$NON-NLS-1$
         From from = new From();
         from.addGroup(new GroupSymbol("m.g")); //$NON-NLS-1$
         Query q = new Query();
@@ -4301,7 +4264,7 @@
         select.addSymbol(new ElementSymbol("y")); //$NON-NLS-1$
         select.addSymbol(new ElementSymbol("z")); //$NON-NLS-1$
         // The parser hard-codes the name "expr"
-        select.addSymbol(new ExpressionSymbol("expr", expr)); //$NON-NLS-1$
+        select.addSymbol(expr); //$NON-NLS-1$
         From from = new From();
         from.addGroup(new GroupSymbol("m.g")); //$NON-NLS-1$
         Query q = new Query();
@@ -4327,7 +4290,7 @@
         select.addSymbol(new ElementSymbol("y")); //$NON-NLS-1$
         select.addSymbol(new ElementSymbol("z")); //$NON-NLS-1$
         // The parser hard-codes the name "expr"
-        select.addSymbol(new ExpressionSymbol("expr", expr)); //$NON-NLS-1$
+        select.addSymbol(expr); //$NON-NLS-1$
         From from = new From();
         from.addGroup(new GroupSymbol("m.g")); //$NON-NLS-1$
         Query q = new Query();
@@ -4479,8 +4442,7 @@
     @Test public void testNationCharString() throws Exception {
         Query query = (Query) QueryParser.getQueryParser().parseCommand("SELECT N'blah' FROM m.g"); //$NON-NLS-1$
         Select select = query.getSelect();
-        ExpressionSymbol s = (ExpressionSymbol) select.getSymbol(0);
-        Constant c = (Constant) s.getExpression();
+        Constant c = (Constant) SymbolMap.getExpression(select.getSymbol(0));
         assertEquals(c, new Constant("blah")); //$NON-NLS-1$
     }
 
@@ -4608,7 +4570,7 @@
                 
         Constant as = new Constant("fooString"); //$NON-NLS-1$
 		Select select = new Select();
-		select.addSymbol(new ExpressionSymbol("expr", as)); //$NON-NLS-1$
+		select.addSymbol(as); //$NON-NLS-1$
 		
 		Query query = new Query();
 		query.setSelect(select);
@@ -4686,7 +4648,7 @@
 		select.addSymbol(new ElementSymbol("y")); //$NON-NLS-1$
 
 		OrderBy orderby = new OrderBy();
-		orderby.addVariable(new ExpressionSymbol("expr", new Constant(1)), true); //$NON-NLS-1$
+		orderby.addVariable(new Constant(1), true); //$NON-NLS-1$
 
 		Query query = new Query();
 		query.setSelect(select);
@@ -4882,8 +4844,7 @@
         Query query = new Query();
         Select select = new Select();
         Function func1 = new Function("a.x", new Expression[] { }); //$NON-NLS-1$
-        ExpressionSymbol exprSymbol = new ExpressionSymbol("expr", func1); //$NON-NLS-1$
-        select.addSymbol(exprSymbol);        
+        select.addSymbol(func1);        
         query.setSelect(select);
         
         helpTest(sql, "SELECT a.x()", query); //$NON-NLS-1$
@@ -4916,7 +4877,7 @@
         String expected = "CREATE VIRTUAL PROCEDURE\nBEGIN\nIF(x > 1)\nBEGIN\nSELECT 1;\nEND\nIF(x > 1)\nBEGIN\nSELECT 1;\nEND\nELSE\nBEGIN\nSELECT 1;\nEND\nEND"; //$NON-NLS-1$
         
         Query query = new Query();
-        query.setSelect(new Select(Arrays.asList(new ExpressionSymbol("expr", new Constant(1))))); //$NON-NLS-1$
+        query.setSelect(new Select(Arrays.asList(new Constant(1)))); //$NON-NLS-1$
         CommandStatement commandStmt = new CommandStatement(query);
         CompareCriteria criteria = new CompareCriteria(new ElementSymbol("x"), CompareCriteria.GT, new Constant(1)); //$NON-NLS-1$
         Block block = new Block();
@@ -4946,7 +4907,7 @@
         Function convert = new Function("convert", new Expression[] {new Constant(null), new Constant("blob")}); //$NON-NLS-1$ //$NON-NLS-2$
         Function convert1 = new Function("convert", new Expression[] {new Constant(null), new Constant("clob")}); //$NON-NLS-1$ //$NON-NLS-2$
         Function convert2 = new Function("convert", new Expression[] {new Constant(null), new Constant("xml")}); //$NON-NLS-1$ //$NON-NLS-2$
-        Select select = new Select(Arrays.asList(new ExpressionSymbol("expr", convert), new ExpressionSymbol("expr1", convert1), new ExpressionSymbol("expr2", convert2))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+        Select select = new Select(Arrays.asList(convert, convert1, convert2)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
         Query query = new Query();
         query.setSelect(select);
         
@@ -5059,9 +5020,8 @@
     @Test public void testArrayAggWithIndexing() throws Exception {
         String sql = "SELECT (array_agg(1))[1]"; //$NON-NLS-1$
         AggregateSymbol as = new AggregateSymbol("foo", Reserved.ARRAY_AGG, false, new Constant(1));
-        ExpressionSymbol expr = new ExpressionSymbol("expr", new Function("array_get", new Expression[] {as, new Constant(1)}));
         Query query = new Query();
-        query.setSelect(new Select(Arrays.asList(expr)));
+        query.setSelect(new Select(Arrays.asList(new Function("array_get", new Expression[] {as, new Constant(1)}))));
         helpTest(sql, "SELECT array_get(ARRAY_AGG(1), 1)", query);
     } 
     
@@ -5198,7 +5158,7 @@
     @Test public void testPositionalReference() throws Exception {
     	String sql = "select $1";
     	Query query = new Query();
-    	query.setSelect(new Select(Arrays.asList(new ExpressionSymbol("foo", new Reference(0)))));
+    	query.setSelect(new Select(Arrays.asList(new Reference(0))));
         helpTest(sql, "SELECT ?", query);
     }
     
@@ -5222,7 +5182,7 @@
     @Test public void testWindowFunction() throws Exception {
     	String sql = "select row_number() over (partition by x order by y) from g";
     	Query query = new Query();
-    	WindowFunction wf = new WindowFunction("expr");
+    	WindowFunction wf = new WindowFunction();
     	wf.setFunction(new AggregateSymbol("expr", "ROW_NUMBER", false, null));
     	WindowSpecification ws = new WindowSpecification();
     	ws.setPartition(new ArrayList<Expression>(Arrays.asList(new ElementSymbol("x"))));

Modified: trunk/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -41,28 +41,28 @@
 import org.teiid.query.metadata.QueryMetadataInterface;
 import org.teiid.query.metadata.TempMetadataID;
 import org.teiid.query.resolver.util.ResolverUtil;
-import org.teiid.query.sql.lang.BatchedUpdateCommand;
-import org.teiid.query.sql.lang.Command;
-import org.teiid.query.sql.lang.Delete;
-import org.teiid.query.sql.lang.From;
-import org.teiid.query.sql.lang.Insert;
-import org.teiid.query.sql.lang.ProcedureContainer;
-import org.teiid.query.sql.lang.Query;
-import org.teiid.query.sql.lang.SetQuery;
-import org.teiid.query.sql.lang.StoredProcedure;
-import org.teiid.query.sql.lang.TranslatableProcedureContainer;
-import org.teiid.query.sql.lang.Update;
-import org.teiid.query.sql.symbol.AliasSymbol;
+import org.teiid.query.sql.lang.*;
 import org.teiid.query.sql.symbol.ElementSymbol;
+import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 import org.teiid.query.sql.util.SymbolMap;
 import org.teiid.query.sql.visitor.ReferenceCollectorVisitor;
 import org.teiid.query.util.CommandContext;
 
 
 public class FakeDataManager implements ProcessorDataManager {
-	private Map<String, Object[]> tuples = new HashMap<String, Object[]>();
+	
+	static class TupleInfo {
+		List<ElementSymbol> elements;
+		List<?>[] data;
+
+		public TupleInfo(List<ElementSymbol> elements, List<?>[] data) {
+			this.elements = elements;
+			this.data = data;
+		}
+	}
+	
+	private Map<String, TupleInfo> tuples = new HashMap<String, TupleInfo>();
 	private Map<String, List<List<?>>[]> procTuples = new HashMap<String, List<List<?>>[]>();
 	
     private static final String LOG_CONTEXT = "FAKE_DATA_MANAGER"; //$NON-NLS-1$
@@ -155,12 +155,12 @@
     		}
 		}
 		
-		Object[] tupleInfo = tuples.get(group.getNonCorrelationName().toUpperCase());
-		List<SingleElementSymbol> elements = (List) tupleInfo[0];
-		List[] tuples = (List[]) tupleInfo[1];
+		TupleInfo tupleInfo = tuples.get(group.getNonCorrelationName().toUpperCase());
+		List<? extends Expression> elements = tupleInfo.elements;
+		List<?>[] data = tupleInfo.data;
 		
-		List<SingleElementSymbol> projectedSymbols = command.getProjectedSymbols();
-		int[] columnMap = getColumnMap(elements, projectedSymbols);
+		List<Expression> projectedSymbols = command.getProjectedSymbols();
+		int[] columnMap = getColumnMap(tupleInfo.elements, projectedSymbols);
 		
 		/* 
 		*  updateCommands is used to hold a list of commands that 
@@ -176,27 +176,27 @@
 			    // Build lookupMap from BOTH all the elements and the projected symbols - both may be needed here
 	            Map lookupMap = new HashMap();
 	            for(int i=0; i<elements.size(); i++) { 
-	                SingleElementSymbol element = elements.get(i);
+	                Expression element = elements.get(i);
                     mapElementToIndex(lookupMap, element, i, group);        
 	            }
 	            for(int i=0; i<projectedSymbols.size(); i++) { 
-	            	SingleElementSymbol element = projectedSymbols.get(i);
+	            	Expression element = projectedSymbols.get(i);
                     mapElementToIndex(lookupMap, element, columnMap[i], group);
 	            }
 			    
 			    List filteredTuples = new ArrayList();
-			    for(int i=0; i<tuples.length; i++) {
+			    for(int i=0; i<data.length; i++) {
 	                try {
-	    				if(new Evaluator(lookupMap, null, null).evaluate(query.getCriteria(), tuples[i])) {
-	                        filteredTuples.add(tuples[i]);
+	    				if(new Evaluator(lookupMap, null, null).evaluate(query.getCriteria(), data[i])) {
+	                        filteredTuples.add(data[i]);
 	                    }
 	                } catch(ExpressionEvaluationException e) {
 	                    throw new TeiidComponentException(e, e.getMessage());
 	                }
 			    }
 			    
-			    tuples = new List[filteredTuples.size()];
-			    filteredTuples.toArray(tuples);
+			    data = new List[filteredTuples.size()];
+			    filteredTuples.toArray(data);
 			}
 		} else if ( command instanceof Insert || command instanceof Update || command instanceof Delete) {
 			// add single update command to a list to be executed
@@ -217,18 +217,18 @@
 					    // Build lookupMap from BOTH all the elements and the projected symbols - both may be needed here
 			            Map<Object, Integer> lookupMap = new HashMap<Object, Integer>();
 			            for(int i=0; i<elements.size(); i++) { 
-			            	SingleElementSymbol element = elements.get(i);
+			            	Expression element = elements.get(i);
 		                    mapElementToIndex(lookupMap, element, new Integer(i), group);        
 			            }
 			            for(int i=0; i<projectedSymbols.size(); i++) { 
-			            	SingleElementSymbol element = projectedSymbols.get(i);
+			            	Expression element = projectedSymbols.get(i);
 		                    mapElementToIndex(lookupMap, element, new Integer(columnMap[i]), group);
 			            }
 					    
 					    int updated = 0;
-					    for(int i=0; i<tuples.length; i++) {
+					    for(int i=0; i<data.length; i++) {
 			                try {
-			    				if(new Evaluator(lookupMap, null, null).evaluate(update.getCriteria(), tuples[i])) {
+			    				if(new Evaluator(lookupMap, null, null).evaluate(update.getCriteria(), data[i])) {
 			                        updated++;
 			                    }
 			                } catch(ExpressionEvaluationException e) {
@@ -243,13 +243,13 @@
 					filteredTuples.add(Arrays.asList(1)); //TODO: check for bulk
 				}
 			}
-		    tuples = new List[filteredTuples.size()];
-		    filteredTuples.toArray(tuples);
-		    elements = new ArrayList<SingleElementSymbol>(projectedSymbols);
+		    data = new List[filteredTuples.size()];
+		    filteredTuples.toArray(data);
+		    elements = Command.getUpdateCommandSymbol();
 		    columnMap[0] = 0;
 		}		
 				
-        FakeTupleSource ts= new FakeTupleSource(elements, tuples, projectedSymbols, columnMap);
+        FakeTupleSource ts= new FakeTupleSource(elements, data, projectedSymbols, columnMap);
 		if(this.blockOnce){
             ts.setBlockOnce();
 		}
@@ -289,10 +289,10 @@
      * @param integer
      * @param group
      */
-    private void mapElementToIndex(Map lookupMap, SingleElementSymbol element, Integer index, GroupSymbol group) {
+    private void mapElementToIndex(Map lookupMap, Expression element, Integer index, GroupSymbol group) {
     	ElementSymbol elementSymbol = (ElementSymbol)SymbolMap.getExpression(element);
         if (group.getDefinition() != null){
-            String groupAlias = group.getCanonicalName();
+            String groupAlias = group.getName();
             elementSymbol = elementSymbol.clone();
             elementSymbol.getGroupSymbol().setName(groupAlias);
         }
@@ -300,27 +300,24 @@
     }    
 	
 	//   columnMap[expectedElementIndex] = allElementIndex
-	private int[] getColumnMap(List allElements, List expectedElements) {
+	private int[] getColumnMap(List<ElementSymbol> allElements, List<? extends Expression> expectedElements) {
 		int[] map = new int[expectedElements.size()];
 		
 		for(int i=0; i<expectedElements.size(); i++) { 
-		    SingleElementSymbol symbol = (SingleElementSymbol) expectedElements.get(i);
+		    Expression symbol = SymbolMap.getExpression(expectedElements.get(i));
 		    
-		    if (symbol instanceof AliasSymbol) {
-		        symbol = ((AliasSymbol)symbol).getSymbol();
-		    }
-		    
-		    String shortName = symbol.getShortName();
-		    
-		    // Find matching short name in all elements
 		    boolean foundMatch = false;
-		    for(int j=0; j<allElements.size(); j++) { 
-				SingleElementSymbol tupleSymbol = (SingleElementSymbol) allElements.get(j);
-				if(tupleSymbol.getShortName().equalsIgnoreCase(shortName)) {
-				    map[i] = j;
-				    foundMatch = true;
-				    break;
-				}
+
+		    if (symbol instanceof ElementSymbol) {
+			    // Find matching short name in all elements
+			    for(int j=0; j<allElements.size(); j++) { 
+					ElementSymbol es = allElements.get(j);
+					if(es.getShortName().equalsIgnoreCase(((ElementSymbol)symbol).getShortName())) {
+					    map[i] = j;
+					    foundMatch = true;
+					    break;
+					}
+			    }
 		    }
 		    
 		    if(! foundMatch) { 
@@ -394,11 +391,11 @@
 		this.recordingCommands = shouldRecord;
 	}
 
-	public void registerTuples(QueryMetadataInterface metadata, String groupName, List[] data) throws QueryResolverException, TeiidComponentException {
+	public void registerTuples(QueryMetadataInterface metadata, String groupName, List<?>[] data) throws QueryResolverException, TeiidComponentException {
 	    GroupSymbol group = new GroupSymbol(groupName);
 	    ResolverUtil.resolveGroup(group, metadata);
 	    List<ElementSymbol> elementSymbols = ResolverUtil.resolveElementsInGroup(group, metadata);
-		tuples.put(group.getName().toUpperCase(), new Object[] { elementSymbols, data });
+		tuples.put(group.getName().toUpperCase(), new TupleInfo(elementSymbols, data));
 	}
 
 	@Override

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestCollectionTupleSource.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestCollectionTupleSource.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestCollectionTupleSource.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -30,14 +30,14 @@
 
 import org.junit.Test;
 import org.teiid.query.sql.symbol.ElementSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Expression;
 
 /**
  */
 public class TestCollectionTupleSource {
 
     @Test public void testNullSource() {
-        List<SingleElementSymbol> elements = new ArrayList<SingleElementSymbol>();
+        List<Expression> elements = new ArrayList<Expression>();
         elements.add(new ElementSymbol("x")); //$NON-NLS-1$
         elements.add(new ElementSymbol("y")); //$NON-NLS-1$
         CollectionTupleSource nts = CollectionTupleSource.createNullTupleSource();   

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -54,7 +54,7 @@
     static ProcessorPlan helpGetPlan(String sql) {
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
-        caps.setSourceProperty(Capability.MAX_IN_CRITERIA_SIZE, new Integer(2));
+        caps.setSourceProperty(Capability.MAX_IN_CRITERIA_SIZE, 2);
         caps.setCapabilitySupport(Capability.QUERY_ORDERBY, false); //fake data manager doesn't support order by
         capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
         capFinder.addCapabilities("pm2", caps); //$NON-NLS-1$
@@ -232,12 +232,12 @@
        
        // Create expected results
        List[] expected = new List[] { 
-           Arrays.asList(new Object[] { "a", new Integer(0) }), //$NON-NLS-1$
-           Arrays.asList(new Object[] { "a", new Integer(0) }), //$NON-NLS-1$
-           Arrays.asList(new Object[] { "a", new Integer(0) }), //$NON-NLS-1$
-           Arrays.asList(new Object[] { "a", new Integer(0) }), //$NON-NLS-1$
-           Arrays.asList(new Object[] { "a", new Integer(3) }), //$NON-NLS-1$
-           Arrays.asList(new Object[] { "b", new Integer(2) }), //$NON-NLS-1$
+           Arrays.asList(new Object[] { "a", 0 }), //$NON-NLS-1$
+           Arrays.asList(new Object[] { "a", 0 }), //$NON-NLS-1$
+           Arrays.asList(new Object[] { "a", 0 }), //$NON-NLS-1$
+           Arrays.asList(new Object[] { "a", 0 }), //$NON-NLS-1$
+           Arrays.asList(new Object[] { "a", 3 }), //$NON-NLS-1$
+           Arrays.asList(new Object[] { "b", 2 }), //$NON-NLS-1$
        };    
        
        // Construct data manager with data
@@ -413,16 +413,16 @@
 
         // Create expected results
         List[] expected = new List[] { 
-              Arrays.asList(new Object[] { "aa ", "aa ", new Integer(0)}), //$NON-NLS-1$ //$NON-NLS-2$
-             Arrays.asList(new Object[] { "bb   ", "bb   ", new Integer(1)}), //$NON-NLS-1$ //$NON-NLS-2$
-             Arrays.asList(new Object[] { "cc  ", "cc  ", new Integer(2)}) //$NON-NLS-1$ //$NON-NLS-2$
+              Arrays.asList(new Object[] { "aa ", "aa ", 0}), //$NON-NLS-1$ //$NON-NLS-2$
+             Arrays.asList(new Object[] { "bb   ", "bb   ", 1}), //$NON-NLS-1$ //$NON-NLS-2$
+             Arrays.asList(new Object[] { "cc  ", "cc  ", 2}) //$NON-NLS-1$ //$NON-NLS-2$
         };    
 
         // Plan query
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities depcaps = new BasicSourceCapabilities();
         depcaps.setCapabilitySupport(Capability.QUERY_ORDERBY, true);
-        depcaps.setSourceProperty(Capability.MAX_IN_CRITERIA_SIZE, new Integer(1));
+        depcaps.setSourceProperty(Capability.MAX_IN_CRITERIA_SIZE, 1);
         depcaps.setCapabilitySupport(Capability.CRITERIA_IN, true);
         if(accessNodeHandlesAliases) {
             depcaps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
@@ -486,26 +486,22 @@
         });
         
         HardcodedDataManager dataManager = new HardcodedDataManager();
-        dataManager.addData("SELECT g_0.stringkey FROM bqt1.smallb AS g_0",  //$NON-NLS-1$ 
+        dataManager.addData("SELECT g_0.stringkey FROM BQT1.SmallB AS g_0",  //$NON-NLS-1$ 
                             new List[] { Arrays.asList(new Object[] { "1t" }), //$NON-NLS-1$
                                          Arrays.asList(new Object[] { "2" })}); //$NON-NLS-1$
-        dataManager.addData("SELECT g_0.stringkey, g_0.intkey FROM bqt1.smalla AS g_0",  //$NON-NLS-1$ 
-                            new List[] { Arrays.asList(new Object[] { "1", new Integer(1) })}); //$NON-NLS-1$
+        dataManager.addData("SELECT g_0.stringkey, g_0.intkey FROM BQT1.SmallA AS g_0",  //$NON-NLS-1$ 
+                            new List[] { Arrays.asList(new Object[] { "1", 1 })}); //$NON-NLS-1$
         
         
         List[] expected = new List[] {   
-            Arrays.asList(new Object[] { new Integer(1) }), 
+            Arrays.asList(new Object[] { 1 }), 
         };
         
         TestProcessor.helpProcess(plan, dataManager, expected);
-        
-        assertFalse(dataManager.getCommandHistory().contains("SELECT a.stringkey, a.intkey FROM bqt1.smalla AS a WHERE concat(a.stringkey, 't') IN ('1', '2')")); //$NON-NLS-1$
     }
     
     @Test public void testCase5130a() throws Exception {
-        HardcodedDataManager dataManager = helpTestDependentJoin(false);
-        
-        assertFalse(dataManager.getCommandHistory().contains("SELECT a.stringkey, a.intkey FROM bqt2.smalla AS a WHERE (concat(a.stringkey, 't') IN ('1t', '2')) AND (a.intkey IN (1))")); //$NON-NLS-1$
+        helpTestDependentJoin(false);
     }
     
     @Test public void testUnlimitedIn() throws Exception {
@@ -527,7 +523,7 @@
          
         // Plan query 
         ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), null, capFinder, 
-                                                    new String[] {"SELECT g_0.stringkey, g_0.intkey FROM bqt1.smalla AS g_0 WHERE g_0.intkey IN (<dependent values>)", "SELECT g_0.stringkey, g_0.intkey FROM bqt2.smallb AS g_0"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
+                                                    new String[] {"SELECT g_0.stringkey, g_0.intkey FROM BQT1.SmallA AS g_0 WHERE g_0.intkey IN (<dependent values>)", "SELECT g_0.stringkey, g_0.intkey FROM BQT2.SmallB AS g_0"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
  
         TestOptimizer.checkNodeTypes(plan, new int[] { 
             1,      // Access 
@@ -547,15 +543,15 @@
         });
         
         HardcodedDataManager dataManager = new HardcodedDataManager();
-        dataManager.addData("SELECT g_0.stringkey, g_0.intkey FROM bqt2.smallb AS g_0",  //$NON-NLS-1$ 
-                            new List[] { Arrays.asList(new Object[] { "1t", new Integer(1) }), //$NON-NLS-1$
-                                         Arrays.asList(new Object[] { "2t", new Integer(2) })}); //$NON-NLS-1$
-        dataManager.addData("SELECT g_0.stringkey, g_0.intkey FROM bqt1.smalla AS g_0 WHERE g_0.intkey IN (1, 2)",  //$NON-NLS-1$ 
-                            new List[] { Arrays.asList(new Object[] { "1", new Integer(1) })}); //$NON-NLS-1$
+        dataManager.addData("SELECT g_0.stringkey, g_0.intkey FROM BQT2.SmallB AS g_0",  //$NON-NLS-1$ 
+                            new List[] { Arrays.asList(new Object[] { "1t", 1 }), //$NON-NLS-1$
+                                         Arrays.asList(new Object[] { "2t", 2 })}); //$NON-NLS-1$
+        dataManager.addData("SELECT g_0.stringkey, g_0.intkey FROM BQT1.SmallA AS g_0 WHERE g_0.intkey IN (1, 2)",  //$NON-NLS-1$ 
+                            new List[] { Arrays.asList(new Object[] { "1", 1 })}); //$NON-NLS-1$
         
         
         List[] expected = new List[] {   
-            Arrays.asList(new Object[] { new Integer(1) }), 
+            Arrays.asList(new Object[] { 1 }), 
         };
         
         TestProcessor.helpProcess(plan, dataManager, expected);
@@ -568,17 +564,17 @@
         dataMgr.registerTuples(
         		metadata,
             "pm1.g1", 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$
+				    Arrays.asList(new Object[] { "a",   0,     Boolean.FALSE,  new Double(2.0) }), //$NON-NLS-1$
+				    Arrays.asList(new Object[] { "b",   1,     Boolean.TRUE,   null }), //$NON-NLS-1$
+				    Arrays.asList(new Object[] { "c",   2,     Boolean.FALSE,  new Double(0.0) }), //$NON-NLS-1$
 				    } );       
             
         dataMgr.registerTuples(
         		metadata,
             "pm6.g1", new List[] { 
-				    Arrays.asList(new Object[] { "b",   new Integer(0) }), //$NON-NLS-1$
-				    Arrays.asList(new Object[] { "d",   new Integer(3) }), //$NON-NLS-1$
-				    Arrays.asList(new Object[] { "e",   new Integer(1) }), //$NON-NLS-1$
+				    Arrays.asList(new Object[] { "b",   0 }), //$NON-NLS-1$
+				    Arrays.asList(new Object[] { "d",   3 }), //$NON-NLS-1$
+				    Arrays.asList(new Object[] { "e",   1 }), //$NON-NLS-1$
 				    } );      
     }
 
@@ -599,7 +595,7 @@
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities depcaps = new BasicSourceCapabilities();
         depcaps.setCapabilitySupport(Capability.CRITERIA_IN, true);
-        depcaps.setSourceProperty(Capability.MAX_IN_CRITERIA_SIZE, new Integer(1));
+        depcaps.setSourceProperty(Capability.MAX_IN_CRITERIA_SIZE, 1);
         depcaps.setCapabilitySupport(Capability.QUERY_ORDERBY, true);
 
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -734,18 +730,18 @@
         // Create expected results
         List[] expected = new List[] {
             Arrays.asList(new Object[] {
-                "aa ", "aa ", new Integer(0)}), //$NON-NLS-1$ //$NON-NLS-2$
+                "aa ", "aa ", 0}), //$NON-NLS-1$ //$NON-NLS-2$
             Arrays.asList(new Object[] {
-                "bb   ", "bb   ", new Integer(1)}), //$NON-NLS-1$ //$NON-NLS-2$
+                "bb   ", "bb   ", 1}), //$NON-NLS-1$ //$NON-NLS-2$
             Arrays.asList(new Object[] {
-                "cc  ", "cc  ", new Integer(2)}) //$NON-NLS-1$ //$NON-NLS-2$
+                "cc  ", "cc  ", 2}) //$NON-NLS-1$ //$NON-NLS-2$
         };
 
         // Plan query
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities depcaps = new BasicSourceCapabilities();
         depcaps.setCapabilitySupport(Capability.QUERY_ORDERBY, true);
-        depcaps.setSourceProperty(Capability.MAX_IN_CRITERIA_SIZE, new Integer(1));
+        depcaps.setSourceProperty(Capability.MAX_IN_CRITERIA_SIZE, 1);
         depcaps.setCapabilitySupport(Capability.CRITERIA_IN, true);
 
         BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -802,13 +798,13 @@
        
        // Create expected results
        List[] expected = new List[] { 
-           Arrays.asList(new Object[] { new Integer(0), new Integer(1) }),
-           Arrays.asList(new Object[] { new Integer(0), new Integer(1) }),
-           Arrays.asList(new Object[] { new Integer(0), new Integer(1) }),
-           Arrays.asList(new Object[] { new Integer(0), new Integer(1) }),
-           Arrays.asList(new Object[] { new Integer(1), new Integer(2) }),
-           Arrays.asList(new Object[] { new Integer(1), new Integer(2) }),
-           Arrays.asList(new Object[] { new Integer(2), new Integer(3) })
+           Arrays.asList(new Object[] { 0, 1 }),
+           Arrays.asList(new Object[] { 0, 1 }),
+           Arrays.asList(new Object[] { 0, 1 }),
+           Arrays.asList(new Object[] { 0, 1 }),
+           Arrays.asList(new Object[] { 1, 2 }),
+           Arrays.asList(new Object[] { 1, 2 }),
+           Arrays.asList(new Object[] { 2, 3 })
        };    
        
        // Construct data manager with data
@@ -820,7 +816,7 @@
        FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
        BasicSourceCapabilities caps = new BasicSourceCapabilities();
        caps.setCapabilitySupport(Capability.CRITERIA_IN, true);
-       caps.setSourceProperty(Capability.MAX_IN_CRITERIA_SIZE, new Integer(1000));
+       caps.setSourceProperty(Capability.MAX_IN_CRITERIA_SIZE, 1000);
        capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
        capFinder.addCapabilities("pm2", caps); //$NON-NLS-1$
        
@@ -847,7 +843,7 @@
         FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
         BasicSourceCapabilities depcaps = new BasicSourceCapabilities();
         depcaps.setCapabilitySupport(Capability.CRITERIA_IN, true);
-        depcaps.setSourceProperty(Capability.MAX_IN_CRITERIA_SIZE, new Integer(1));
+        depcaps.setSourceProperty(Capability.MAX_IN_CRITERIA_SIZE, 1);
         depcaps.setCapabilitySupport(Capability.QUERY_ORDERBY, true);
 
         BasicSourceCapabilities caps = new BasicSourceCapabilities();

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestInherintlyUpdatableViews.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestInherintlyUpdatableViews.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestInherintlyUpdatableViews.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -46,7 +46,7 @@
 	@Test public void testUpdatePassThrough() throws Exception {
 		String userSql = "update vm1.gx set e1 = e2"; //$NON-NLS-1$
     	String viewSql = "select * from pm1.g1 where e3 < 5";
-    	String expectedSql = "UPDATE pm1.g1 SET e1 = pm1.g1.e2 WHERE e3 < 5";
+    	String expectedSql = "UPDATE pm1.g1 SET e1 = convert(pm1.g1.e2, string) WHERE convert(e3, integer) < 5";
         helpTest(userSql, viewSql, expectedSql, null);	
 	}
 
@@ -71,14 +71,14 @@
 	@Test public void testUpdatePassThroughWithAlias() throws Exception {
 		String userSql = "update vm1.gx set e1 = e2"; //$NON-NLS-1$
     	String viewSql = "select * from pm1.g1 as x where e3 < 5";
-    	String expectedSql = "UPDATE pm1.g1 SET e1 = pm1.g1.e2 WHERE e3 < 5";
+    	String expectedSql = "UPDATE pm1.g1 SET e1 = convert(pm1.g1.e2, string) WHERE convert(e3, integer) < 5";
         helpTest(userSql, viewSql, expectedSql, null);	
 	}
 	
 	@Test public void testDeletePassThrough() throws Exception {
 		String userSql = "delete from vm1.gx where e1 = e2"; //$NON-NLS-1$
     	String viewSql = "select * from pm1.g1 where e3 < 5";
-        String expectedSql = "DELETE FROM pm1.g1 WHERE (pm1.g1.e1 = pm1.g1.e2) AND (e3 < 5)";
+        String expectedSql = "DELETE FROM pm1.g1 WHERE (pm1.g1.e1 = convert(pm1.g1.e2, string)) AND (convert(e3, integer) < 5)";
         helpTest(userSql, viewSql, expectedSql, null);
 	}
 	
@@ -113,10 +113,10 @@
 		String viewSql = "select g2.* from pm1.g1 inner join pm1.g2 on g1.e1 = g2.e1";
 		
 		HardcodedDataManager dm = new HardcodedDataManager();
-        dm.addData("SELECT g_1.e2, g_1.e2 FROM pm1.g1 AS g_0, pm1.g2 AS g_1 WHERE (g_0.e1 = g_1.e1) AND (g_1.e3 IS NULL)", new List[] {Arrays.asList(1, 1)});
-        dm.addData("UPDATE pm1.g2 SET e1 = pm1.g2.e2 WHERE pm1.g2.e2 = 1", new List[] {Arrays.asList(1)});
+        dm.addData("SELECT convert(g_1.e2, string), g_1.e2 FROM pm1.g1 AS g_0, pm1.g2 AS g_1 WHERE (g_0.e1 = g_1.e1) AND (g_1.e3 IS NULL)", new List[] {Arrays.asList("1", 1)});
+        dm.addData("UPDATE pm1.g2 SET e1 = convert(pm1.g2.e2, string) WHERE pm1.g2.e2 = 1", new List[] {Arrays.asList(1)});
         
-		helpTest(userSql, viewSql, "CREATE VIRTUAL PROCEDURE\nBEGIN ATOMIC\nDECLARE integer VARIABLES.ROWS_UPDATED = 0;\nLOOP ON (SELECT pm1.g2.e2 AS s_0, pm1.g2.e2 AS s_1 FROM pm1.g1 INNER JOIN pm1.g2 ON g1.e1 = g2.e1 WHERE pm1.g2.e3 IS NULL) AS X\nBEGIN\nUPDATE pm1.g2 SET e1 = pm1.g2.e2 WHERE pm1.g2.e2 = X.s_1;\nVARIABLES.ROWS_UPDATED = (VARIABLES.ROWS_UPDATED + 1);\nEND\nSELECT VARIABLES.ROWS_UPDATED;\nEND",
+		helpTest(userSql, viewSql, "CREATE VIRTUAL PROCEDURE\nBEGIN ATOMIC\nDECLARE integer VARIABLES.ROWS_UPDATED = 0;\nLOOP ON (SELECT convert(pm1.g2.e2, string) AS s_0, pm1.g2.e2 AS s_1 FROM pm1.g1 INNER JOIN pm1.g2 ON g1.e1 = g2.e1 WHERE pm1.g2.e3 IS NULL) AS X\nBEGIN\nUPDATE pm1.g2 SET e1 = convert(pm1.g2.e2, string) WHERE pm1.g2.e2 = X.s_1;\nVARIABLES.ROWS_UPDATED = (VARIABLES.ROWS_UPDATED + 1);\nEND\nSELECT VARIABLES.ROWS_UPDATED;\nEND",
 				dm);
 	}
 	

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -52,7 +52,7 @@
 import org.teiid.query.unittest.RealMetadataFactory;
 import org.teiid.query.util.CommandContext;
 
- at SuppressWarnings("nls")
+ at SuppressWarnings({"nls", "unchecked"})
 public class TestMaterialization {
 	
 	private TempMetadataAdapter metadata;
@@ -70,8 +70,8 @@
 		metadata = new TempMetadataAdapter(actualMetadata, 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")});
+		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")});
 		
 	    SessionAwareCache<CachedResults> cache = new SessionAwareCache<CachedResults>();
 	    cache.setTupleBufferCache(bm);

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -5803,14 +5803,14 @@
             Arrays.asList(new Object[] { "2", new Integer(2), new Integer(6) }), //$NON-NLS-1$
             Arrays.asList(new Object[] { "3", new Integer(3), new Integer(7) }), //$NON-NLS-1$
         };        
-        dataManager.addData("SELECT bqt1.smalla.stringkey, bqt1.smalla.intkey, bqt1.smalla.intnum FROM bqt1.smalla", data1);  //$NON-NLS-1$
+        dataManager.addData("SELECT BQT1.SmallA.stringkey, BQT1.SmallA.intkey, BQT1.SmallA.intnum FROM BQT1.SmallA", data1);  //$NON-NLS-1$
 
         List[] data2 = new List[] {
             Arrays.asList(new Object[] { "1" }), //$NON-NLS-1$
             Arrays.asList(new Object[] { "2" }), //$NON-NLS-1$
             Arrays.asList(new Object[] { "3" }), //$NON-NLS-1$
         };        
-        dataManager.addData("SELECT bqt2.mediumb.stringkey FROM bqt2.mediumb", data2);  //$NON-NLS-1$
+        dataManager.addData("SELECT BQT2.MediumB.stringkey FROM BQT2.MediumB", data2);  //$NON-NLS-1$
 
         // Run query
         List[] expectedResults = new List[] { 
@@ -6195,9 +6195,9 @@
          
         // Construct data manager with data  
         HardcodedDataManager dataManager = new HardcodedDataManager();  
-        dataManager.addData("SELECT g_0.intkey, g_0.intnum FROM bqt2.smalla AS g_0",  //$NON-NLS-1$ 
+        dataManager.addData("SELECT g_0.intkey, g_0.intnum FROM BQT2.SmallA AS g_0",  //$NON-NLS-1$ 
                             new List[] { Arrays.asList(new Object[] { new Integer(1), new Integer(1) })}); 
-        dataManager.addData("SELECT g_1.intnum AS c_0, 1 AS c_1 FROM bqt1.smalla AS g_1 UNION ALL SELECT g_0.IntKey AS c_0, g_0.IntNum AS c_1 FROM bqt1.smalla AS g_0",  //$NON-NLS-1$ 
+        dataManager.addData("SELECT g_1.intnum AS c_0, 1 AS c_1 FROM BQT1.SmallA AS g_1 UNION ALL SELECT g_0.IntKey AS c_0, g_0.IntNum AS c_1 FROM BQT1.SmallA AS g_0",  //$NON-NLS-1$ 
                 new List[] { Arrays.asList(new Object[] { new Integer(1), new Integer(1) }), 
                                  Arrays.asList(new Object[] { new Integer(1), new Integer(1) })}); 
         helpProcess(plan, dataManager, expected);  
@@ -7279,7 +7279,7 @@
     }
     
     @Test public void testImplicitAggregateWithInlineView() {
-        String sql = "SELECT * FROM (SELECT b.count, enterprise_id FROM (SELECT COUNT(*), 2 AS enterprise_id FROM (SELECT 'A Name' AS Name, 1 AS enterprise_id) c ) b ) a WHERE enterprise_id = 1"; //$NON-NLS-1$
+        String sql = "SELECT * FROM (SELECT b.count, enterprise_id FROM (SELECT COUNT(*) as count, 2 AS enterprise_id FROM (SELECT 'A Name' AS Name, 1 AS enterprise_id) c ) b ) a WHERE enterprise_id = 1"; //$NON-NLS-1$
         
         List[] expected = new List[] {};    
     

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestVirtualDepJoin.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestVirtualDepJoin.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestVirtualDepJoin.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -568,8 +568,8 @@
         finder.addCapabilities("test", caps); //$NON-NLS-1$
         
         ProcessorPlan plan = TestOptimizer.helpPlan(sql, TestValidator.exampleMetadata4(), null, finder, 
-                                                    new String[] {"SELECT g_0.e2 AS c_0 FROM test.\"group\" AS g_0 WHERE (g_0.e0 = 1) AND (g_0.e1 = '2') ORDER BY c_0", //$NON-NLS-1$
-        														  "SELECT g_0.e0 AS c_0, g_0.e1 AS c_1, g_0.e0 AS c_2 FROM test.\"group\" AS g_0 WHERE (g_0.e0 IN (<dependent values>)) AND (g_0.e1 IN (<dependent values>)) ORDER BY c_2, c_1"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+                                                    new String[] {"SELECT g_0.e0 AS c_0, g_0.e1 AS c_1, convert(g_0.e0, string) AS c_2 FROM test.\"group\" AS g_0 WHERE (convert(g_0.e0, string) IN (<dependent values>)) AND (g_0.e1 IN (<dependent values>)) ORDER BY c_2, c_1", 
+        														  "SELECT g_0.e2 AS c_0 FROM test.\"group\" AS g_0 WHERE (g_0.e0 = 1) AND (g_0.e1 = '2') ORDER BY c_0"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
         
         TestOptimizer.checkNodeTypes(plan, new int[] {
             1,      // Access

Modified: trunk/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -59,7 +59,7 @@
 @SuppressWarnings("nls")
 public class TestExpressionEvaluator {
 
-    public void helpTestEval(Expression expr, SingleElementSymbol[] elementList, Object[] valueList, ProcessorDataManager dataMgr, CommandContext context, Object expectedValue) {
+    public void helpTestEval(Expression expr, Expression[] elementList, Object[] valueList, ProcessorDataManager dataMgr, CommandContext context, Object expectedValue) {
         try {
             Object actualValue = helpEval(expr, elementList, valueList, dataMgr, context);
             assertEquals("Did not get expected result", expectedValue, actualValue); //$NON-NLS-1$
@@ -68,7 +68,7 @@
         }
     }
 
-    public Object helpEval(Expression expr, SingleElementSymbol[] elementList, Object[] valueList, ProcessorDataManager dataMgr, CommandContext context) throws ExpressionEvaluationException, BlockedException, TeiidComponentException {
+    public Object helpEval(Expression expr, Expression[] elementList, Object[] valueList, ProcessorDataManager dataMgr, CommandContext context) throws ExpressionEvaluationException, BlockedException, TeiidComponentException {
         Map elements = new HashMap();
         if (elementList != null) {
             for(int i=0; i<elementList.length; i++) {
@@ -100,25 +100,25 @@
     @Test public void testSearchedCaseExpression1() {
         SearchedCaseExpression expr = TestSearchedCaseExpression.example(3);
         helpTestEval(expr,
-                     new SingleElementSymbol[] {new ElementSymbol("x")}, //$NON-NLS-1$
+                     new Expression[] {new ElementSymbol("x")}, //$NON-NLS-1$
                      new Object[] {new Integer(0)},
                      null,
                      null,
                      new Integer(0));
         helpTestEval(expr,
-                     new SingleElementSymbol[] {new ElementSymbol("x")}, //$NON-NLS-1$
+                     new Expression[] {new ElementSymbol("x")}, //$NON-NLS-1$
                      new Object[] {new Integer(1)},
                      null,
                      null,
                      new Integer(1));
         helpTestEval(expr,
-                     new SingleElementSymbol[] {new ElementSymbol("x")}, //$NON-NLS-1$
+                     new Expression[] {new ElementSymbol("x")}, //$NON-NLS-1$
                      new Object[] {new Integer(2)},
                      null,
                      null,
                      new Integer(2));
         helpTestEval(expr,
-                     new SingleElementSymbol[] {new ElementSymbol("x")}, //$NON-NLS-1$
+                     new Expression[] {new ElementSymbol("x")}, //$NON-NLS-1$
                      new Object[] {new Integer(3)},
                      null,
                      null,
@@ -126,14 +126,14 @@
     }
     
     @Test public void testConstant() {
-        helpTestEval(new Constant("xyz", String.class), new SingleElementSymbol[0], new Object[0], null, null, "xyz"); //$NON-NLS-1$ //$NON-NLS-2$
+        helpTestEval(new Constant("xyz", String.class), new Expression[0], new Object[0], null, null, "xyz"); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
     @Test public void testElement1() {
         ElementSymbol e1 = new ElementSymbol("e1"); //$NON-NLS-1$
         ElementSymbol e2 = new ElementSymbol("e2"); //$NON-NLS-1$
         
-        SingleElementSymbol[] elements = new SingleElementSymbol[] {
+        Expression[] elements = new Expression[] {
             e1, e2
         };
         
@@ -148,7 +148,7 @@
         ElementSymbol e1 = new ElementSymbol("e1"); //$NON-NLS-1$
         ElementSymbol e2 = new ElementSymbol("e2"); //$NON-NLS-1$
         
-        SingleElementSymbol[] elements = new SingleElementSymbol[] {
+        Expression[] elements = new Expression[] {
             e1, e2
         };
         
@@ -165,7 +165,7 @@
     @Test public void testElement3() throws Exception {
         ElementSymbol e2 = new ElementSymbol("e2"); //$NON-NLS-1$
         
-        SingleElementSymbol[] elements = new SingleElementSymbol[] {};
+        Expression[] elements = new Expression[] {};
         
         Object[] values = new Object[] { 
             "xyz", "abc" //$NON-NLS-1$ //$NON-NLS-2$
@@ -190,7 +190,7 @@
         FunctionDescriptor desc = RealMetadataFactory.SFM.getSystemFunctionLibrary().findFunction("concat", new Class[] { String.class, String.class } ); //$NON-NLS-1$
         func.setFunctionDescriptor(desc);
 
-        SingleElementSymbol[] elements = new SingleElementSymbol[] {
+        Expression[] elements = new Expression[] {
             e1, e2
         };
         
@@ -212,7 +212,7 @@
         FunctionDescriptor desc = RealMetadataFactory.SFM.getSystemFunctionLibrary().findFunction("concat", new Class[] { String.class, String.class } ); //$NON-NLS-1$
         func.setFunctionDescriptor(desc);
 
-        SingleElementSymbol[] elements = new SingleElementSymbol[] {
+        Expression[] elements = new Expression[] {
             e1, e2
         };
         
@@ -233,7 +233,7 @@
         FunctionDescriptor desc = RealMetadataFactory.SFM.getSystemFunctionLibrary().findFunction("lookup", new Class[] { String.class, String.class, String.class, String.class } ); //$NON-NLS-1$
         func.setFunctionDescriptor(desc);
 
-        SingleElementSymbol[] elements = new SingleElementSymbol[] {
+        Expression[] elements = new Expression[] {
             e1, e2
         };
         

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	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -991,7 +991,7 @@
 
         helpTestProcessFailure(plan,
                                dataMgr,
-                               "Couldn't execute the dynamic SQL command \"EXECUTE '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$
+                               "Couldn't execute the dynamic SQL command \"EXECUTE '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 {
@@ -1310,7 +1310,7 @@
         StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n"); //$NON-NLS-1$
         procedure.append("BEGIN\n"); //$NON-NLS-1$
         procedure.append("create local temporary table t1 (e1 integer);\n"); //$NON-NLS-1$
-        procedure.append("create local temporary table t1 (e1 integer);\n"); //$NON-NLS-1$
+        procedure.append("create local temporary table T1 (e1 integer);\n"); //$NON-NLS-1$
         procedure.append("SELECT e1 from t1;\n"); //$NON-NLS-1$
         procedure.append("END"); //$NON-NLS-1$
         

Modified: trunk/engine/src/test/java/org/teiid/query/processor/xml/FakeXMLProcessorEnvironment.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/xml/FakeXMLProcessorEnvironment.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/processor/xml/FakeXMLProcessorEnvironment.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -30,8 +30,6 @@
 import org.teiid.common.buffer.BufferManagerFactory;
 import org.teiid.core.TeiidComponentException;
 import org.teiid.query.mapping.xml.ResultSetInfo;
-import org.teiid.query.processor.xml.PlanExecutor;
-import org.teiid.query.processor.xml.XMLProcessorEnvironment;
 
 
 /**
@@ -47,9 +45,9 @@
         schemaMap.put(resultSetName, schema);
     }
 
-    public PlanExecutor createResultExecutor(final String resultSetName, ResultSetInfo info) 
+    public PlanExecutor createResultExecutor(ResultSetInfo info) 
         throws TeiidComponentException{
-       return new FakePlanExecutor(resultSetName, (List)schemaMap.get(resultSetName), (List[])dataMap.get(resultSetName));
+       return new FakePlanExecutor(info.getResultSetName(), (List)schemaMap.get(info.getResultSetName()), (List[])dataMap.get(info.getResultSetName()));
     }
         
     /**

Modified: trunk/engine/src/test/java/org/teiid/query/processor/xml/TestInstructions.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/xml/TestInstructions.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/processor/xml/TestInstructions.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -52,6 +52,7 @@
 import org.teiid.query.sql.lang.Criteria;
 import org.teiid.query.sql.lang.QueryCommand;
 import org.teiid.query.sql.symbol.ElementSymbol;
+import org.teiid.query.sql.symbol.Symbol;
 import org.teiid.query.unittest.RealMetadataFactory;
 import org.teiid.query.util.CommandContext;
 
@@ -294,9 +295,9 @@
         temp.initialize(context,null,bufferMgr);
 
         List<ElementSymbol> schema = new ArrayList<ElementSymbol>();
-        schema.add(new ElementSymbol(resultSetName + ElementSymbol.SEPARATOR + "itemNum")); //$NON-NLS-1$
-        schema.add(new ElementSymbol(resultSetName + ElementSymbol.SEPARATOR + "itemName")); //$NON-NLS-1$
-        schema.add(new ElementSymbol(resultSetName + ElementSymbol.SEPARATOR + "itemQuantity")); //$NON-NLS-1$
+        schema.add(new ElementSymbol(resultSetName + Symbol.SEPARATOR + "itemNum")); //$NON-NLS-1$
+        schema.add(new ElementSymbol(resultSetName + Symbol.SEPARATOR + "itemName")); //$NON-NLS-1$
+        schema.add(new ElementSymbol(resultSetName + Symbol.SEPARATOR + "itemQuantity")); //$NON-NLS-1$
         
         env.addData(resultSetName, schema, new List[] { 
                     Arrays.asList( new Object[] { "001", "Lamp", new Integer(5) } ),         //$NON-NLS-1$ //$NON-NLS-2$

Modified: trunk/engine/src/test/java/org/teiid/query/processor/xml/TestXMLPlanningEnhancements.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/xml/TestXMLPlanningEnhancements.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/processor/xml/TestXMLPlanningEnhancements.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -67,9 +67,7 @@
                                                               new String[] { "supplierNum", "supplierName", "supplierZipCode" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                                                               new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
                                                          
-        Table doc18a = RealMetadataFactory.createXmlDocument("doc18a", xmltest, TestXMLProcessor.createXMLPlanNested("xmltest.suppliersY")); //$NON-NLS-1$ //$NON-NLS-2$
-        RealMetadataFactory.createElements(doc18a, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.suppliers", "Catalogs.Catalog.items.item.suppliers.supplier", "Catalogs.Catalog.items.item.suppliers.supplier. at SupplierID", "Catalogs.Catalog.items.item.suppliers.supplier.zip", "Catalogs.Catalog.items.item.suppliers.supplier.Name" },  //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$
-            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
+        RealMetadataFactory.createXmlDocument("doc18a", xmltest, TestXMLProcessor.createXMLPlanNested("xmltest.suppliersY")); //$NON-NLS-1$ //$NON-NLS-2$
         return metadata;
     }
     
@@ -78,9 +76,7 @@
         
         Schema xmltest = metadata.getMetadataStore().getSchemas().get("XMLTEST");
         
-        Table docJoin = RealMetadataFactory.createXmlDocument("docJoin", xmltest, createXMLPlanNestedJoin()); //$NON-NLS-1$
-        RealMetadataFactory.createElements(docJoin, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.suppliers", "Catalogs.Catalog.items.item.suppliers.supplier", "Catalogs.Catalog.items.item.suppliers.supplier. at SupplierID", "Catalogs.Catalog.items.item.suppliers.supplier.zip", "Catalogs.Catalog.items.item.suppliers.supplier.Name", "Catalogs.Catalog.items.item.suppliers.supplier.orders", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order. at OrderID" ,"Catalogs.Catalog.items.item.suppliers.supplier.orders.order.OrderDate", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order.OrderQuantity", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order.OrderStatus"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NL!
 S-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$ //$NON-NLS-18$
-            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
+        RealMetadataFactory.createXmlDocument("docJoin", xmltest, createXMLPlanNestedJoin()); //$NON-NLS-1$
 
         QueryNode tempQueryJoin = null;
         if (!simpleTempSelect) {
@@ -147,7 +143,7 @@
         order.setSource("xmltest.ordersC"); //$NON-NLS-1$
         order.setMaxOccurrs(-1);
         order.addAttribute(new MappingAttribute("OrderID", "xmltest.ordersC.orderNum")); //$NON-NLS-1$ //$NON-NLS-2$
-        order.addChildElement(new MappingElement("OrderDate", "xmltest.ordersc.orderDate")); //$NON-NLS-1$ //$NON-NLS-2$
+        order.addChildElement(new MappingElement("OrderDate", "xmltest.ordersC.orderDate")); //$NON-NLS-1$ //$NON-NLS-2$
         order.addChildElement(new MappingElement("OrderQuantity", "xmltest.ordersC.orderQty")); //$NON-NLS-1$ //$NON-NLS-2$
         order.addChildElement(new MappingElement("OrderStatus", "xmltest.ordersC.orderStatus")) //$NON-NLS-1$ //$NON-NLS-2$
             .setMinOccurrs(0);                
@@ -328,7 +324,7 @@
  
         XMLPlan plan = (XMLPlan)TestXMLProcessor.helpTestProcess("SELECT * FROM xmltest.doc18a where supplierID<56", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
 
-        Map stats = XMLProgramUtil.getProgramStats(plan.getOriginalProgram());
+        Map<Class<?>, List<ProcessorInstruction>> stats = XMLProgramUtil.getProgramStats(plan.getOriginalProgram());
         assertNull(stats.get(ExecStagingTableInstruction.class));
     }
     
@@ -381,8 +377,8 @@
         XMLPlan plan = (XMLPlan)TestXMLProcessor.helpTestProcess("SELECT * FROM xmltest.doc9", expectedDoc, metadata, dataMgr); //$NON-NLS-1$
         
         //check for staging; one for staging and for unloading
-        Map stats = XMLProgramUtil.getProgramStats(plan.getOriginalProgram());
-        assertEquals(2, ((List)stats.get(ExecStagingTableInstruction.class)).size());
+        Map<Class<?>, List<ProcessorInstruction>> stats = XMLProgramUtil.getProgramStats(plan.getOriginalProgram());
+        assertEquals(2, stats.get(ExecStagingTableInstruction.class).size());
     }
     
     /**
@@ -403,7 +399,7 @@
         XMLPlan plan = (XMLPlan)TestXMLProcessor.helpTestProcess("SELECT * FROM xmltest.doc9", expectedDoc, metadata, dataMgr); //$NON-NLS-1$
         
         //check for no staging
-        Map stats = XMLProgramUtil.getProgramStats(plan.getOriginalProgram());
+        Map<Class<?>, List<ProcessorInstruction>> stats = XMLProgramUtil.getProgramStats(plan.getOriginalProgram());
         assertNull(stats.get(ExecStagingTableInstruction.class));
     }
 
@@ -417,7 +413,7 @@
         XMLPlan plan = (XMLPlan)TestXMLProcessor.helpTestProcess("SELECT * FROM xmltest.doc9 OPTION NOCACHE", expectedDoc, metadata, dataMgr); //$NON-NLS-1$
         
         //check for no staging
-        Map stats = XMLProgramUtil.getProgramStats(plan.getOriginalProgram());
+        Map<Class<?>, List<ProcessorInstruction>> stats = XMLProgramUtil.getProgramStats(plan.getOriginalProgram());
         assertNull(stats.get(ExecStagingTableInstruction.class));
     }    
     
@@ -431,7 +427,7 @@
         XMLPlan plan = (XMLPlan)TestXMLProcessor.helpTestProcess("SELECT * FROM xmltest.doc9 OPTION NOCACHE XMLTEST.SUPPLIERS", expectedDoc, metadata, dataMgr); //$NON-NLS-1$
         
         //check for no staging by the mapping class name
-        Map stats = XMLProgramUtil.getProgramStats(plan.getOriginalProgram());
+        Map<Class<?>, List<ProcessorInstruction>> stats = XMLProgramUtil.getProgramStats(plan.getOriginalProgram());
         assertNull(stats.get(ExecStagingTableInstruction.class));
         
         plan = (XMLPlan)TestXMLProcessor.helpTestProcess("SELECT * FROM xmltest.doc9 OPTION NOCACHE XMLTEST.SUPPLIERS", expectedDoc, metadata, dataMgr); //$NON-NLS-1$
@@ -449,8 +445,8 @@
         String expectedDoc = TestXMLProcessor.readFile("TestXMLProcessor-FullSuppliers.xml"); //$NON-NLS-1$
         
         XMLPlan xmlPlan = (XMLPlan)TestXMLProcessor.helpTestProcess("SELECT * FROM xmltest.docJoin", expectedDoc, metadata, dataMgr); //$NON-NLS-1$        
-        Map stats = XMLProgramUtil.getProgramStats(xmlPlan.getOriginalProgram());
-        List list = (List)stats.get(ExecSqlInstruction.class);
+        Map<Class<?>, List<ProcessorInstruction>> stats = XMLProgramUtil.getProgramStats(xmlPlan.getOriginalProgram());
+        List<ProcessorInstruction> list = stats.get(ExecSqlInstruction.class);
         
         ExecSqlInstruction instr = (ExecSqlInstruction)list.get(2);
         
@@ -489,8 +485,8 @@
         String expectedDoc = TestXMLProcessor.readFile("TestXMLProcessor-FullSuppliers.xml"); //$NON-NLS-1$
         
         XMLPlan xmlPlan = (XMLPlan)TestXMLProcessor.helpTestProcess("SELECT * FROM xmltest.docJoin", metadata, dataMgr, null, TestOptimizer.getGenericFinder(false), expectedDoc); //$NON-NLS-1$        
-        Map stats = XMLProgramUtil.getProgramStats(xmlPlan.getOriginalProgram());
-        List list = (List)stats.get(ExecSqlInstruction.class);
+        Map<Class<?>, List<ProcessorInstruction>> stats = XMLProgramUtil.getProgramStats(xmlPlan.getOriginalProgram());
+        List<ProcessorInstruction> list = stats.get(ExecSqlInstruction.class);
         
         ExecSqlInstruction instr = (ExecSqlInstruction)list.get(2);
         
@@ -529,8 +525,8 @@
         
         XMLPlan xmlPlan = (XMLPlan)TestXMLProcessor.helpTestProcess("SELECT * FROM xmltest.docJoin where context(Supplier, SupplierID) = 51", expectedDoc, metadata, dataMgr); //$NON-NLS-1$        
         //check for staging; one for staging and for unloading - only two pairs are expected
-        Map stats = XMLProgramUtil.getProgramStats(xmlPlan.getOriginalProgram());
-        assertEquals(4, ((List)stats.get(ExecStagingTableInstruction.class)).size());
+        Map<Class<?>, List<ProcessorInstruction>> stats = XMLProgramUtil.getProgramStats(xmlPlan.getOriginalProgram());
+        assertEquals(4, stats.get(ExecStagingTableInstruction.class).size());
     }
     
 }

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	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/processor/xml/TestXMLProcessor.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -40,6 +40,7 @@
 import org.teiid.core.TeiidException;
 import org.teiid.core.TeiidProcessingException;
 import org.teiid.core.types.DataTypeManager;
+import org.teiid.core.types.DataTypeManager.DefaultDataTypes;
 import org.teiid.core.util.UnitTestUtil;
 import org.teiid.metadata.ColumnSet;
 import org.teiid.metadata.MetadataStore;
@@ -400,73 +401,32 @@
             new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
        
         // Create virtual docs
-        Table doc1 = RealMetadataFactory.createXmlDocument("doc1", xmltest, createXMLMappingNode(true)); //$NON-NLS-1$
-        RealMetadataFactory.createElements(doc1, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
-            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
+        RealMetadataFactory.createXmlDocument("doc1", xmltest, createXMLMappingNode(true)); //$NON-NLS-1$
             
         RealMetadataFactory.createXmlDocument("doc1Unformatted", xmltest, createXMLMappingNode(false)); //$NON-NLS-1$
-        Table doc1b = RealMetadataFactory.createXmlDocument("doc1b", xmltest, createXMLPlan2(false, true, 0 )); //$NON-NLS-1$
-        RealMetadataFactory.createElements(doc1b, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
-                                                        new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
-        Table doc1c = RealMetadataFactory.createXmlDocument("doc1c", xmltest, createXMLPlan2(false, true, 1 )); //$NON-NLS-1$
-        RealMetadataFactory.createElements(doc1c, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
-                                                        new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
-        
-        Table docBounded = RealMetadataFactory.createXmlDocument("docBounded", xmltest, createXMLMappingBoundingNode()); //$NON-NLS-1$
-        RealMetadataFactory.createElements(docBounded, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
-            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
-        
-        Table doc2  = RealMetadataFactory.createXmlDocument("doc2",  xmltest, createXMLPlan2(1, -1, false)); //$NON-NLS-1$
-        RealMetadataFactory.createElements(doc2, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
+        RealMetadataFactory.createXmlDocument("doc1b", xmltest, createXMLPlan2(false, true, 0 )); //$NON-NLS-1$
+        RealMetadataFactory.createXmlDocument("doc1c", xmltest, createXMLPlan2(false, true, 1 )); //$NON-NLS-1$
+        RealMetadataFactory.createXmlDocument("docBounded", xmltest, createXMLMappingBoundingNode()); //$NON-NLS-1$
+        RealMetadataFactory.createXmlDocument("doc2",  xmltest, createXMLPlan2(1, -1, false)); //$NON-NLS-1$
         RealMetadataFactory.createXmlDocument("doc2a", xmltest, createXMLPlan2(1, 1, false)); //$NON-NLS-1$
         RealMetadataFactory.createXmlDocument("doc2b", xmltest, createXMLPlan2(1, -1, true)); //$NON-NLS-1$
         RealMetadataFactory.createXmlDocument("doc2c", xmltest, createXMLPlan2(2, -1, false)); //$NON-NLS-1$
         RealMetadataFactory.createXmlDocument("doc2d", xmltest, createXMLPlan2(2, 1, false)); //$NON-NLS-1$
         RealMetadataFactory.createXmlDocument("doc2e", xmltest, createXMLPlan2(2, 3, false)); //$NON-NLS-1$
 
-        Table doc3 = RealMetadataFactory.createXmlDocument("doc3", xmltest, createXMLPlanWithDefaults()); //$NON-NLS-1$
-        RealMetadataFactory.createElements(doc3, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
-            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
-        Table doc4 = RealMetadataFactory.createXmlDocument("doc4", xmltest, createXMLPlanAdvanced()); //$NON-NLS-1$
-        RealMetadataFactory.createElements(doc4, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Fake", "Catalogs.Fake.FakeChild2", "Catalogs.Fake.FakeChild2.FakeChild2a", "Catalogs.Fake.FakeChild3", "Catalogs.Fake.FakeChild3. at FakeAtt" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$
-            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER,DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
-        Table doc5 = RealMetadataFactory.createXmlDocument("doc5", xmltest, createXMLPlanUltraAdvanced()); //$NON-NLS-1$
-        RealMetadataFactory.createElements(doc5, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.DiscontinuedItem", "Catalogs.Catalog.items.DiscontinuedItem. at ItemID", "Catalogs.Catalog.items.DiscontinuedItem.Name", "Catalogs.Catalog.items.DiscontinuedItem.Quantity", "Catalogs.Catalog.items.StatusUnknown", "Catalogs.Catalog.items.StatusUnknown. at ItemID", "Catalogs.Catalog.items.StatusUnknown.Name", "Catalogs.Catalog.items.StatusUnknown.Quantity", "Catalogs.Catalog.items.Shouldn't see", "Catalogs.Catalog.items.Shouldn't see 2" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$
-            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
-        Table doc6 = RealMetadataFactory.createXmlDocument("doc6", xmltest, createXMLPlanUltraAdvancedExceptionOnDefault()); //$NON-NLS-1$
-        RealMetadataFactory.createElements(doc6, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.DiscontinuedItem", "Catalogs.Catalog.items.DiscontinuedItem. at ItemID", "Catalogs.Catalog.items.DiscontinuedItem.Name", "Catalogs.Catalog.items.DiscontinuedItem.Quantity", "Catalogs.Catalog.items.Shouldn't see"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$
-            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING });
-        Table doc7 = RealMetadataFactory.createXmlDocument("doc7", xmltest, createTestAttributePlan()); //$NON-NLS-1$
-        RealMetadataFactory.createElements(doc7, new String[] { "FixedValueTest", "FixedValueTest.wrapper", "FixedValueTest.wrapper. at fixed", "FixedValueTest.wrapper. at key", "FixedValueTest.wrapper. at fixedAttr"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
-            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
-                        
-        Table doc8 = RealMetadataFactory.createXmlDocument("doc8", xmltest, createXMLPlanNested()); //$NON-NLS-1$
-        RealMetadataFactory.createElements(doc8, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.suppliers", "Catalogs.Catalog.items.item.suppliers.supplier", "Catalogs.Catalog.items.item.suppliers.supplier. at SupplierID", "Catalogs.Catalog.items.item.suppliers.supplier.zip", "Catalogs.Catalog.items.item.suppliers.supplier.Name" },  //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$
-            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
-    
-        Table doc9 = RealMetadataFactory.createXmlDocument("doc9", xmltest, createXMLPlanNested2()); //$NON-NLS-1$
-        RealMetadataFactory.createElements(doc9, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.suppliers", "Catalogs.Catalog.items.item.suppliers.supplier", "Catalogs.Catalog.items.item.suppliers.supplier. at SupplierID", "Catalogs.Catalog.items.item.suppliers.supplier.zip", "Catalogs.Catalog.items.item.suppliers.supplier.Name", "Catalogs.Catalog.items.item.suppliers.supplier.orders", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order. at OrderID" ,"Catalogs.Catalog.items.item.suppliers.supplier.orders.order.OrderDate", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order.OrderQuantity", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order.OrderStatus"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3!
 $ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$ //$NON-NLS-18$
-            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
-            
-        Table doc9a = RealMetadataFactory.createXmlDocument("doc9a", xmltest, createXMLPlanNested2a()); //$NON-NLS-1$
-        RealMetadataFactory.createElements(doc9a, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.suppliers", "Catalogs.Catalog.items.item.suppliers.supplier", "Catalogs.Catalog.items.item.suppliers.supplier. at SupplierID", "Catalogs.Catalog.items.item.suppliers.supplier.zip", "Catalogs.Catalog.items.item.suppliers.supplier.Name", "Catalogs.Catalog.items.item.suppliers.supplier.orders", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order. at OrderID" ,"Catalogs.Catalog.items.item.suppliers.supplier.orders.order.OrderDate", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order.OrderQuantity", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order.OrderStatus"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-!
 3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$ //$NON-NLS-18$
-            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
-
+        RealMetadataFactory.createXmlDocument("doc3", xmltest, createXMLPlanWithDefaults()); //$NON-NLS-1$
+        RealMetadataFactory.createXmlDocument("doc4", xmltest, createXMLPlanAdvanced()); //$NON-NLS-1$
+        RealMetadataFactory.createXmlDocument("doc5", xmltest, createXMLPlanUltraAdvanced()); //$NON-NLS-1$
+        RealMetadataFactory.createXmlDocument("doc6", xmltest, createXMLPlanUltraAdvancedExceptionOnDefault()); //$NON-NLS-1$
+        RealMetadataFactory.createXmlDocument("doc7", xmltest, createTestAttributePlan()); //$NON-NLS-1$
+        RealMetadataFactory.createXmlDocument("doc8", xmltest, createXMLPlanNested()); //$NON-NLS-1$
+        RealMetadataFactory.createXmlDocument("doc9", xmltest, createXMLPlanNested2()); //$NON-NLS-1$
+        RealMetadataFactory.createXmlDocument("doc9a", xmltest, createXMLPlanNested2a()); //$NON-NLS-1$
         RealMetadataFactory.createXmlDocument("doc9b", xmltest, createXMLPlanNested2b()); //$NON-NLS-1$
-        Table doc10 = RealMetadataFactory.createXmlDocument("doc10", xmltest, createXMLPlanNestedWithChoice()); //$NON-NLS-1$
-        RealMetadataFactory.createElements(doc10, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.suppliers", "Catalogs.Catalog.items.item.suppliers.supplier", "Catalogs.Catalog.items.item.suppliers.supplier. at SupplierID", "Catalogs.Catalog.items.item.suppliers.supplier.zip", "Catalogs.Catalog.items.item.suppliers.supplier.Name", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.order", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.order. at OrderID" ,"Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.order.OrderDate", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.order.OrderQuantity", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.!
 order.OrderStatus", "Catalogs.Catalog.items.item.suppliers.supplier.orders.ProcessingOrders" ,"Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.otherorder. at OrderID", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.otherorder"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$ //$NON-NLS-18$ //$NON-NLS-19$ //$NON-NLS-20$ //$NON-NLS-21$
-            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
+        RealMetadataFactory.createXmlDocument("doc10", xmltest, createXMLPlanNestedWithChoice()); //$NON-NLS-1$
+        RealMetadataFactory.createXmlDocument("doc10L", xmltest, createXMLPlanNestedWithLookupChoice()); //$NON-NLS-1$
+        RealMetadataFactory.createXmlDocument("doc11", xmltest, createXMLPlanMultipleDocs()); //$NON-NLS-1$
 
-        Table doc10L = RealMetadataFactory.createXmlDocument("doc10L", xmltest, createXMLPlanNestedWithLookupChoice()); //$NON-NLS-1$
-        RealMetadataFactory.createElements(doc10L, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.suppliers", "Catalogs.Catalog.items.item.suppliers.supplier", "Catalogs.Catalog.items.item.suppliers.supplier. at SupplierID", "Catalogs.Catalog.items.item.suppliers.supplier.zip", "Catalogs.Catalog.items.item.suppliers.supplier.Name", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.order", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.order. at OrderID" ,"Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.order.OrderDate", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.order.OrderQuantity", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders!
 .order.OrderStatus", "Catalogs.Catalog.items.item.suppliers.supplier.orders.ProcessingOrders" ,"Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.otherorder. at OrderID", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.otherorder"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$ //$NON-NLS-18$ //$NON-NLS-19$ //$NON-NLS-20$ //$NON-NLS-21$
-            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
-
-
-        Table doc11 = RealMetadataFactory.createXmlDocument("doc11", xmltest, createXMLPlanMultipleDocs()); //$NON-NLS-1$
-        RealMetadataFactory.createElements(doc11, new String[] { "Item", "Item. at ItemID", "Item.Name", "Item.Quantity", "Item.Suppliers", "Item.Suppliers.Supplier", "Item.Suppliers.Supplier. at SupplierID", "Item.Suppliers.Supplier.Name", "Item.Suppliers.Supplier.Zip"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ 
-            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
-
         //variations on the same recursive doc====================
         boolean useRecursiveCriteria = false;
         int recursionlimit = -1;
@@ -490,50 +450,24 @@
 
         RealMetadataFactory.createXmlDocument("doc17", xmltest, createXMLPlanWithComment()); //$NON-NLS-1$
 
-        Table doc_5266a = RealMetadataFactory.createXmlDocument("doc_5266a", xmltest, createXMLPlanNestedWithChoiceFor5266()); //$NON-NLS-1$
-        RealMetadataFactory.createElements(doc_5266a, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-                                                             new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
-
-
+        RealMetadataFactory.createXmlDocument("doc_5266a", xmltest, createXMLPlanNestedWithChoiceFor5266()); //$NON-NLS-1$
         RealMetadataFactory.createXmlDocument("doc_8917", xmltest, createXMLPlan_defect8917()); //$NON-NLS-1$
-        Table doc_9446 = RealMetadataFactory.createXmlDocument("doc_9446", xmltest, createXMLPlan_defect9446()); //$NON-NLS-1$
+        RealMetadataFactory.createXmlDocument("doc_9446", xmltest, createXMLPlan_defect9446()); //$NON-NLS-1$
         RealMetadataFactory.createXmlDocument("doc_9530", xmltest, createXMLPlan_defect_9530()); //$NON-NLS-1$
-
-        RealMetadataFactory.createElements(doc_9446, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.XXXXX"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
-            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER});
         
         //Test doc w/ update mapping class transformation
         RealMetadataFactory.createXmlDocument("docUpdateTest", xmltest, createUpdateTestDoc()); //$NON-NLS-1$
 
-        Table doc_9893 = RealMetadataFactory.createXmlDocument("doc9893", xmltest, createXMLPlan_9893()); //$NON-NLS-1$
-        RealMetadataFactory.createElements(doc_9893, new String[] { "Root", "Root.ItemName"}, //$NON-NLS-1$ //$NON-NLS-2$
-            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
+        RealMetadataFactory.createXmlDocument("doc9893", xmltest, createXMLPlan_9893()); //$NON-NLS-1$
+        RealMetadataFactory.createXmlDocument("doc18", xmltest, createXMLPlanNested("xmltest.suppliersX")); //$NON-NLS-1$ //$NON-NLS-2$
+        RealMetadataFactory.createXmlDocument("doc12260", xmltest, createXMLPlanCorrelatedSubqueryTransform()); //$NON-NLS-1$
 
-        Table doc18 = RealMetadataFactory.createXmlDocument("doc18", xmltest, createXMLPlanNested("xmltest.suppliersX")); //$NON-NLS-1$ //$NON-NLS-2$
-        RealMetadataFactory.createElements(doc18, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.suppliers", "Catalogs.Catalog.items.item.suppliers.supplier", "Catalogs.Catalog.items.item.suppliers.supplier. at SupplierID", "Catalogs.Catalog.items.item.suppliers.supplier.zip", "Catalogs.Catalog.items.item.suppliers.supplier.Name" },  //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$
-            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
+        RealMetadataFactory.createXmlDocument("doc8373", xmltest, createXMLPlan_defect8373()); //$NON-NLS-1$
 
-        Table doc12260 = RealMetadataFactory.createXmlDocument("doc12260", xmltest, createXMLPlanCorrelatedSubqueryTransform()); //$NON-NLS-1$
-        RealMetadataFactory.createElements(doc12260, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.numSuppliers" },  //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-7$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-8$
-            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING});
+        RealMetadataFactory.createXmlDocument("doc8373a", xmltest, createXMLPlan_defect8373a()); //$NON-NLS-1$
+        RealMetadataFactory.createXmlDocument("doc8373b", xmltest, createXMLPlan_defect8373b()); //$NON-NLS-1$
+        RealMetadataFactory.createXmlDocument("doc13617", xmltest, createXMLPlanDefect13617()); //$NON-NLS-1$
 
-        Table doc8373 = RealMetadataFactory.createXmlDocument("doc8373", xmltest, createXMLPlan_defect8373()); //$NON-NLS-1$
-        RealMetadataFactory.createElements(doc8373, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.numSuppliers" },  //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-7$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-8$
-                                                            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING});
-
-        Table doc8373a = RealMetadataFactory.createXmlDocument("doc8373a", xmltest, createXMLPlan_defect8373a()); //$NON-NLS-1$
-        RealMetadataFactory.createElements(doc8373a, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.numSuppliers" },  //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-7$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-8$
-                                                            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING});
-
-        Table doc8373b = RealMetadataFactory.createXmlDocument("doc8373b", xmltest, createXMLPlan_defect8373b()); //$NON-NLS-1$
-        RealMetadataFactory.createElements(doc8373b, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.numSuppliers" },  //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-7$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-8$
-                                                            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING});
-
-        Table doc13617 = RealMetadataFactory.createXmlDocument("doc13617", xmltest, createXMLPlanDefect13617()); //$NON-NLS-1$
-        RealMetadataFactory.createElements(doc13617, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity" },  //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-7$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ 
-            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER});
-        
-
         // recursive + staging ========================================================
 
         RealMetadataFactory.createXmlDocument("doc19", xmltest, createXMLPlanRecursiveStaging(true, recursionlimit, exceptionOnLimit)); //$NON-NLS-1$
@@ -577,17 +511,9 @@
         // normDoc1 - for collapse
         // normDoc2 - for replace
         // normDoc3 - for preserve
-        Table normDoc1 = RealMetadataFactory.createXmlDocument("normDoc1", xmltest, createXMLPlanNormalization(MappingNodeConstants.NORMALIZE_TEXT_COLLAPSE)); //$NON-NLS-1$
-        RealMetadataFactory.createElements(normDoc1, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.DiscontinuedItem", "Catalogs.Catalog.items.DiscontinuedItem. at ItemID", "Catalogs.Catalog.items.DiscontinuedItem.Name", "Catalogs.Catalog.items.DiscontinuedItem.Quantity", "Catalogs.Catalog.items.StatusUnknown", "Catalogs.Catalog.items.StatusUnknown. at ItemID", "Catalogs.Catalog.items.StatusUnknown.Name", "Catalogs.Catalog.items.StatusUnknown.Quantity", "Catalogs.Catalog.items.Shouldn't see", "Catalogs.Catalog.items.Shouldn't see 2" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$
-                                                        new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
-        Table normDoc2 = RealMetadataFactory.createXmlDocument("normDoc2", xmltest, createXMLPlanNormalization(MappingNodeConstants.NORMALIZE_TEXT_REPLACE)); //$NON-NLS-1$
-        RealMetadataFactory.createElements(normDoc2, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.DiscontinuedItem", "Catalogs.Catalog.items.DiscontinuedItem. at ItemID", "Catalogs.Catalog.items.DiscontinuedItem.Name", "Catalogs.Catalog.items.DiscontinuedItem.Quantity", "Catalogs.Catalog.items.StatusUnknown", "Catalogs.Catalog.items.StatusUnknown. at ItemID", "Catalogs.Catalog.items.StatusUnknown.Name", "Catalogs.Catalog.items.StatusUnknown.Quantity", "Catalogs.Catalog.items.Shouldn't see", "Catalogs.Catalog.items.Shouldn't see 2" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$
-                                                            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- 
-        Table normDoc3 = RealMetadataFactory.createXmlDocument("normDoc3", xmltest, createXMLPlanNormalization(MappingNodeConstants.NORMALIZE_TEXT_PRESERVE)); //$NON-NLS-1$
-        RealMetadataFactory.createElements(normDoc3, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.DiscontinuedItem", "Catalogs.Catalog.items.DiscontinuedItem. at ItemID", "Catalogs.Catalog.items.DiscontinuedItem.Name", "Catalogs.Catalog.items.DiscontinuedItem.Quantity", "Catalogs.Catalog.items.StatusUnknown", "Catalogs.Catalog.items.StatusUnknown. at ItemID", "Catalogs.Catalog.items.StatusUnknown.Name", "Catalogs.Catalog.items.StatusUnknown.Quantity", "Catalogs.Catalog.items.Shouldn't see", "Catalogs.Catalog.items.Shouldn't see 2" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$
-                                                            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
-        
+        RealMetadataFactory.createXmlDocument("normDoc1", xmltest, createXMLPlanNormalization(MappingNodeConstants.NORMALIZE_TEXT_COLLAPSE)); //$NON-NLS-1$
+        RealMetadataFactory.createXmlDocument("normDoc2", xmltest, createXMLPlanNormalization(MappingNodeConstants.NORMALIZE_TEXT_REPLACE)); //$NON-NLS-1$
+        RealMetadataFactory.createXmlDocument("normDoc3", xmltest, createXMLPlanNormalization(MappingNodeConstants.NORMALIZE_TEXT_PRESERVE)); //$NON-NLS-1$
         QueryNode vspqn1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN insert into #temp select * from stock.items where itemquantity < param; SELECT * FROM xmltest.doc1 where Item.Quantity < (select avg(itemquantity) from #temp); END"); //$NON-NLS-1$ //$NON-NLS-2$
         ColumnSet<Procedure> vsprs1 = RealMetadataFactory.createResultSet("pm1.vsprs1", new String[] { "xml" }, new String[] { DataTypeManager.DefaultDataTypes.XML }); //$NON-NLS-1$ //$NON-NLS-2$
         ProcedureParameter vspp1 = RealMetadataFactory.createParameter("param", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
@@ -664,10 +590,7 @@
 // =========================================================================================================
 
 		// Create virtual docs
-		Table doc9c= RealMetadataFactory.createXmlDocument("doc9c", xmltest, createXMLPlanNested2c()); //$NON-NLS-1$
-		RealMetadataFactory.createElements(doc9c, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.suppliers", "Catalogs.Catalog.items.item.suppliers.supplier", "Catalogs.Catalog.items.item.suppliers.supplier. at SupplierID", "Catalogs.Catalog.items.item.suppliers.supplier.zip", "Catalogs.Catalog.items.item.suppliers.supplier.Name", "Catalogs.Catalog.items.item.orders", "Catalogs.Catalog.items.item.orders.order", "Catalogs.Catalog.items.item.orders.order. at OrderID" ,"Catalogs.Catalog.items.item.orders.order.zip", "Catalogs.Catalog.items.item.orders.order.Name"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$!
  //$NON-NLS-17$
-			new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
-		
+		RealMetadataFactory.createXmlDocument("doc9c", xmltest, createXMLPlanNested2c()); //$NON-NLS-1$
 		return RealMetadataFactory.createTransformationMetadata(metadataStore, "nestedWithSibling");		
 	}
 	
@@ -789,19 +712,10 @@
         RealMetadataFactory.createXmlDocument("doc1a", xqttest, createXQTPlanRecursive1a_5988()); //$NON-NLS-1$
         RealMetadataFactory.createXmlDocument("doc2", xqttest,   createXQTPlanRecursiveSiblings()); //$NON-NLS-1$
         RealMetadataFactory.createXmlDocument("doc3", xqttest,   createXQTPlanRecursive3_5988()); //$NON-NLS-1$
-        Table doc4 = RealMetadataFactory.createXmlDocument("doc4", xqttest,   createXQTPlanChoice_6796()); //$NON-NLS-1$
-        Table doc5 = RealMetadataFactory.createXmlDocument("doc5", xqttest,   createChoiceDefect24651()); //$NON-NLS-1$
-        Table groupDoc = RealMetadataFactory.createXmlDocument("groupDoc", xqttest,   createGroupDoc()); //$NON-NLS-1$
+        RealMetadataFactory.createXmlDocument("doc4", xqttest,   createXQTPlanChoice_6796()); //$NON-NLS-1$
+        RealMetadataFactory.createXmlDocument("doc5", xqttest,   createChoiceDefect24651()); //$NON-NLS-1$
+        RealMetadataFactory.createXmlDocument("groupDoc", xqttest,   createGroupDoc()); //$NON-NLS-1$
 
-        RealMetadataFactory.createElements(groupDoc, new String[] { "group", "group.pseudoID" /*, etc...*/ }, //$NON-NLS-1$ //$NON-NLS-2$
-            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
-        
-        RealMetadataFactory.createElements(doc4, new String[] { "root", "root.key", "root.key.keys", "root.key.keys.nestedkey", "root.wrapper.key", "root.wrapper.key.keys", "root.wrapper.key.keys.nestedkey"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
-                                                               new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
-        
-        RealMetadataFactory.createElements(doc5, new String[] { "root", "root.wrapper.key" }, //$NON-NLS-1$ //$NON-NLS-2$
-                                                                new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
-         
         return RealMetadataFactory.createTransformationMetadata(metadataStore, "example2");
     }
 
@@ -828,10 +742,7 @@
         new String[] { "ID"}, //$NON-NLS-1$
         new String[] {DataTypeManager.DefaultDataTypes.STRING});        
 
-        Table doc_SOAP = RealMetadataFactory.createXmlDocument("docSoap", xmltest, createXMLPlanSOAP()); //$NON-NLS-1$
-        RealMetadataFactory.createElements(doc_SOAP, new String[] { "TaxReports", "TaxReports.TaxReport", "TaxReports.TaxReport.ArrayOfTaxID","TaxReports.TaxReport.ArrayOfTaxID.TaxID","TaxReports.TaxReport.ArrayOfTaxID.TaxID.ID"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
-            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
-                                               
+        RealMetadataFactory.createXmlDocument("docSoap", xmltest, createXMLPlanSOAP()); //$NON-NLS-1$
         return RealMetadataFactory.createTransformationMetadata(metadataStore, "soap1");
     }
 	
@@ -1528,7 +1439,6 @@
         return doc;
     }    
     
-    
     private static MappingElement createXMLPlan1Unformatted( boolean testNillable, int cardinality ) {
 
         MappingElement root = new MappingElement("Catalogs");//$NON-NLS-1$
@@ -1542,7 +1452,7 @@
         item.setMaxOccurrs(-1);
         item.addAttribute(new MappingAttribute("ItemID", "xmltest.group.items.itemNum")); //$NON-NLS-1$ //$NON-NLS-2$
         item.addChildElement(new MappingElement("Name", "xmltest.group.items.itemName").setNillable(true)); //$NON-NLS-1$ //$NON-NLS-2$
-        item.addChildElement(new MappingElement("Quantity", "xmltest.group.items.itemQuantity")); //$NON-NLS-1$ //$NON-NLS-2$        
+        item.addChildElement(new MappingElement("Quantity", "xmltest.group.items.itemQuantity").setType(DefaultDataTypes.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$        
         return root;                                
     }
 
@@ -2014,7 +1924,7 @@
         item.setMaxOccurrs(-1);
         item.addAttribute(new MappingAttribute("XXXXX", "xmltest.group.items.itemNum")); //$NON-NLS-1$ //$NON-NLS-2$
         item.addChildElement(new MappingElement("XXXXX", "xmltest.group.items.itemName")); //$NON-NLS-1$ //$NON-NLS-2$
-        item.addChildElement(new MappingElement("XXXXX", "xmltest.group.items.itemQuantity")); //$NON-NLS-1$ //$NON-NLS-2$
+        item.addChildElement(new MappingElement("XXXXX", "xmltest.group.items.itemQuantity").setType(DefaultDataTypes.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
         return doc;                                
     }
     
@@ -2056,7 +1966,7 @@
 
         MappingSequenceNode sequence = root.addSequenceNode(new MappingSequenceNode());
         sequence.addChildElement(new MappingElement("ID", "xqttest.group.ID")); //$NON-NLS-1$ //$NON-NLS-2$
-        sequence.addChildElement(new MappingElement("code", "xqttest.group.Code")); //$NON-NLS-1$ //$NON-NLS-2$
+        sequence.addChildElement(new MappingElement("code", "xqttest.group.code")); //$NON-NLS-1$ //$NON-NLS-2$
 
         MappingElement supervisor = sequence.addChildElement(new MappingElement("supervisor")); //$NON-NLS-1$
         supervisor.setSource("xqttest.supervisor"); //$NON-NLS-1$
@@ -2065,7 +1975,7 @@
 
         MappingSequenceNode sequence1 = supervisor.addSequenceNode(new MappingSequenceNode());
         sequence1.addChildElement(new MappingElement("ID", "xqttest.supervisor.ID")); //$NON-NLS-1$ //$NON-NLS-2$
-        sequence1.addChildElement(new MappingElement("code", "xqttest.supervisor.Code")); //$NON-NLS-1$ //$NON-NLS-2$
+        sequence1.addChildElement(new MappingElement("code", "xqttest.supervisor.code")); //$NON-NLS-1$ //$NON-NLS-2$
         
         MappingRecursiveElement group1 = (MappingRecursiveElement)sequence1.addChildElement(new MappingRecursiveElement("group", "xqttest.group")); //$NON-NLS-1$ //$NON-NLS-2$
         group1.setSource("xqttest.group1"); //$NON-NLS-1$
@@ -4107,8 +4017,8 @@
 
         // check the staging base line (unknown cost)
         // one for staging and for unloading
-        Map stats = XMLProgramUtil.getProgramStats(plan.getOriginalProgram());
-        assertEquals(2, ((List)stats.get(ExecStagingTableInstruction.class)).size());
+        Map<Class<?>, List<ProcessorInstruction>> stats = XMLProgramUtil.getProgramStats(plan.getOriginalProgram());
+        assertEquals(2, stats.get(ExecStagingTableInstruction.class).size());
     }
 
     /**

Modified: trunk/engine/src/test/java/org/teiid/query/processor/xml/XMLProgramUtil.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/xml/XMLProgramUtil.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/processor/xml/XMLProgramUtil.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -27,26 +27,19 @@
 import java.util.List;
 import java.util.Map;
 
-import org.teiid.query.processor.xml.Condition;
-import org.teiid.query.processor.xml.IfInstruction;
-import org.teiid.query.processor.xml.ProcessorInstruction;
-import org.teiid.query.processor.xml.Program;
-import org.teiid.query.processor.xml.RecurseProgramCondition;
-import org.teiid.query.processor.xml.WhileInstruction;
 
-
 /** 
  * 
  */
 public class XMLProgramUtil {
     
-    public static Map getProgramStats(Program program) {
-        HashMap map = new HashMap();
+    public static Map<Class<?>, List<ProcessorInstruction>> getProgramStats(Program program) {
+        HashMap<Class<?>, List<ProcessorInstruction>> map = new HashMap<Class<?>, List<ProcessorInstruction>>();
         getProgramStats(program, map);
         return map;
     }
 
-    private static Map getProgramStats(Program program, Map map) {
+    private static Map<Class<?>, List<ProcessorInstruction>> getProgramStats(Program program, Map<Class<?>, List<ProcessorInstruction>> map) {
         Program childProgram = null;
         
         if (program == null) {
@@ -75,9 +68,9 @@
                 }
             }
             
-            List instrs = (List)map.get(inst.getClass());
+            List<ProcessorInstruction> instrs = map.get(inst.getClass());
             if (instrs == null) {
-                instrs = new LinkedList();
+                instrs = new LinkedList<ProcessorInstruction>();
                 map.put(inst.getClass(), instrs);
             }
             instrs.add(inst);

Modified: trunk/engine/src/test/java/org/teiid/query/resolver/CheckSymbolsAreResolvedVisitor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/resolver/CheckSymbolsAreResolvedVisitor.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/resolver/CheckSymbolsAreResolvedVisitor.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -25,8 +25,15 @@
 import java.util.ArrayList;
 import java.util.Collection;
 
-import org.teiid.query.sql.*;
-import org.teiid.query.sql.symbol.*;
+import org.teiid.query.sql.LanguageObject;
+import org.teiid.query.sql.LanguageVisitor;
+import org.teiid.query.sql.symbol.CaseExpression;
+import org.teiid.query.sql.symbol.ElementSymbol;
+import org.teiid.query.sql.symbol.Function;
+import org.teiid.query.sql.symbol.GroupSymbol;
+import org.teiid.query.sql.symbol.Reference;
+import org.teiid.query.sql.symbol.ScalarSubquery;
+import org.teiid.query.sql.symbol.SearchedCaseExpression;
 
 
 /**
@@ -35,10 +42,10 @@
  */
 public class CheckSymbolsAreResolvedVisitor extends LanguageVisitor {
 
-    private Collection unresolvedSymbols;
+    private Collection<LanguageObject> unresolvedSymbols;
     
 	public CheckSymbolsAreResolvedVisitor() { 
-        unresolvedSymbols = new ArrayList();    
+        unresolvedSymbols = new ArrayList<LanguageObject>();    
     }
     
     /**
@@ -46,18 +53,18 @@
      * @return Collection of any unresolved Symbols; may
      * be empty but never null
      */
-    public Collection getUnresolvedSymbols(){
+    public Collection<LanguageObject> getUnresolvedSymbols(){
         return this.unresolvedSymbols;
     }
     
     public void visit(CaseExpression obj) {
-        if (!obj.isResolved()){
+        if (obj.getType() == null){
             this.unresolvedSymbols.add(obj);
         }
     }
     
     public void visit(ElementSymbol obj) {
-        if (!obj.isResolved()){
+        if (obj.getMetadataID() == null){
             this.unresolvedSymbols.add(obj);
         }
     }
@@ -69,25 +76,25 @@
     }
 
     public void visit(SearchedCaseExpression obj) {
-        if (!obj.isResolved()){
+        if (obj.getType() == null){
             this.unresolvedSymbols.add(obj);
         }
     }
     
     public void visit(ScalarSubquery obj) {
-        if (!obj.isResolved()){
+        if (obj.getType() == null){
             this.unresolvedSymbols.add(obj);
         }
     }
     
     public void visit(Function obj) {
-        if (!obj.isResolved()){
+        if (obj.getFunctionDescriptor() == null){
             this.unresolvedSymbols.add(obj);
         }
     }
     
     public void visit(Reference obj) {
-        if (!obj.isResolved()){
+        if (obj.getType() == null){
             this.unresolvedSymbols.add(obj);
         }
     }

Modified: trunk/engine/src/test/java/org/teiid/query/resolver/TestProcedureResolving.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/resolver/TestProcedureResolving.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/resolver/TestProcedureResolving.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -35,7 +35,7 @@
 import org.teiid.metadata.Table;
 import org.teiid.query.metadata.QueryMetadataInterface;
 import org.teiid.query.metadata.TempMetadataAdapter;
-import org.teiid.query.metadata.TempMetadataStore;
+import org.teiid.query.metadata.TempMetadataID;
 import org.teiid.query.parser.QueryParser;
 import org.teiid.query.sql.ProcedureReservedWords;
 import org.teiid.query.sql.lang.Command;
@@ -91,19 +91,19 @@
         String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
         
         Command command = helpResolveUpdateProcedure(proc.toString(), userUpdateStr, Table.TriggerEvent.UPDATE);
-        Map tempIDs = command.getTemporaryMetadata();
+        Map<String, TempMetadataID> tempIDs = command.getTemporaryMetadata().getData();
         assertNotNull(tempIDs);
         assertNull(tempIDs.get("LOOPCURSOR")); //$NON-NLS-1$
         assertNull(tempIDs.get("LOOPCURSOR2")); //$NON-NLS-1$
         
         Command subCommand = CommandCollectorVisitor.getCommands(command).get(0);
-        tempIDs = subCommand.getTemporaryMetadata();
+        tempIDs = subCommand.getTemporaryMetadata().getData();
         assertNotNull(tempIDs);
         assertNull(tempIDs.get("LOOPCURSOR")); //$NON-NLS-1$
         assertNull(tempIDs.get("LOOPCURSOR2")); //$NON-NLS-1$
 
         subCommand = CommandCollectorVisitor.getCommands(command).get(1);
-        tempIDs = subCommand.getTemporaryMetadata();
+        tempIDs = subCommand.getTemporaryMetadata().getData();
         assertNotNull(tempIDs);
         assertNotNull(tempIDs.get("LOOPCURSOR")); //$NON-NLS-1$
         assertNull(tempIDs.get("LOOPCURSOR2")); //$NON-NLS-1$
@@ -120,7 +120,7 @@
 			QueryMetadataException {
 		ProcedureContainer userCommand = (ProcedureContainer)QueryParser.getQueryParser().parseCommand(userUpdateStr); 
         QueryResolver.resolveCommand(userCommand, metadata);
-        metadata = new TempMetadataAdapter(metadata, new TempMetadataStore(userCommand.getTemporaryMetadata()));
+        metadata = new TempMetadataAdapter(metadata, userCommand.getTemporaryMetadata());
         return (CreateProcedureCommand)QueryResolver.expandCommand(userCommand, metadata, null);
 	}
 
@@ -171,8 +171,8 @@
         Block block = command.getBlock();
         
         AssignmentStatement assStmt = (AssignmentStatement)block.getStatements().get(1);
-        assertEquals(ProcedureReservedWords.VARIABLES, assStmt.getVariable().getGroupSymbol().getCanonicalName());
-        assertEquals(ProcedureReservedWords.VARIABLES, ((ElementSymbol)assStmt.getExpression()).getGroupSymbol().getCanonicalName());
+        assertEquals(ProcedureReservedWords.VARIABLES, assStmt.getVariable().getGroupSymbol().getName());
+        assertEquals(ProcedureReservedWords.VARIABLES, ((ElementSymbol)assStmt.getExpression()).getGroupSymbol().getName());
         
         Block inner = ((LoopStatement)block.getStatements().get(2)).getBlock();
         
@@ -180,7 +180,7 @@
         
         ElementSymbol value = ElementCollectorVisitor.getElements(assStmt.getExpression(), false).iterator().next();
         
-        assertEquals("LOOPCURSOR", value.getGroupSymbol().getCanonicalName()); //$NON-NLS-1$
+        assertEquals("loopCursor", value.getGroupSymbol().getName()); //$NON-NLS-1$
     }
     
 	// variable resolution, variable used in if statement, variable compared against

Modified: trunk/engine/src/test/java/org/teiid/query/resolver/TestResolver.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/resolver/TestResolver.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/resolver/TestResolver.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -77,7 +77,7 @@
 import org.teiid.query.sql.symbol.Function;
 import org.teiid.query.sql.symbol.GroupSymbol;
 import org.teiid.query.sql.symbol.Reference;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Symbol;
 import org.teiid.query.sql.symbol.XMLQuery;
 import org.teiid.query.sql.util.SymbolMap;
 import org.teiid.query.sql.visitor.CommandCollectorVisitor;
@@ -278,12 +278,16 @@
 	
 	private void helpCheckSelect(Query query, String[] elementNames) {
 		Select select = query.getSelect();
-		List<SingleElementSymbol> elements = select.getProjectedSymbols();
+		List<Expression> elements = select.getProjectedSymbols();
 		assertEquals("Wrong number of select symbols: ", elementNames.length, elements.size()); //$NON-NLS-1$
 
 		for(int i=0; i<elements.size(); i++) {
-			SingleElementSymbol symbol = elements.get(i);
-			assertEquals("Element name does not match: ", elementNames[i].toUpperCase(), symbol.getName().toUpperCase()); //$NON-NLS-1$
+			Expression symbol = elements.get(i);
+			String name = Symbol.getShortName(symbol);
+			if (symbol instanceof ElementSymbol) {
+				name = ((ElementSymbol)symbol).getName();
+			}
+			assertEquals("Element name does not match: ", elementNames[i].toUpperCase(), name.toString().toUpperCase()); //$NON-NLS-1$
 		}
 	}
 
@@ -635,7 +639,7 @@
 	@Test public void testSelectExpressions() {
 		Query resolvedQuery = (Query) helpResolve("SELECT e1, concat(e1, 's'), concat(e1, 's') as c FROM pm1.g1"); //$NON-NLS-1$
 		helpCheckFrom(resolvedQuery, new String[] { "pm1.g1" }); //$NON-NLS-1$
-		helpCheckSelect(resolvedQuery, new String[] { "pm1.g1.e1", "expr", "c" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		helpCheckSelect(resolvedQuery, new String[] { "pm1.g1.e1", "expr2", "c" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 		helpCheckElements(resolvedQuery.getSelect(),
 			new String[] { "pm1.g1.e1", "pm1.g1.e1", "pm1.g1.e1" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 			new String[] { "pm1.g1.e1", "pm1.g1.e1", "pm1.g1.e1" } ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -644,7 +648,7 @@
 	@Test public void testSelectCountStar() {
 		Query resolvedQuery = (Query) helpResolve("SELECT count(*) FROM pm1.g1"); //$NON-NLS-1$
 		helpCheckFrom(resolvedQuery, new String[] { "pm1.g1" }); //$NON-NLS-1$
-		helpCheckSelect(resolvedQuery, new String[] { "count" }); //$NON-NLS-1$
+		helpCheckSelect(resolvedQuery, new String[] { "expr1" }); //$NON-NLS-1$
 		helpCheckElements(resolvedQuery.getSelect(), new String[] { }, new String[] { } );
 	}
 	
@@ -810,7 +814,7 @@
         Query resolvedQuery = (Query) helpResolveWithBindings("SELECT pm1.g1.e1, ? FROM pm1.g1 WHERE pm1.g1.e1 = ?", metadata, bindings); //$NON-NLS-1$
 
         helpCheckFrom(resolvedQuery, new String[] { "pm1.g1" }); //$NON-NLS-1$
-        helpCheckSelect(resolvedQuery, new String[] { "pm1.g1.e1", "expr" }); //$NON-NLS-1$ //$NON-NLS-2$
+        helpCheckSelect(resolvedQuery, new String[] { "pm1.g1.e1", "expr2" }); //$NON-NLS-1$ //$NON-NLS-2$
         helpCheckElements(resolvedQuery.getCriteria(), 
             new String[] { "pm1.g1.e1", "pm1.g2.e2" }, //$NON-NLS-1$
             new String[] { "pm1.g1.e1", "pm1.g2.e2" } ); //$NON-NLS-1$
@@ -1416,8 +1420,8 @@
         
         List projSymbols = resolvedQuery.getSelect().getProjectedSymbols();
         assertEquals("Wrong number of projected symbols", 2, projSymbols.size()); //$NON-NLS-1$
-        assertEquals("Wrong type for first symbol", String.class, ((SingleElementSymbol)projSymbols.get(0)).getType()); //$NON-NLS-1$
-        assertEquals("Wrong type for second symbol", Double.class, ((SingleElementSymbol)projSymbols.get(1)).getType()); //$NON-NLS-1$
+        assertEquals("Wrong type for first symbol", String.class, ((Expression)projSymbols.get(0)).getType()); //$NON-NLS-1$
+        assertEquals("Wrong type for second symbol", Double.class, ((Expression)projSymbols.get(1)).getType()); //$NON-NLS-1$
     }
 
     @Test public void testLookupFunctionFailBadElement() {     
@@ -1985,17 +1989,17 @@
     @Test public void testNestedUnionQueryWithNull() throws Exception{
         SetQuery command = (SetQuery)helpResolve("SELECT e2, e3 FROM pm1.g1 UNION (SELECT null, e3 FROM pm1.g2 UNION SELECT null, e3 from pm1.g1)"); //$NON-NLS-1$
         
-        assertEquals(DataTypeManager.DefaultDataClasses.INTEGER, ((SingleElementSymbol)command.getProjectedSymbols().get(0)).getType());
+        assertEquals(DataTypeManager.DefaultDataClasses.INTEGER, ((Expression)command.getProjectedSymbols().get(0)).getType());
     }
     
     @Test public void testUnionQueryClone() throws Exception{
         SetQuery command = (SetQuery)helpResolve("SELECT e2, e3 FROM pm1.g1 UNION SELECT e3, e2 from pm1.g1"); //$NON-NLS-1$
         
-        assertEquals(DataTypeManager.DefaultDataClasses.INTEGER, ((SingleElementSymbol)command.getProjectedSymbols().get(1)).getType());
+        assertEquals(DataTypeManager.DefaultDataClasses.INTEGER, ((Expression)command.getProjectedSymbols().get(1)).getType());
         
         command = (SetQuery)command.clone();
         
-        assertEquals(DataTypeManager.DefaultDataClasses.INTEGER, ((SingleElementSymbol)command.getProjectedSymbols().get(1)).getType());
+        assertEquals(DataTypeManager.DefaultDataClasses.INTEGER, ((Expression)command.getProjectedSymbols().get(1)).getType());
     }
     
     @Test public void testSelectIntoNoFrom() {
@@ -2089,7 +2093,7 @@
         QueryResolver.resolveCommand(query, RealMetadataFactory.exampleBQTCached());
         
         // Check type of resolved null constant
-        SingleElementSymbol symbol = (SingleElementSymbol) query.getSelect().getSymbols().get(0);
+        Expression symbol = query.getSelect().getSymbols().get(0);
         assertNotNull(symbol.getType());
         assertEquals(DataTypeManager.DefaultDataClasses.STRING, symbol.getType());
     }
@@ -2180,7 +2184,7 @@
     private void verifyProjectedTypes(Command c, Class[] types) {
         List projSymbols = c.getProjectedSymbols();
         for(int i=0; i<projSymbols.size(); i++) {
-            assertEquals("Found type mismatch at column " + i, types[i], ((SingleElementSymbol) projSymbols.get(i)).getType()); //$NON-NLS-1$
+            assertEquals("Found type mismatch at column " + i, types[i], ((Expression) projSymbols.get(i)).getType()); //$NON-NLS-1$
         }                
     }
     
@@ -2386,7 +2390,7 @@
         
         CompareCriteria criteria = (CompareCriteria)((Query)cmdStmt.getCommand()).getCriteria();
         
-        assertEquals(ProcedureReservedWords.VARIABLES, ((ElementSymbol)criteria.getRightExpression()).getGroupSymbol().getCanonicalName());
+        assertEquals(ProcedureReservedWords.VARIABLES, ((ElementSymbol)criteria.getRightExpression()).getGroupSymbol().getName());
     }
     
     /**
@@ -2519,7 +2523,7 @@
         
         Query query = (Query)helpResolve(sql);
         
-        TempMetadataStore store = new TempMetadataStore(query.getTemporaryMetadata());
+        TempMetadataStore store = query.getTemporaryMetadata();
         
         TempMetadataID id = store.getTempElementID("#temp.x"); //$NON-NLS-1$
         
@@ -2531,7 +2535,7 @@
         
         Insert insert = (Insert)helpResolve(sql);
         
-        TempMetadataStore store = new TempMetadataStore(insert.getTemporaryMetadata());
+        TempMetadataStore store = insert.getTemporaryMetadata();
         
         TempMetadataID id = store.getTempElementID("#temp.x"); //$NON-NLS-1$
         
@@ -2672,7 +2676,7 @@
     	String sql = "select convert(null, xml) from pm1.g1 union all select 1"; //$NON-NLS-1$
     	
     	SetQuery query = (SetQuery)helpResolve(sql, RealMetadataFactory.example1Cached());
-    	assertEquals(DataTypeManager.DefaultDataClasses.OBJECT, ((SingleElementSymbol)query.getProjectedSymbols().get(0)).getType());
+    	assertEquals(DataTypeManager.DefaultDataClasses.OBJECT, ((Expression)query.getProjectedSymbols().get(0)).getType());
     }
     
     @Test public void testUnionWithSubQuery() {
@@ -2891,7 +2895,7 @@
     @Test public void testParamOrder() {
         Query resolvedQuery = (Query)helpResolve("SELECT * FROM (exec pm4.spRetOut()) as a", RealMetadataFactory.exampleBQTCached()); //$NON-NLS-1$
         
-        assertEquals("a.ret", resolvedQuery.getProjectedSymbols().get(0).getName());
+        assertEquals("a.ret", resolvedQuery.getProjectedSymbols().get(0).toString());
     }
     
     @Test public void testOrderByAggregatesError() throws Exception {
@@ -2939,7 +2943,7 @@
     
     @Test public void testXmlQueryWithParam() {
     	Query q = (Query)helpResolve("select xmlquery('/a' passing ?)");
-    	XMLQuery ex = (XMLQuery) SymbolMap.getExpression((Expression) q.getSelect().getSymbols().get(0));
+    	XMLQuery ex = (XMLQuery) SymbolMap.getExpression(q.getSelect().getSymbols().get(0));
     	assertEquals(DataTypeManager.DefaultDataClasses.XML, ex.getPassing().get(0).getExpression().getType());
     }
 

Modified: trunk/engine/src/test/java/org/teiid/query/resolver/TestXMLResolver.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/resolver/TestXMLResolver.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/resolver/TestXMLResolver.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -58,7 +58,7 @@
     @Test public void testXMLCriteriaShortElement() {
         CompareCriteria expected = new CompareCriteria();
         GroupSymbol gs = new GroupSymbol("xmltest.doc1"); //$NON-NLS-1$
-        ElementSymbol es = new ElementSymbol("root.node1", null, gs); //$NON-NLS-1$
+        ElementSymbol es = new ElementSymbol("root.node1", gs); //$NON-NLS-1$
         expected.setLeftExpression(es);
         expected.setOperator(CompareCriteria.EQ);
         expected.setRightExpression(new Constant("yyz")); //$NON-NLS-1$
@@ -71,7 +71,7 @@
     @Test public void testXMLCriteriaLongElement1() {
         CompareCriteria expected = new CompareCriteria();
         GroupSymbol gs = new GroupSymbol("xmltest.doc1"); //$NON-NLS-1$
-        ElementSymbol es = new ElementSymbol("root.node1", null, gs); //$NON-NLS-1$
+        ElementSymbol es = new ElementSymbol("root.node1", gs); //$NON-NLS-1$
         es.setGroupSymbol(gs);
         expected.setLeftExpression(es);
         expected.setOperator(CompareCriteria.EQ);
@@ -85,7 +85,7 @@
     @Test public void testXMLCriteriaLongElement2() {
         CompareCriteria expected1 = new CompareCriteria();
         GroupSymbol gs = new GroupSymbol("xmltest.doc4"); //$NON-NLS-1$
-        ElementSymbol es1 = new ElementSymbol("root.node1", null, gs); //$NON-NLS-1$
+        ElementSymbol es1 = new ElementSymbol("root.node1", gs); //$NON-NLS-1$
         expected1.setLeftExpression(es1);
         expected1.setOperator(CompareCriteria.EQ);
         expected1.setRightExpression(new Constant("xyz"));         //$NON-NLS-1$
@@ -98,7 +98,7 @@
     @Test public void testXMLCriteriaLongElement3() {
         GroupSymbol gs = new GroupSymbol("xmltest.doc4"); //$NON-NLS-1$
         CompareCriteria expected2 = new CompareCriteria();
-        ElementSymbol es2 = new ElementSymbol("root.node1. at node2", null, gs); //$NON-NLS-1$
+        ElementSymbol es2 = new ElementSymbol("root.node1. at node2", gs); //$NON-NLS-1$
         es2.setGroupSymbol(gs);
         expected2.setLeftExpression(es2);
         expected2.setOperator(CompareCriteria.EQ);
@@ -112,7 +112,7 @@
     @Test public void testXMLCriteriaLongElement4() {
         GroupSymbol gs = new GroupSymbol("xmltest.doc4"); //$NON-NLS-1$
         CompareCriteria expected3 = new CompareCriteria();
-        ElementSymbol es3 = new ElementSymbol("root.node3", null, gs); //$NON-NLS-1$
+        ElementSymbol es3 = new ElementSymbol("root.node3", gs); //$NON-NLS-1$
         expected3.setLeftExpression(es3);
         expected3.setOperator(CompareCriteria.EQ);
         expected3.setRightExpression(new Constant("xyz")); //$NON-NLS-1$
@@ -194,7 +194,7 @@
     @Test public void testXMLCriteriaLongElementInAnonymous() {                  
         CompareCriteria expected = new CompareCriteria();
         GroupSymbol gs = new GroupSymbol("xmltest.doc2"); //$NON-NLS-1$
-        ElementSymbol es = new ElementSymbol("root.node1.node3", null, gs); //$NON-NLS-1$
+        ElementSymbol es = new ElementSymbol("root.node1.node3", gs); //$NON-NLS-1$
         expected.setLeftExpression(es);
         expected.setOperator(CompareCriteria.EQ);
         expected.setRightExpression(new Constant("yyz")); //$NON-NLS-1$
@@ -205,14 +205,6 @@
     }    
 
     @Test public void testXMLAmbiguousShortName() {                  
-        CompareCriteria expected = new CompareCriteria();
-        ElementSymbol es = new ElementSymbol("node2"); //$NON-NLS-1$
-        GroupSymbol gs = new GroupSymbol("doc3"); //$NON-NLS-1$
-        es.setGroupSymbol(gs);
-        expected.setLeftExpression(es);
-        expected.setOperator(CompareCriteria.EQ);
-        expected.setRightExpression(new Constant("yyz")); //$NON-NLS-1$
-
         helpResolveException("select * from xmltest.doc3 where node2 = 'yyz'"); //$NON-NLS-1$
     }    
 
@@ -309,8 +301,8 @@
         
     @Test public void testContext() {                  
         GroupSymbol gs1 = new GroupSymbol("xmltest.doc1"); //$NON-NLS-1$
-        ElementSymbol es1 = new ElementSymbol("root.node1.node2.node3", null, gs1); //$NON-NLS-1$
-        ElementSymbol es2 = new ElementSymbol("root.node1", null, gs1); //$NON-NLS-1$
+        ElementSymbol es1 = new ElementSymbol("root.node1.node2.node3", gs1); //$NON-NLS-1$
+        ElementSymbol es2 = new ElementSymbol("root.node1", gs1); //$NON-NLS-1$
         Expression[] exprs = new Expression[]{es1, es2};
         
         Function context = new Function("context", exprs); //$NON-NLS-1$
@@ -327,7 +319,7 @@
 
     @Test public void testRowLimit() {                  
     	GroupSymbol gs1 = new GroupSymbol("xmltest.doc1"); //$NON-NLS-1$
-        ElementSymbol es1 = new ElementSymbol("root.node1.node2.node3", null, gs1); //$NON-NLS-1$
+        ElementSymbol es1 = new ElementSymbol("root.node1.node2.node3", gs1); //$NON-NLS-1$
         es1.setGroupSymbol(gs1);
         Expression[] exprs = new Expression[]{es1};
         
@@ -345,7 +337,7 @@
 
     @Test public void testRowLimitException() {                  
     	GroupSymbol gs1 = new GroupSymbol("xmltest.doc1"); //$NON-NLS-1$
-        ElementSymbol es1 = new ElementSymbol("root.node1.node2.node3", null, gs1); //$NON-NLS-1$
+        ElementSymbol es1 = new ElementSymbol("root.node1.node2.node3", gs1); //$NON-NLS-1$
         Expression[] exprs = new Expression[]{es1};
         
         Function context = new Function("rowlimitexception", exprs); //$NON-NLS-1$
@@ -379,7 +371,7 @@
     @Test public void testConversionInXML() {
         // Expected left expression
     	GroupSymbol gs1 = new GroupSymbol("xmltest.doc1"); //$NON-NLS-1$
-        ElementSymbol es1 = new ElementSymbol("root.node1", null, gs1); //$NON-NLS-1$
+        ElementSymbol es1 = new ElementSymbol("root.node1", gs1); //$NON-NLS-1$
 
         // Expected right expression
         Function convert = new Function("convert", new Expression[] { new Constant(new Integer(5)), new Constant("string") }); //$NON-NLS-1$ //$NON-NLS-2$
@@ -401,7 +393,7 @@
     @Test public void testXMLWithSelect1() throws Exception {
         CompareCriteria expected = new CompareCriteria();
         GroupSymbol gs = new GroupSymbol("xmltest.doc1"); //$NON-NLS-1$
-        ElementSymbol es = new ElementSymbol("root.node1", null, gs); //$NON-NLS-1$
+        ElementSymbol es = new ElementSymbol("root.node1", gs); //$NON-NLS-1$
         expected.setLeftExpression(es);
         expected.setOperator(CompareCriteria.EQ);
         expected.setRightExpression(new Constant("yyz")); //$NON-NLS-1$
@@ -418,7 +410,7 @@
     @Test public void testXMLWithSelect2() {
         CompareCriteria expected = new CompareCriteria();
         GroupSymbol gs = new GroupSymbol("xmltest.doc1"); //$NON-NLS-1$
-        ElementSymbol es = new ElementSymbol("root.node1", null, gs); //$NON-NLS-1$
+        ElementSymbol es = new ElementSymbol("root.node1", gs); //$NON-NLS-1$
         expected.setLeftExpression(es);
         expected.setOperator(CompareCriteria.EQ);
         expected.setRightExpression(new Constant("yyz")); //$NON-NLS-1$

Modified: trunk/engine/src/test/java/org/teiid/query/rewriter/TestOrderByRewrite.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/rewriter/TestOrderByRewrite.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/rewriter/TestOrderByRewrite.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -39,8 +39,8 @@
 import org.teiid.query.sql.lang.OrderBy;
 import org.teiid.query.sql.lang.Query;
 import org.teiid.query.sql.symbol.ElementSymbol;
+import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.symbol.ExpressionSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 import org.teiid.query.sql.visitor.ElementCollectorVisitor;
 import org.teiid.query.unittest.RealMetadataFactory;
 
@@ -62,7 +62,7 @@
                                    String[] elementNames,
                                    String[] elementIDs) {
         List<ElementSymbol> elements = new ArrayList<ElementSymbol>();
-        for (Iterator<SingleElementSymbol> i = langObj.getSortKeys().iterator(); i.hasNext();) {
+        for (Iterator<Expression> i = langObj.getSortKeys().iterator(); i.hasNext();) {
             ElementCollectorVisitor.getElements(i.next(), elements);
         }
 
@@ -81,8 +81,8 @@
     private void helpCheckExpressionsSymbols(OrderBy langObj,
                                              String[] functionsNames) {
     	int expCount = 0;
-        for (Iterator<SingleElementSymbol> i = langObj.getSortKeys().iterator(); i.hasNext();) {
-        	SingleElementSymbol ses = i.next();
+        for (Iterator<Expression> i = langObj.getSortKeys().iterator(); i.hasNext();) {
+        	Expression ses = i.next();
             if (ses instanceof ExpressionSymbol) {
                 assertEquals("Expression Symbols does not match: ", functionsNames[expCount++], ses.toString()); //$NON-NLS-1$                        		
             }
@@ -117,7 +117,7 @@
             new String[] { "pm1.g1.e3", "pm1.g1.e2", "pm1.g1.e1", "pm1.g1.e2" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
         
         helpCheckExpressionsSymbols(resolvedQuery.getOrderBy(),
-            new String[] {"concat(e3, 'x')", "concat(e2, '5')"}); //$NON-NLS-1$ //$NON-NLS-2$
+            new String[] {"concat(convert(e3, string), 'x')", "concat(convert(e2, string), '5')"}); //$NON-NLS-1$ //$NON-NLS-2$
     }
  
     @Test public void testNumberedOrderBy1_3() throws Exception {
@@ -127,7 +127,7 @@
             new String[] { "pm1.g1.e3", "pm1.g1.e2", "pm1.g1.e1", "pm1.g1.e2" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
         
         helpCheckExpressionsSymbols(resolvedQuery.getOrderBy(),
-            new String[] {"concat(e2, '5')", "AVG(e2)"}); //$NON-NLS-1$ //$NON-NLS-2$
+            new String[] {"concat(convert(e2, string), '5')", "AVG(e2)"}); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
     @Test public void testNumberedOrderBy1_4() throws Exception {

Modified: trunk/engine/src/test/java/org/teiid/query/rewriter/TestQueryRewriter.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/rewriter/TestQueryRewriter.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/rewriter/TestQueryRewriter.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -58,11 +58,8 @@
 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.ExpressionSymbol;
 import org.teiid.query.sql.symbol.GroupSymbol;
 import org.teiid.query.sql.symbol.Reference;
-import org.teiid.query.sql.symbol.SearchedCaseExpression;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
 import org.teiid.query.sql.visitor.CorrelatedReferenceCollectorVisitor;
 import org.teiid.query.unittest.RealMetadataFactory;
 import org.teiid.query.util.CommandContext;
@@ -141,7 +138,7 @@
     	ResolverVisitor.resolveLanguageObject(actualExp, metadata);
     	CommandContext context = new CommandContext();
     	context.setBufferManager(BufferManagerFactory.getStandaloneBufferManager());
-    	actualExp = QueryRewriter.rewriteExpression(actualExp, null, context, metadata);
+    	actualExp = QueryRewriter.rewriteExpression(actualExp, context, metadata);
     	if (expected != null) {
 	    	Expression expectedExp = QueryParser.getQueryParser().parseExpression(expected);
 	    	ResolverVisitor.resolveLanguageObject(expectedExp, metadata);
@@ -572,7 +569,7 @@
      
     @Test public void testRewriteCrit_plusInvert() { 
         String original = "pm1.g1.e2 + 1.1 = ?"; //$NON-NLS-1$ 
-        String expected = "pm1.g1.e2 = ? - 1.1"; //$NON-NLS-1$ 
+        String expected = "convert(pm1.g1.e2, bigdecimal) = ? - 1.1"; //$NON-NLS-1$ 
          
         helpTestRewriteCriteria(original, expected);
     } 
@@ -961,7 +958,7 @@
     }    
     
     @Test public void testRewriteCase1954SetC() {
-        helpTestRewriteCriteria("concat(pm1.g1.e2, 'string') in ('2', '3')", "concat(pm1.g1.e2, 'string') in ('2', '3')"); //$NON-NLS-1$ //$NON-NLS-2$
+        helpTestRewriteCriteria("concat(pm1.g1.e2, 'string') in ('2', '3')", "concat(convert(pm1.g1.e2, string), 'string') in ('2', '3')"); //$NON-NLS-1$ //$NON-NLS-2$
     }    
 
     @Test public void testRewriteCase1954SetD() {
@@ -1071,10 +1068,9 @@
 
         Command cmd = helpTestRewriteCommand( sqlBefore, sqlAfter );
         
-        ExpressionSymbol es = (ExpressionSymbol)cmd.getProjectedSymbols().get(0);
+        Expression es = cmd.getProjectedSymbols().get(0);
         assertEquals( DataTypeManager.DefaultDataClasses.STRING, es.getType() );
     }
-
 
     @Test public void testRewriteExec() throws Exception {
         Command command = QueryParser.getQueryParser().parseCommand("exec pm1.sq2(session_id())");             //$NON-NLS-1$
@@ -1240,7 +1236,7 @@
      */
     @Test public void testRewriteSelectInto1() {
         String sql = "select distinct e2, e2, e3, e4 into pm1.g1 from pm1.g2"; //$NON-NLS-1$
-        String expected = "INSERT INTO pm1.g1 (pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4) SELECT X.e2 AS e1, X.E2_0 AS e2, X.e3, X.e4 FROM (SELECT DISTINCT e2, e2 AS E2_0, e3, e4 FROM pm1.g2) AS X"; //$NON-NLS-1$
+        String expected = "INSERT INTO pm1.g1 (pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4) SELECT convert(X.e2, string) AS e1, X.e2_0 AS e2, X.e3, X.e4 FROM (SELECT DISTINCT e2, e2 AS e2_0, e3, e4 FROM pm1.g2) AS X"; //$NON-NLS-1$
                 
         helpTestRewriteCommand(sql, expected);        
     }
@@ -1277,7 +1273,7 @@
         union = (SetQuery)QueryRewriter.rewrite(union, RealMetadataFactory.example1Cached(), null);
         
         for (QueryCommand query : union.getQueryCommands()) {
-            List<SingleElementSymbol> projSymbols = query.getProjectedSymbols();
+            List<Expression> projSymbols = query.getProjectedSymbols();
             for(int i=0; i<projSymbols.size(); i++) {
                 assertEquals("Found type mismatch at column " + i, types[i], projSymbols.get(i).getType()); //$NON-NLS-1$
             }                
@@ -1297,7 +1293,7 @@
         procedure += "Select x from temp;\n"; //$NON-NLS-1$
         procedure += "END\n"; //$NON-NLS-1$
         
-        helpTestRewriteCommand(procedure, "CREATE VIRTUAL PROCEDURE\nBEGIN\nCREATE LOCAL TEMPORARY TABLE temp (x string, y integer, z integer);\nINSERT INTO temp (temp.x, temp.y, temp.z) SELECT X.e2 AS x, X.x AS y, X.X_0 AS z FROM (SELECT pm1.g1.e2, 1 AS x, 2 AS X_0 FROM pm1.g1 ORDER BY pm1.g1.e2 LIMIT 1) AS X;\nSELECT x FROM temp;\nEND"); //$NON-NLS-1$
+        helpTestRewriteCommand(procedure, "CREATE VIRTUAL PROCEDURE\nBEGIN\nCREATE LOCAL TEMPORARY TABLE temp (x string, y integer, z integer);\nINSERT INTO temp (temp.x, temp.y, temp.z) SELECT convert(X.e2, string) AS x, X.x AS y, X.x_0 AS z FROM (SELECT pm1.g1.e2, 1 AS x, 2 AS x_0 FROM pm1.g1 ORDER BY pm1.g1.e2 LIMIT 1) AS X;\nSELECT x FROM temp;\nEND"); //$NON-NLS-1$
     }
     
     @Test public void testRewriteNot() {
@@ -1363,119 +1359,25 @@
     	helpTestRewriteCriteria("coalesce(convert(pm1.g1.e2, double), pm1.g1.e4) = 1", "ifnull(convert(pm1.g1.e2, double), pm1.g1.e4) = 1", true); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
-    /**
-     * Test <code>QueryRewriter</code>'s ability to rewrite a query that 
-     * contains an aggregate function which uses a <code>CASE</code> 
-     * expression which contains <code>BETWEEN</code> criteria as its value.
-     * <p>
-     * An aggregate function list is defined and queries are created that 
-     * use each function from the list.  The list includes:
-     * <p>
-     * "SUM", "MAX", "MIN", "AVG", "COUNT"   
-     * <p>
-     * It is expected that the BETWEEN expression will be rewritten as 
-     * <code>CompoundCriteria</code>.
-     * <p>
-     * <table>
-     * <tr><th align="left" colspan=2>For example:
-     * <tr><td width="10*"><td>SELECT SUM(CASE WHEN e2 BETWEEN 3 AND 5 
-     * THEN e2 ELSE -1 END) FROM pm1.g1
-     * <tr><th align="left" colspan=2>Is rewritten as:
-     * <tr><td width="10*"><td>SELECT SUM(CASE WHEN (e2 >= 3) AND (e2 <= 5) 
-     * THEN e2 ELSE -1 END) FROM pm1.g1
-     * </table>
-     * 
-     * @see org.teiid.query.rewriter.QueryRewriter
-     * @see org.teiid.query.sql.lang.BetweenCriteria
-     * @see org.teiid.query.sql.lang.CompoundCriteria
-     * @see org.teiid.query.sql.symbol.AggregateSymbol
-     * @see org.teiid.query.sql.symbol.SearchedCaseExpression
-     */
     @Test public void testAggregateWithBetweenInCaseInSelect() {
-    	// Define a list of aggregates to test against
-    	List<String> aggregateCommands = Arrays.asList( new String[] { "SUM", "MAX", "MIN", "AVG", "COUNT" } ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
-    	
-    	// Define a query and the expected rewritten query
-    	// ?AGGREGATE? represents the string substitution for an aggregate from aggregateCommands
-    	String sqlBefore = "SELECT ?AGGREGATE?(CASE WHEN e2 BETWEEN 3 AND 5 THEN e2 ELSE -1 END) FROM pm1.g1"; //$NON-NLS-1$
-    	String sqlAfter  = "SELECT ?AGGREGATE?(CASE WHEN (e2 >= 3) AND (e2 <= 5) THEN e2 ELSE -1 END) FROM pm1.g1"; //$NON-NLS-1$
+    	String sqlBefore = "SELECT MAX(CASE WHEN e2 BETWEEN 3 AND 5 THEN e2 ELSE -1 END) FROM pm1.g1"; //$NON-NLS-1$
+    	String sqlAfter  = "SELECT MAX(CASE WHEN (e2 >= 3) AND (e2 <= 5) THEN e2 ELSE -1 END) FROM pm1.g1"; //$NON-NLS-1$
 
-    	// Iterate through the aggregateCommands
-    	for ( String aCmd : aggregateCommands ) {
-    		// Replace ?AGGREGATE? with the command from aggregateCommands
-    		String sql = sqlBefore.replace("?AGGREGATE?", aCmd); //$NON-NLS-1$
-    		String exSql = sqlAfter.replace("?AGGREGATE?", aCmd); //$NON-NLS-1$
-    		// Test QueryRewriter
-        	Command cmd = helpTestRewriteCommand( sql, exSql );
-        	// Check the rewritten command to verify that CompundCriteria replaced BetweenCriteria
-        	CompoundCriteria ccrit = (CompoundCriteria) ((SearchedCaseExpression) ((ExpressionSymbol) cmd.getProjectedSymbols().get(0)).getExpression()).getWhen().get(0);
-        	assertEquals( "e2 >= 3", ccrit.getCriteria(0).toString() ); //$NON-NLS-1$
-        	assertEquals( "e2 <= 5", ccrit.getCriteria(1).toString() ); //$NON-NLS-1$
-    	}
+    	helpTestRewriteCommand( sqlBefore, sqlAfter );
     }
     
-    /**
-     * Test <code>QueryRewriter</code>'s ability to rewrite a query that 
-     * contains a <code>CASE</code> expression which contains 
-     * <code>BETWEEN</code> criteria in the queries <code>SELECT</code> clause.
-     * <p>
-     * It is expected that the BETWEEN expression will be rewritten as 
-     * <code>CompoundCriteria</code>.
-     * <p>
-     * <table>
-     * <tr><th align="left" colspan=2>For example:
-     * <tr><td width="10*"><td>SELECT CASE WHEN e2 BETWEEN 3 AND 5 THEN e2 
-     * ELSE -1 END FROM pm1.g1 
-     * <tr><th align="left" colspan=2>Is rewritten as:
-     * <tr><td width="10*"><td>SELECT CASE WHEN (e2 >= 3) AND (e2 <= 5) THEN e2 
-     * ELSE -1 END FROM pm1.g1
-     * </table>
-     * 
-     * @see org.teiid.query.rewriter.QueryRewriter
-     * @see org.teiid.query.sql.lang.BetweenCriteria
-     * @see org.teiid.query.sql.lang.CompoundCriteria
-     * @see org.teiid.query.sql.symbol.SearchedCaseExpression
-     */
     @Test public void testBetweenInCaseInSelect() {
     	String sqlBefore = "SELECT CASE WHEN e2 BETWEEN 3 AND 5 THEN e2 ELSE -1 END FROM pm1.g1"; //$NON-NLS-1$
     	String sqlAfter = "SELECT CASE WHEN (e2 >= 3) AND (e2 <= 5) THEN e2 ELSE -1 END FROM pm1.g1"; //$NON-NLS-1$
     	
-    	Command cmd = helpTestRewriteCommand( sqlBefore, sqlAfter );
-    	CompoundCriteria ccrit = (CompoundCriteria) ((SearchedCaseExpression) ((ExpressionSymbol) cmd.getProjectedSymbols().get(0)).getExpression()).getWhen().get(0);
-    	assertEquals( "e2 >= 3", ccrit.getCriteria(0).toString() ); //$NON-NLS-1$
-    	assertEquals( "e2 <= 5", ccrit.getCriteria(1).toString() ); //$NON-NLS-1$
+    	helpTestRewriteCommand( sqlBefore, sqlAfter );
     }
     
-    /**
-     * Test <code>QueryRewriter</code>'s ability to rewrite a query that 
-     * contains a <code>CASE</code> expression which contains 
-     * <code>BETWEEN</code> criteria in the queries <code>WHERE</code> clause.
-     * <p>
-     * It is expected that the BETWEEN expression will be rewritten as 
-     * <code>CompoundCriteria</code>.
-     * <p>
-     * <table>
-     * <tr><th align="left" colspan=2>For example:
-     * <tr><td width="10*"><td>SELECT * FROM pm1.g1 WHERE e3 = CASE WHEN e2 
-     * BETWEEN 3 AND 5 THEN e2 ELSE -1 END 
-     * <tr><th align="left" colspan=2>Is rewritten as:
-     * <tr><td width="10*"><td>SELECT * FROM pm1.g1 WHERE e3 = CASE WHEN  
-     * (e2 >= 3) AND (e2 <= 5) THEN e2 ELSE -1 END
-     * </table>
-     * 
-     * @see org.teiid.query.rewriter.QueryRewriter
-     * @see org.teiid.query.sql.lang.BetweenCriteria
-     * @see org.teiid.query.sql.lang.CompoundCriteria
-     * @see org.teiid.query.sql.symbol.SearchedCaseExpression
-     */
     @Test public void testBetweenInCase() {
     	String sqlBefore = "SELECT * FROM pm1.g1 WHERE e3 = CASE WHEN e2 BETWEEN 3 AND 5 THEN e2 ELSE -1 END"; //$NON-NLS-1$
-    	String sqlAfter = "SELECT * FROM pm1.g1 WHERE e3 = CASE WHEN (e2 >= 3) AND (e2 <= 5) THEN e2 ELSE -1 END"; //$NON-NLS-1$
+    	String sqlAfter = "SELECT * FROM pm1.g1 WHERE convert(e3, integer) = CASE WHEN (e2 >= 3) AND (e2 <= 5) THEN e2 ELSE -1 END"; //$NON-NLS-1$
     	
-    	Command cmd = helpTestRewriteCommand( sqlBefore, sqlAfter );
-    	CompoundCriteria ccrit = (CompoundCriteria) ((SearchedCaseExpression) ((CompareCriteria) ((Query) cmd).getCriteria()).getRightExpression()).getWhen().get(0);
-    	assertEquals( "e2 >= 3", ccrit.getCriteria(0).toString() ); //$NON-NLS-1$
-    	assertEquals( "e2 <= 5", ccrit.getCriteria(1).toString() ); //$NON-NLS-1$
+    	helpTestRewriteCommand( sqlBefore, sqlAfter );
     }
     
     @Test public void testRewriteNullHandling() {
@@ -1627,7 +1529,7 @@
     @Test public void testRewriteXmlTable() throws Exception {
     	String original = "select * from xmltable('/' passing 1 + 1 as a columns x string default curdate()) as x"; //$NON-NLS-1$
     	QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
-    	helpTestRewriteCommand(original, "SELECT * FROM XMLTABLE('/' PASSING 2 AS a COLUMNS x string DEFAULT curdate()) AS x", metadata);
+    	helpTestRewriteCommand(original, "SELECT * FROM XMLTABLE('/' PASSING 2 AS a COLUMNS x string DEFAULT convert(curdate(), string)) AS x", metadata);
     }
     
     @Test public void testRewriteQueryString() throws Exception {

Modified: trunk/engine/src/test/java/org/teiid/query/sql/lang/TestAliasSymbol.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/sql/lang/TestAliasSymbol.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/sql/lang/TestAliasSymbol.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -22,26 +22,27 @@
 
 package org.teiid.query.sql.lang;
 
+import static org.junit.Assert.*;
+
+import org.junit.Test;
 import org.teiid.query.sql.symbol.AliasSymbol;
 import org.teiid.query.sql.symbol.Constant;
 import org.teiid.query.sql.symbol.ExpressionSymbol;
 
-import junit.framework.TestCase;
 
+public class TestAliasSymbol {
 
-public class TestAliasSymbol extends TestCase {
-
-    public void testAliasEquals() {
+    @Test public void testAliasEquals() {
         AliasSymbol a1 = new AliasSymbol("X", new ExpressionSymbol("x", new Constant(1))); //$NON-NLS-1$ //$NON-NLS-2$
         AliasSymbol a2 = new AliasSymbol("X", new ExpressionSymbol("x", new Constant(2))); //$NON-NLS-1$ //$NON-NLS-2$
         AliasSymbol a3 = new AliasSymbol("x", new ExpressionSymbol("x", new Constant(1))); //$NON-NLS-1$ //$NON-NLS-2$
         
-        assertEquals(a1, a3); //just a different case for the alias
+        assertFalse(a1.equals(a3)); //just a different case for the alias
         
         assertFalse(a1.equals(a2)); //different express 
     }
     
-    public void testClone() {
+    @Test public void testClone() {
         AliasSymbol a1 = new AliasSymbol("X", new ExpressionSymbol("x", new Constant(1))); //$NON-NLS-1$ //$NON-NLS-2$
         a1.setOutputName("foo"); //$NON-NLS-1$
         AliasSymbol clone = (AliasSymbol)a1.clone();

Modified: trunk/engine/src/test/java/org/teiid/query/sql/symbol/TestCaseExpression.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/sql/symbol/TestCaseExpression.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/sql/symbol/TestCaseExpression.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -25,18 +25,11 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import junit.framework.TestCase;
+
 import org.teiid.core.types.DataTypeManager;
 import org.teiid.core.util.ArgCheck;
-import org.teiid.query.sql.symbol.AbstractCaseExpression;
-import org.teiid.query.sql.symbol.CaseExpression;
-import org.teiid.query.sql.symbol.Constant;
-import org.teiid.query.sql.symbol.ElementSymbol;
-import org.teiid.query.sql.symbol.Expression;
 
-
-
-import junit.framework.TestCase;
-
 public class TestCaseExpression extends TestCase {
 
     /**
@@ -206,7 +199,6 @@
         
         helpTestStrictEquivalence(expr.getElseExpression(), clone.getElseExpression());
         assertEquals(expr.getType(), clone.getType());
-        assertEquals(expr.isResolved(), clone.isResolved());
     }
     
     public void testGetWhenExpression() {
@@ -264,16 +256,6 @@
         assertEquals(new Constant(new Integer(30000)), caseExpr.getThenExpression(1));
     }
 
-    public void testIsResolved() {
-        CaseExpression expr = example(3);
-        assertFalse(expr.isResolved());
-        ElementSymbol x = (ElementSymbol)expr.getExpression();
-        x.setType(String.class);
-        x.setMetadataID("metadataID"); //$NON-NLS-1$
-        expr.setType(Integer.class);
-        assertTrue(expr.isResolved());
-    }
-
     public void testGetThenExpression() {
         helpTestThenExpressions(example(3), 3);
     }

Modified: trunk/engine/src/test/java/org/teiid/query/sql/symbol/TestConstant.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/sql/symbol/TestConstant.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/sql/symbol/TestConstant.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -22,13 +22,12 @@
 
 package org.teiid.query.sql.symbol;
 
+import junit.framework.TestCase;
+
 import org.teiid.core.types.DataTypeManager;
 import org.teiid.core.util.UnitTestUtil;
-import org.teiid.query.sql.symbol.Constant;
 
-import junit.framework.TestCase;
 
-
 public class TestConstant extends TestCase {
 
 	// ################################## FRAMEWORK ################################
@@ -57,7 +56,6 @@
         assertEquals("Value is incorrect: ", s, c.getValue()); //$NON-NLS-1$
         assertEquals("Type is incorrect: ", DataTypeManager.DefaultDataClasses.STRING, c.getType()); //$NON-NLS-1$
         assertEquals("Should be non-null: ", false, c.isNull()); //$NON-NLS-1$
-        assertEquals("Is not resolved: ", true, c.isResolved()); //$NON-NLS-1$
         assertEquals("Object does not equal itself", c, c); //$NON-NLS-1$
         
         Constant c2 = new Constant(s);
@@ -73,7 +71,6 @@
         assertEquals("Value is incorrect: ", i, c.getValue()); //$NON-NLS-1$
         assertEquals("Type is incorrect: ", DataTypeManager.DefaultDataClasses.INTEGER, c.getType()); //$NON-NLS-1$
         assertEquals("Should be non-null: ", false, c.isNull()); //$NON-NLS-1$
-        assertEquals("Is not resolved: ", true, c.isResolved()); //$NON-NLS-1$
         assertEquals("Object does not equal itself", c, c); //$NON-NLS-1$
         
         Constant c2 = new Constant(i);
@@ -88,7 +85,6 @@
         assertEquals("Value is incorrect: ", null, c.getValue()); //$NON-NLS-1$
         assertEquals("Type is incorrect: ", DataTypeManager.DefaultDataClasses.NULL, c.getType()); //$NON-NLS-1$
         assertEquals("Should be null: ", true, c.isNull()); //$NON-NLS-1$
-        assertEquals("Is not resolved: ", true, c.isResolved()); //$NON-NLS-1$
         assertEquals("Object does not equal itself", c, c); //$NON-NLS-1$
         
         Constant c2 = new Constant(null);
@@ -103,7 +99,6 @@
         assertEquals("Value is incorrect: ", null, c.getValue()); //$NON-NLS-1$
         assertEquals("Type is incorrect: ", DataTypeManager.DefaultDataClasses.STRING, c.getType()); //$NON-NLS-1$
         assertEquals("Should be null: ", true, c.isNull()); //$NON-NLS-1$
-        assertEquals("Is not resolved: ", true, c.isResolved()); //$NON-NLS-1$
         assertEquals("Object does not equal itself", c, c); //$NON-NLS-1$
         
         Constant c2 = new Constant(null, DataTypeManager.DefaultDataClasses.STRING);

Modified: trunk/engine/src/test/java/org/teiid/query/sql/symbol/TestElementSymbol.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/sql/symbol/TestElementSymbol.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/sql/symbol/TestElementSymbol.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -172,7 +172,7 @@
 		ElementSymbol es2 = new ElementSymbol("AbCd"); //$NON-NLS-1$
 		es2.setGroupSymbol(sampleGroup1());
 		
-		helpEquals(es1, es2, true);
+		helpEquals(es1, es2, false);
 	} 
 
 	@Test public void testSelfEquivalence(){
@@ -273,4 +273,10 @@
 		helpEquals(e1, e2, true);
 	}
 	
+	@Test public void testClone6() { 
+		ElementSymbol e1 = new ElementSymbol("x.y.z", new GroupSymbol("doc"));
+		ElementSymbol copy = e1.clone();    		
+		helpEquals(e1, copy, true);
+	}
+	
 }

Modified: trunk/engine/src/test/java/org/teiid/query/sql/symbol/TestSearchedCaseExpression.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/sql/symbol/TestSearchedCaseExpression.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/sql/symbol/TestSearchedCaseExpression.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -147,7 +147,6 @@
         
         TestCaseExpression.helpTestStrictEquivalence(expr.getElseExpression(), clone.getElseExpression());
         assertEquals(expr.getType(), clone.getType());
-        assertEquals(expr.isResolved(), clone.isResolved());
     }
 
     public void testGetWhenCriteria() {
@@ -212,17 +211,6 @@
         assertEquals(new Constant(new Integer(30000)), caseExpr.getThenExpression(1));
     }
 
-    public void testIsResolved() {
-        SearchedCaseExpression expr = example(3);
-        assertFalse(expr.isResolved());
-        CompareCriteria crit = (CompareCriteria)expr.getWhenCriteria(0);
-        ElementSymbol x = (ElementSymbol)crit.getLeftExpression();
-        x.setType(String.class);
-        x.setMetadataID("metadataID"); //$NON-NLS-1$
-        expr.setType(Integer.class);
-        assertTrue(expr.isResolved());
-    }
-
     public void testGetThenExpression() {
         TestCaseExpression.helpTestThenExpressions(example(3), 3);
     }

Modified: trunk/engine/src/test/java/org/teiid/query/sql/visitor/TestExpressionMappingVisitor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/sql/visitor/TestExpressionMappingVisitor.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/sql/visitor/TestExpressionMappingVisitor.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -166,9 +166,6 @@
         helpTest(TestSearchedCaseExpression.example(3), map, mapped);
     }
     
-    /**
-     * We do not need to create an alias if the canonical short names match
-     */
     @Test public void testSelectAlias() {
         ElementSymbol x = new ElementSymbol("y.x"); //$NON-NLS-1$
         ElementSymbol y = new ElementSymbol("z.X"); //$NON-NLS-1$
@@ -180,9 +177,23 @@
         
         ExpressionMappingVisitor.mapExpressions(toMap, map);
         
-        assertEquals("Did not get expected mapped expression", "SELECT z.X", toMap.toString());     //$NON-NLS-1$ //$NON-NLS-2$
+        assertEquals("Did not get expected mapped expression", "SELECT z.X AS x", toMap.toString());     //$NON-NLS-1$ //$NON-NLS-2$
     }
     
+    @Test public void testSelectAlias1() {
+        ElementSymbol x = new ElementSymbol("y.x"); //$NON-NLS-1$
+        ElementSymbol y = new ElementSymbol("z.x"); //$NON-NLS-1$
+        
+        HashMap<ElementSymbol, ElementSymbol> map = new HashMap<ElementSymbol, ElementSymbol>();
+        map.put(x, y);
+        
+        LanguageObject toMap = new Select(Arrays.asList(x));
+        
+        ExpressionMappingVisitor.mapExpressions(toMap, map);
+        
+        assertEquals("Did not get expected mapped expression", "SELECT z.x", toMap.toString());     //$NON-NLS-1$ //$NON-NLS-2$
+    }
+    
     /**
      * we are not careful about ensuring that that every symbol is
      * unique in a plan, so there's a chance mapping the expression in an

Modified: trunk/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -38,6 +38,8 @@
 import org.teiid.client.metadata.ParameterInfo;
 import org.teiid.core.TeiidComponentException;
 import org.teiid.core.types.DataTypeManager;
+import org.teiid.core.types.DataTypeManager.DefaultDataClasses;
+import org.teiid.core.types.DataTypeManager.DefaultDataTypes;
 import org.teiid.dqp.internal.process.DQPWorkContext;
 import org.teiid.metadata.*;
 import org.teiid.metadata.BaseColumn.NullType;
@@ -51,8 +53,11 @@
 import org.teiid.query.mapping.xml.MappingAttribute;
 import org.teiid.query.mapping.xml.MappingDocument;
 import org.teiid.query.mapping.xml.MappingElement;
+import org.teiid.query.mapping.xml.MappingNode;
 import org.teiid.query.mapping.xml.MappingOutputter;
 import org.teiid.query.mapping.xml.MappingSequenceNode;
+import org.teiid.query.mapping.xml.MappingVisitor;
+import org.teiid.query.mapping.xml.Navigator;
 import org.teiid.query.metadata.CompositeMetadataStore;
 import org.teiid.query.metadata.QueryMetadataInterface;
 import org.teiid.query.metadata.TransformationMetadata;
@@ -567,7 +572,7 @@
         createAccessPattern("pm4.g2.ap1", pm4g2, elements); //e1,e2 //$NON-NLS-1$
 		elements = new ArrayList<Column>(1);
 		elements.add(pm4g2e.get(4)); //"e5"
-		KeyRecord pm4g2ap2 =createAccessPattern("pm4.g2.ap2", pm4g2, elements); //e5 //$NON-NLS-1$
+		createAccessPattern("pm4.g2.ap2", pm4g2, elements); //e5 //$NON-NLS-1$
 		// Create access patterns - pm5
 		elements = new ArrayList<Column>(1);
 		elements.add(pm5g1e.iterator().next());
@@ -855,28 +860,17 @@
         createAccessPattern("vm1.g37.ap1", vm1g37, elements); //e1 //$NON-NLS-1$
         
         //XML STUFF =============================================
-        Table doc1 = createXmlDocument("doc1", xmltest, exampleDoc1()); //$NON-NLS-1$
-        Table doc2 = createXmlDocument("doc2", xmltest, exampleDoc2()); //$NON-NLS-1$
-        Table doc3 = createXmlDocument("doc3", xmltest, exampleDoc3()); //$NON-NLS-1$
-        Table doc4 = createXmlDocument("doc4", xmltest, exampleDoc4());         //$NON-NLS-1$
-        Table doc5 = createXmlDocument("doc5", xmltest, exampleDoc5()); //$NON-NLS-1$
-        Table doc6 = createXmlDocument("doc6", xmltest, exampleDoc6()); //$NON-NLS-1$
+        createXmlDocument("doc1", xmltest, exampleDoc1()); //$NON-NLS-1$
+        createXmlDocument("doc2", xmltest, exampleDoc2()); //$NON-NLS-1$
+        createXmlDocument("doc3", xmltest, exampleDoc3()); //$NON-NLS-1$
+        createXmlDocument("doc4", xmltest, exampleDoc4());         //$NON-NLS-1$
+        createXmlDocument("doc5", xmltest, exampleDoc5()); //$NON-NLS-1$
+        createXmlDocument("doc6", xmltest, exampleDoc6()); //$NON-NLS-1$
 
         // Defect 11479 - test ambiguous doc short names
         createXmlDocument("xmltest2.docA", vm1, exampleDoc1()); //$NON-NLS-1$
         createXmlDocument("xmltest3.docA", vm1, exampleDoc2()); //$NON-NLS-1$
 
-		createElements(doc1, new String[] { "root", "root.node1", "root.node1.node2", "root.node1.node2.node3" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-			new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
-		createElements(doc2, new String[] { "root", "root.node1", "root.node1.node3" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-			new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
-		createElements(doc3, new String[] { "root", "root.node1.node2", "root.node2" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-			new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
-		createElements(doc4, new String[] { "root", "root. at node6", "root.node1", "root.node1. at node2", "root.node3", "root.node3. at node4", "root.node3.node4", "root.node3.root.node6" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
-			new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
-        createElements(doc5, new String[] { "root", "root.node1", "root.node1.node2" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
-            
         // Create mapping classes for xmltest.doc5
         QueryNode mc1n1 = new QueryNode("SELECT e1 FROM pm1.g1 UNION ALL SELECT e1 FROM pm1.g2"); //$NON-NLS-1$ //$NON-NLS-2$
         Table vm1mc1 = createVirtualGroup("mc1", xmltest, mc1n1); //$NON-NLS-1$
@@ -884,9 +878,6 @@
             new String[] { "e1" }, //$NON-NLS-1$
             new String[] { DataTypeManager.DefaultDataTypes.STRING });
 
-        createElements(doc6, new String[] { "root", "root.node", "root.thenode" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
-            
         //XML STUFF =============================================
 
         // Procedures and stored queries
@@ -996,12 +987,12 @@
                                                           ), sqDefaultsNode);  
         sqDefaults.setResultSet(rsDefaults);
         
-        ColumnSet<Procedure> rsBadDefault = createResultSet("pm1.rBadDefault", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+        createResultSet("pm1.rBadDefault", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
         ProcedureParameter paramBadDefaultIn = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER);  //$NON-NLS-1$
         paramBadDefaultIn.setNullType(NullType.Nullable);
         paramBadDefaultIn.setDefaultValue("Clearly Not An Integer"); //$NON-NLS-1$
         QueryNode sqnBadDefault = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 FROM pm1.g1 WHERE e2=pm1.sqBadDefault.in; END"); //$NON-NLS-1$ //$NON-NLS-2$
-        Procedure sqBadDefault = createVirtualProcedure("sqBadDefault", pm1, Arrays.asList(paramBadDefaultIn), sqnBadDefault);  //$NON-NLS-1$
+        createVirtualProcedure("sqBadDefault", pm1, Arrays.asList(paramBadDefaultIn), sqnBadDefault);  //$NON-NLS-1$
         
         //end case 3281
         
@@ -1165,7 +1156,7 @@
         
         ProcedureParameter vspp3 = createParameter("param1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
         QueryNode vspqn10 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; LOOP ON (SELECT e2 FROM pm1.g1 WHERE e2=param1) AS mycursor BEGIN x=mycursor.e2; END END"); //$NON-NLS-1$ //$NON-NLS-2$
-        Procedure vsp10 = createVirtualProcedure("vsp10", pm1, Arrays.asList( vspp3 ), vspqn10); //$NON-NLS-1$
+        createVirtualProcedure("vsp10", pm1, Arrays.asList( vspp3 ), vspqn10); //$NON-NLS-1$
 
         //invalid
         QueryNode vspqn11 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN LOOP ON (SELECT e2 FROM pm1.g1) AS mycursor BEGIN LOOP ON (SELECT e1 FROM pm1.g1) AS mycursor BEGIN END END SELECT e1 FROM pm1.g1; END"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -1319,10 +1310,9 @@
         vgvp7e1.setSelectable(false);
         Column vgvp7e2 = createElement("ve2", vgvp7, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
         vgvp7e2.setSelectable(false);
-        Column vgvp7e3 = createElement("ve3", vgvp7, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
-        Column vgvp7e4 = createElement("ve4", vgvp7, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+        createElement("ve3", vgvp7, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+        createElement("ve4", vgvp7, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
         
-        
         //invalid
         QueryNode vspqn32 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; LOOP ON (SELECT e2 FROM pm1.g1) AS #mycursor BEGIN IF(#mycursor.e2 > 10) BEGIN CONTINUE; END x=#mycursor.e2; END SELECT e1 FROM pm1.g1 WHERE x=e2; END"); //$NON-NLS-1$ //$NON-NLS-2$
         Procedure vsp32 = createVirtualProcedure("vsp32", pm1, null, vspqn32); //$NON-NLS-1$
@@ -1342,7 +1332,7 @@
         vgvp1e1.setSelectable(false);
         Column vgvp1e2 = createElement("ve2", vgvp1, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
         vgvp1e2.setSelectable(false);
-        Column vgvp1e3 = createElement("ve3", vgvp1, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+        createElement("ve3", vgvp1, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
       
 		QueryNode vgvpn2 = new QueryNode("SELECT P.e1 as ve3 FROM (EXEC pm1.vsp26(vm1.vgvp2.ve1, vm1.vgvp2.ve2)) as P where P.e1='a'"); //$NON-NLS-1$ //$NON-NLS-2$
 		Table vgvp2 = createVirtualGroup("vgvp2", vm1, vgvpn2); //$NON-NLS-1$
@@ -1350,7 +1340,7 @@
         vgvp2e1.setSelectable(false);
         Column vgvp2e2 = createElement("ve2", vgvp2, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
         vgvp2e2.setSelectable(false);
-        Column vgvp2e3 = createElement("ve3", vgvp2, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+        createElement("ve3", vgvp2, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
    
 		QueryNode vgvpn3 = new QueryNode("SELECT P.e1 as ve3 FROM (EXEC pm1.vsp26(vm1.vgvp3.ve1, vm1.vgvp3.ve2)) as P, pm1.g2 where P.e1=g2.e1"); //$NON-NLS-1$ //$NON-NLS-2$
 		Table vgvp3 = createVirtualGroup("vgvp3", vm1, vgvpn3); //$NON-NLS-1$
@@ -1618,10 +1608,39 @@
 		String doc = docToString(plan);
 		Table table = createVirtualGroup(name, model, new QueryNode(doc));
 		table.setTableType(org.teiid.metadata.Table.Type.Document);
-		table.setColumns(new ArrayList<Column>(2));
+		extractColumns(table, plan);
 		return table;
 	}
+	
+	static void extractColumns(final Table table, MappingDocument plan) {
+		MappingVisitor mv = new MappingVisitor() {
+			public void visit(MappingElement element) {
+				String type = element.getType();
+				addColumn(element, type);
+			}
 
+			private void addColumn(MappingNode element,
+					String type) {
+				if (type != null) {
+					//TODO: choose the appropriate runtime type
+					Class<?> c = DataTypeManager.getDataTypeClass(type);
+					if (c == DefaultDataClasses.OBJECT) {
+						type = DefaultDataTypes.STRING;
+					}
+				} else {
+					type = DefaultDataTypes.STRING;
+				}
+				createElement(element.getFullyQualifiedName(), table, type);
+			}
+			
+			public void visit(MappingAttribute attribute) {
+				String type = attribute.getType();
+				addColumn(attribute, type);
+			}
+		};
+		plan.acceptVisitor(new Navigator(true, mv));
+	}
+
 	public static String docToString(MappingDocument plan) {
 		MappingOutputter out = new MappingOutputter();
         StringWriter stream = new StringWriter();
@@ -1796,12 +1815,12 @@
         MappingDocument doc = new MappingDocument(false);
         MappingElement root = doc.addChildElement(new MappingElement("root")); //$NON-NLS-1$
 
-        MappingSequenceNode node1 = root.addSequenceNode(new MappingSequenceNode());    
+        MappingElement node1 = root.addChildElement(new MappingElement("node1"));    
+        
         node1.addChildElement(new MappingElement("node2")); //$NON-NLS-1$
         root.addChildElement(new MappingElement("node2")); //$NON-NLS-1$
         return doc;
     }
-    
    
     // has attributes and elements
     private static MappingDocument exampleDoc4() {
@@ -2446,59 +2465,7 @@
 	    // END MAPPING DOC ======================================================================
 	    
 	    // Create virtual docs and doc elements
-	    Table itemsDoc = createXmlDocument("itemsDoc", xmltest, doc); //$NON-NLS-1$
-	    createElements(itemsDoc, 
-	        new String[] { "Catalogs",  //$NON-NLS-1$
-	                       "Catalogs.Catalog",  //$NON-NLS-1$
-	                       "Catalogs.Catalog.items",  //$NON-NLS-1$
-	                       "Catalogs.Catalog.items.item",  //$NON-NLS-1$
-	                       "Catalogs.Catalog.items.item. at ItemID",  //$NON-NLS-1$
-	                       "Catalogs.Catalog.items.item.Name",  //$NON-NLS-1$
-	                       "Catalogs.Catalog.items.item.Quantity", //$NON-NLS-1$
-	                       "Catalogs.Catalog.items.item.Suppliers", //$NON-NLS-1$
-	                       "Catalogs.Catalog.items.item.Suppliers.Supplier", //$NON-NLS-1$
-	                       "Catalogs.Catalog.items.item.Suppliers.Supplier. at SupplierID", //$NON-NLS-1$
-	                       "Catalogs.Catalog.items.item.Suppliers.Supplier.Name", //$NON-NLS-1$
-	                       "Catalogs.Catalog.items.item.Suppliers.Supplier.Zip", //$NON-NLS-1$
-	                       "Catalogs.Catalog.items.item.Suppliers.Supplier.Orders", //$NON-NLS-1$
-	                       "Catalogs.Catalog.items.item.Suppliers.Supplier.Orders.Order", //$NON-NLS-1$
-	                       "Catalogs.Catalog.items.item.Suppliers.Supplier.Orders.Order. at OrderID", //$NON-NLS-1$
-	                       "Catalogs.Catalog.items.item.Suppliers.Supplier.Orders.Order.OrderDate", //$NON-NLS-1$
-	                       "Catalogs.Catalog.items.item.Suppliers.Supplier.Orders.Order.OrderQuantity", //$NON-NLS-1$
-	                       "Catalogs.Catalog.items.item.Suppliers.Supplier.Orders.Order.OrderStatus", //$NON-NLS-1$
-	                       "Catalogs.Catalog.items.item.Suppliers.Supplier.Employees", //$NON-NLS-1$
-	                       "Catalogs.Catalog.items.item.Suppliers.Supplier.Employees.Employee", //$NON-NLS-1$
-	                       "Catalogs.Catalog.items.item.Suppliers.Supplier.Employees.Employee. at EmployeeID", //$NON-NLS-1$
-	                       "Catalogs.Catalog.items.item.Suppliers.Supplier.Employees.Employee.FirstName", //$NON-NLS-1$
-	                       "Catalogs.Catalog.items.item.Suppliers.Supplier.Employees.Employee.LastName", //$NON-NLS-1$
-	                       "Catalogs.Catalog.items.item.Suppliers.Supplier.Employees.Employee. at SupervisorID", //$NON-NLS-1$
-	    
-	        }, 
-	        new String[] { DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.INTEGER, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       });
+	    createXmlDocument("itemsDoc", xmltest, doc); //$NON-NLS-1$
 	        
 	    // Create mapping classes - baseball players employees doc
 	    QueryNode playersNode = new QueryNode("SELECT stock.employees.employeeNum, firstName, lastName, supervisorNum FROM stock.employees WHERE specializesInItemNum is not null"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -2555,37 +2522,7 @@
 	    // END MAPPING DOC ======================================================================
 	    
 	    // Create virtual docs and doc elements
-	    Table playersDoc = createXmlDocument("playersDoc", xmltest, doc2); //$NON-NLS-1$
-	    createElements(playersDoc, 
-	        new String[] { "BaseballPlayers",  //$NON-NLS-1$
-	                       "BaseballPlayers.Player",  //$NON-NLS-1$
-	                       "BaseballPlayers.Player. at PlayerID",  //$NON-NLS-1$
-	                       "BaseballPlayers.Player.FirstName",  //$NON-NLS-1$
-	                       "BaseballPlayers.Player.LastName",  //$NON-NLS-1$
-	                       "BaseballPlayers.Player.Manager",  //$NON-NLS-1$
-	                       "BaseballPlayers.Player.Manager. at ManagerID",  //$NON-NLS-1$
-	                       "BaseballPlayers.Player.Manager.FirstName",  //$NON-NLS-1$
-	                       "BaseballPlayers.Player.Manager.LastName",  //$NON-NLS-1$
-	                       "BaseballPlayers.Player.Manager.Owner",  //$NON-NLS-1$
-	                       "BaseballPlayers.Player.Manager.Owner. at OwnerID",  //$NON-NLS-1$
-	                       "BaseballPlayers.Player.Manager.Owner.FirstName",  //$NON-NLS-1$
-	                       "BaseballPlayers.Player.Manager.Owner.LastName",  //$NON-NLS-1$
-	    
-	        }, 
-	        new String[] { DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	                       DataTypeManager.DefaultDataTypes.STRING, 
-	        });        
+	    createXmlDocument("playersDoc", xmltest, doc2); //$NON-NLS-1$
 	    return createTransformationMetadata(metadataStore, "case3225");
 	}
 

Modified: trunk/engine/src/test/java/org/teiid/query/validator/TestUpdateValidator.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/validator/TestUpdateValidator.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/validator/TestUpdateValidator.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -48,8 +48,9 @@
 import org.teiid.query.resolver.QueryResolver;
 import org.teiid.query.resolver.util.ResolverUtil;
 import org.teiid.query.sql.lang.Command;
+import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Symbol;
 import org.teiid.query.unittest.RealMetadataFactory;
 import org.teiid.query.validator.UpdateValidator.UpdateInfo;
 import org.teiid.query.validator.UpdateValidator.UpdateType;
@@ -89,12 +90,12 @@
 		Command command = QueryParser.getQueryParser().parseCommand(sql);
 		QueryResolver.resolveCommand(command, md);
 		
-		List<SingleElementSymbol> symbols = command.getProjectedSymbols();
+		List<Expression> symbols = command.getProjectedSymbols();
 		String[] names = new String[symbols.size()];
 		String[] types = new String[symbols.size()];
 		int i = 0;
-		for (SingleElementSymbol singleElementSymbol : symbols) {
-			names[i] = singleElementSymbol.getShortName();
+		for (Expression singleElementSymbol : symbols) {
+			names[i] = Symbol.getShortName(singleElementSymbol);
 			types[i++] = DataTypeManager.getDataTypeName(singleElementSymbol.getType());
 		}
 		

Modified: trunk/engine/src/test/java/org/teiid/query/validator/TestValidator.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/validator/TestValidator.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/engine/src/test/java/org/teiid/query/validator/TestValidator.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -125,10 +125,7 @@
         sourceNode.addChildElement(new MappingElement("c2", "test.group.e3")); //$NON-NLS-1$ //$NON-NLS-2$
         
     	Schema docModel = RealMetadataFactory.createVirtualModel("vm1", metadataStore); //$NON-NLS-1$
-        Table doc1 = RealMetadataFactory.createXmlDocument("doc1", docModel, doc); //$NON-NLS-1$
-    	RealMetadataFactory.createElements(doc1, new String[] { "a0", "a0.a1", "a0.a1.a2", "a0.a1.b2", "a0.a1.c2" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
-    		new String[] {DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
-                        
+        RealMetadataFactory.createXmlDocument("doc1", docModel, doc); //$NON-NLS-1$
     	return RealMetadataFactory.createTransformationMetadata(metadataStore, "example");
     }
 	

Modified: trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestTPCR.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestTPCR.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestTPCR.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -127,7 +127,7 @@
         List<?>[] sqlServerExpected =
             new List<?>[] { Arrays.asList(new Object[] { new Integer(5), new Integer(12), new Long(5) } ),
                          Arrays.asList(new Object[] { new Integer(5), new Integer(13), new Long(5) } )};
-        dataMgr.addData("SELECT g_0.O_CUSTKEY AS c_0, g_0.O_ORDERKEY AS c_1, g_0.O_CUSTKEY AS c_2 FROM TPCR_SQLS.ORDERS AS g_0 WHERE (g_0.O_ORDERDATE < {ts'1992-01-02 00:00:00.0'}) AND (g_0.O_CUSTKEY IN (5, 6)) ORDER BY c_2", //$NON-NLS-1$
+        dataMgr.addData("SELECT g_0.O_CUSTKEY AS c_0, g_0.O_ORDERKEY AS c_1, convert(g_0.O_CUSTKEY, long) AS c_2 FROM TPCR_SQLS.ORDERS AS g_0 WHERE (g_0.O_ORDERDATE < {ts'1992-01-02 00:00:00.0'}) AND (convert(g_0.O_CUSTKEY, long) IN (5, 6)) ORDER BY c_2", //$NON-NLS-1$
                         sqlServerExpected);
         
         List<?>[] expected =
@@ -167,7 +167,7 @@
         List<?>[] sqlServerExpected =
             new List<?>[] { Arrays.asList(new Object[] { new Integer(5), new Integer(12), new Long(5) } ),
                          Arrays.asList(new Object[] { new Integer(5), new Integer(13), new Long(5) } )};
-        dataMgr.addData("SELECT g_0.O_CUSTKEY AS c_0, g_0.O_ORDERKEY AS c_1, g_0.O_CUSTKEY AS c_2 FROM TPCR_SQLS.ORDERS AS g_0 WHERE (g_0.O_ORDERDATE < {ts'1992-01-02 00:00:00.0'}) AND (g_0.O_CUSTKEY IN (5, 6)) ORDER BY c_2", //$NON-NLS-1$
+        dataMgr.addData("SELECT g_0.O_CUSTKEY AS c_0, g_0.O_ORDERKEY AS c_1, convert(g_0.O_CUSTKEY, long) AS c_2 FROM TPCR_SQLS.ORDERS AS g_0 WHERE (g_0.O_ORDERDATE < {ts'1992-01-02 00:00:00.0'}) AND (convert(g_0.O_CUSTKEY, long) IN (5, 6)) ORDER BY c_2", //$NON-NLS-1$
                         sqlServerExpected);
         
         List<?>[] expected =

Modified: trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestVDBMerge.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestVDBMerge.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestVDBMerge.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -24,8 +24,8 @@
     			"PartsSupplier    PartsSupplier    PARTSSUPPLIER.PARTS    Table    PARTS    true    true    mmuuid:f6276601-73fe-1edc-a81c-ecf397b10590    16    null    false    false    1",
     			"PartsSupplier    PartsSupplier    PARTSSUPPLIER.SHIP_VIA    Table    SHIP_VIA    true    true    mmuuid:0f4e9b80-73ff-1edc-a81c-ecf397b10590    4    null    false    false    2",
     			"PartsSupplier    PartsSupplier    PARTSSUPPLIER.STATUS    Table    STATUS    true    true    mmuuid:1f297200-73ff-1edc-a81c-ecf397b10590    3    null    false    false    3",
-    			"PartsSupplier    PartsSupplier    PARTSSUPPLIER.SUPPLIER_PARTS    Table    SUPPLIER_PARTS    true    true    mmuuid:3deafb00-73ff-1edc-a81c-ecf397b10590    227    null    false    false    4",
-    			"PartsSupplier    PartsSupplier    PARTSSUPPLIER.SUPPLIER    Table    SUPPLIER    true    true    mmuuid:2c371ec0-73ff-1edc-a81c-ecf397b10590    16    null    false    false    5"
+    			"PartsSupplier    PartsSupplier    PARTSSUPPLIER.SUPPLIER    Table    SUPPLIER    true    true    mmuuid:2c371ec0-73ff-1edc-a81c-ecf397b10590    16    null    false    false    4",
+    			"PartsSupplier    PartsSupplier    PARTSSUPPLIER.SUPPLIER_PARTS    Table    SUPPLIER_PARTS    true    true    mmuuid:3deafb00-73ff-1edc-a81c-ecf397b10590    227    null    false    false    5"
     	};
        executeTest("select * from tables where schemaname ='PartsSupplier'", expected); //$NON-NLS-1$
 
@@ -53,12 +53,12 @@
        server.mergeVDBS(VDB2, VDB1);
        
        this.internalConnection = server.createConnection("jdbc:teiid:"+VDB1);
-       executeTest("select * from tables where schemaname='BQT1'", expectedAfter); //$NON-NLS-1$
+       executeTest("select * from tables where schemaname='BQT1' order by name", expectedAfter); //$NON-NLS-1$
        
        server.undeployVDB(VDB2);
        
        // since the connection is not closed; need to behave as if still merged
-       executeTest("select * from tables where schemaname='BQT1'", expectedAfter); //$NON-NLS-1$
+       executeTest("select * from tables where schemaname='BQT1' order by name", expectedAfter); //$NON-NLS-1$
        
        // re-connect should behave as the original
        this.internalConnection.close();

Modified: trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestODBCProceduresSchema.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestODBCProceduresSchema.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestODBCProceduresSchema.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -23,8 +23,9 @@
 
 import static org.junit.Assert.*;
 
-
+import org.junit.AfterClass;
 import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.teiid.core.util.UnitTestUtil;
 import org.teiid.jdbc.AbstractMMQueryTestCase;
@@ -33,6 +34,7 @@
 @SuppressWarnings("nls")
 public class TestODBCProceduresSchema extends AbstractMMQueryTestCase {
 	private static final String VDB = "bqt"; //$NON-NLS-1$
+	private static FakeServer server;
 
 	public TestODBCProceduresSchema() {
 		// this is needed because the result files are generated
@@ -40,9 +42,16 @@
 		super.DELIMITER = "\t"; //$NON-NLS-1$
 	}
 	
+	@BeforeClass public static void oneTimeSetup() throws Exception {
+		server = new FakeServer();
+    	server.deployVDB(VDB, UnitTestUtil.getTestDataPath() + "/bqt.vdb");
+	}
+	
+	@AfterClass public static void oneTimeTeardown() throws Exception {
+		server.stop();
+	}
+	
     @Before public void setUp() throws Exception {
-    	FakeServer server = new FakeServer();
-    	server.deployVDB(VDB, UnitTestUtil.getTestDataPath() + "/bqt.vdb");
     	this.internalConnection = server.createConnection("jdbc:teiid:" + VDB); //$NON-NLS-1$ //$NON-NLS-2$	
    	}
    

Modified: trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestResultSetMetadata.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestResultSetMetadata.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestResultSetMetadata.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -68,7 +68,7 @@
     @Test public void testCount()  throws Exception {
     	String[] expected = {
     		    "ColumnName	ColumnType	ColumnTypeName	ColumnClassName	isNullable	TableName	SchemaName	CatalogName",	 //$NON-NLS-1$
-    		    "count	4	integer	java.lang.Integer	1	null	null	PartsSupplier" //$NON-NLS-1$
+    		    "expr1	4	integer	java.lang.Integer	1	null	null	PartsSupplier" //$NON-NLS-1$
     	};
     	executeTest("select count(*) from parts where 1=0", expected); //$NON-NLS-1$
     }
@@ -87,10 +87,10 @@
     @Test public void testTempGroupStar()  throws Exception {
     	String[] expected = { 
 		    "ColumnName	ColumnType	ColumnTypeName	ColumnClassName	isNullable	TableName	SchemaName	CatalogName",	 //$NON-NLS-1$
-		    "PART_ID	12	string	java.lang.String	0	FOO	null	PartsSupplier", //$NON-NLS-1$
-		    "PART_NAME	12	string	java.lang.String	1	FOO	null	PartsSupplier", //$NON-NLS-1$
-		    "PART_COLOR	12	string	java.lang.String	1	FOO	null	PartsSupplier", //$NON-NLS-1$
-		    "PART_WEIGHT	12	string	java.lang.String	1	FOO	null	PartsSupplier" //$NON-NLS-1$
+		    "PART_ID	12	string	java.lang.String	0	foo	null	PartsSupplier", //$NON-NLS-1$
+		    "PART_NAME	12	string	java.lang.String	1	foo	null	PartsSupplier", //$NON-NLS-1$
+		    "PART_COLOR	12	string	java.lang.String	1	foo	null	PartsSupplier", //$NON-NLS-1$
+		    "PART_WEIGHT	12	string	java.lang.String	1	foo	null	PartsSupplier" //$NON-NLS-1$
     	};
     	executeTest("select * from (select * from parts) foo where 1=0", expected); //$NON-NLS-1$
     }
@@ -98,7 +98,7 @@
     @Test public void testCountAndElement()  throws Exception {
     	String[] expected = {
 	        "ColumnName	ColumnType	ColumnTypeName	ColumnClassName	isNullable	TableName	SchemaName	CatalogName",	 //$NON-NLS-1$
-	        "count	4	integer	java.lang.Integer	1	null	null	PartsSupplier", //$NON-NLS-1$
+	        "expr1	4	integer	java.lang.Integer	1	null	null	PartsSupplier", //$NON-NLS-1$
 	        "PART_NAME	12	string	java.lang.String	1	PARTSSUPPLIER.PARTS	PartsSupplier	PartsSupplier" //$NON-NLS-1$
     	};
     	executeTest("select count(*), part_name from parts where 1=0 group by part_name", expected); //$NON-NLS-1$
@@ -118,7 +118,7 @@
     @Test public void testCount_PreparedStatement()  throws Exception {
     	String[] expected = {
 	        "ColumnName	ColumnType	ColumnTypeName	ColumnClassName	isNullable	TableName	SchemaName	CatalogName", //$NON-NLS-1$
-	        "count	4	integer	java.lang.Integer	1	null	null	PartsSupplier" //$NON-NLS-1$
+	        "expr1	4	integer	java.lang.Integer	1	null	null	PartsSupplier" //$NON-NLS-1$
     	};
     	executePreparedTest("select count(*) from parts where 1=0", expected); //$NON-NLS-1$
     }
@@ -126,7 +126,7 @@
     @Test public void testCountAndElement_PreparedStatement()  throws Exception {
     	String[] expected = {
 	        "ColumnName	ColumnType	ColumnTypeName	ColumnClassName	isNullable	TableName	SchemaName	CatalogName", //$NON-NLS-1$
-	        "count	4	integer	java.lang.Integer	1	null	null	PartsSupplier", //$NON-NLS-1$
+	        "expr1	4	integer	java.lang.Integer	1	null	null	PartsSupplier", //$NON-NLS-1$
 	        "PART_NAME	12	string	java.lang.String	1	PARTSSUPPLIER.PARTS	PartsSupplier	PartsSupplier" //$NON-NLS-1$
     	};
     	executePreparedTest("select count(*), part_name from parts where 1=0 group by part_name", expected); //$NON-NLS-1$

Modified: trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestVirtualDocWithVirtualProc.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestVirtualDocWithVirtualProc.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestVirtualDocWithVirtualProc.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -23,7 +23,9 @@
 package org.teiid.systemmodel;
 
 import org.junit.After;
+import org.junit.AfterClass;
 import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.teiid.core.util.UnitTestUtil;
 import org.teiid.jdbc.AbstractMMQueryTestCase;
@@ -38,6 +40,7 @@
 public class TestVirtualDocWithVirtualProc extends AbstractMMQueryTestCase {
 
     private static final String VDB = "xmlvp"; //$NON-NLS-1$
+	private static FakeServer server;
 
     public TestVirtualDocWithVirtualProc() {
     	// this is needed because the result files are generated 
@@ -45,9 +48,16 @@
     	super.DELIMITER = "\t"; //$NON-NLS-1$
     }
     
+    @BeforeClass public static void oneTimeSetup() throws Exception {
+    	server = new FakeServer();
+    	server.deployVDB(VDB, UnitTestUtil.getTestDataPath() + "/xml-vp/xmlvp_1.vdb");
+    }
+    
+    @AfterClass public static void oneTimeTeardown() throws Exception {
+    	server.stop();
+    }
+    
     @Before public void setUp() throws Exception {
-    	FakeServer server = new FakeServer();
-    	server.deployVDB(VDB, UnitTestUtil.getTestDataPath() + "/xml-vp/xmlvp_1.vdb");
     	this.internalConnection = server.createConnection("jdbc:teiid:" + VDB); //$NON-NLS-1$ //$NON-NLS-2$	    	
     }
     
@@ -85,7 +95,7 @@
 
     @Test public void testDefect15241b() throws Exception {
     	
-    	String sql = "SELECT p.Name, p.Value, UID FROM SYS.Properties p"; //$NON-NLS-1$
+    	String sql = "SELECT p.Name, p.Value, UID FROM SYS.Properties p order by p.Name"; //$NON-NLS-1$
     	String[] expected ={
 	    "Name[string]	Value[string]	UID[string]",	 //$NON-NLS-1$
 	    "NugentXAttribute	Nuuuuuge22222	mmuuid:4789b280-841c-1f15-9526-ebd0cace03e1", //$NON-NLS-1$

Modified: trunk/test-integration/common/src/test/resources/TestJDBCSocketTransport/testSelect.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestJDBCSocketTransport/testSelect.expected	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/test-integration/common/src/test/resources/TestJDBCSocketTransport/testSelect.expected	2011-12-14 22:19:17 UTC (rev 3740)
@@ -8,8 +8,8 @@
 parts                                                              PartsSupplier                                                      PARTSSUPPLIER.PARTS                                                Table                 PARTS                                                              true        true             mmuuid:f6276601-73fe-1edc-a81c-ecf397b10590         16           <null>                                                             false     false           1          
 parts                                                              PartsSupplier                                                      PARTSSUPPLIER.SHIP_VIA                                             Table                 SHIP_VIA                                                           true        true             mmuuid:0f4e9b80-73ff-1edc-a81c-ecf397b10590         4            <null>                                                             false     false           2          
 parts                                                              PartsSupplier                                                      PARTSSUPPLIER.STATUS                                               Table                 STATUS                                                             true        true             mmuuid:1f297200-73ff-1edc-a81c-ecf397b10590         3            <null>                                                             false     false           3          
-parts                                                              PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER                                             Table                 SUPPLIER                                                           true        true             mmuuid:2c371ec0-73ff-1edc-a81c-ecf397b10590         16           <null>                                                             false     false           5          
-parts                                                              PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER_PARTS                                       Table                 SUPPLIER_PARTS                                                     true        true             mmuuid:3deafb00-73ff-1edc-a81c-ecf397b10590         227          <null>                                                             false     false           4          
+parts                                                              PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER                                             Table                 SUPPLIER                                                           true        true             mmuuid:2c371ec0-73ff-1edc-a81c-ecf397b10590         16           <null>                                                             false     false           4          
+parts                                                              PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER_PARTS                                       Table                 SUPPLIER_PARTS                                                     true        true             mmuuid:3deafb00-73ff-1edc-a81c-ecf397b10590         227          <null>                                                             false     false           5          
 parts                                                              SYS                                                                ProcedureParams                                                    Table                 <null>                                                             true        false            mmuuid:a56bd7fe-c87a-411c-8f5d-661975a25626         -1           <null>                                                             true      false           12         
 parts                                                              SYS                                                                Procedures                                                         Table                 <null>                                                             true        false            mmuuid:0bc132a5-9f8d-4a3c-9f5d-98156a98a962         -1           <null>                                                             true      false           13         
 parts                                                              SYS                                                                Properties                                                         Table                 <null>                                                             true        false            mmuuid:7a45e50a-d03f-4548-ba35-761651bbca85         -1           <null>                                                             true      false           14         
@@ -18,19 +18,19 @@
 parts                                                              SYS                                                                Tables                                                             Table                 <null>                                                             true        false            mmuuid:8551b3bd-11cc-4049-9bcf-fe91a0eb7ba7         -1           <null>                                                             true      false           17         
 parts                                                              SYSADMIN                                                           VDBResources                                                       Table                 <null>                                                             true        false            mmuuid:1785804d-beaf-4831-9531-e59164fedd49         -1           <null>                                                             true      false           7          
 parts                                                              SYS                                                                VirtualDatabases                                                   Table                 <null>                                                             true        false            mmuuid:47297c72-d621-4f4e-af4e-74060ac5f489         -1           <null>                                                             true      false           18         
-parts                                                              pg_catalog                                                         matpg_datatype                                                     Table                 <null>                                                             false       false            mmuid:17448311-6679-4dfd-aeb6-4aabbd894729          -1           <null>                                                             true      true            31         
-parts                                                              pg_catalog                                                         matpg_relatt                                                       Table                 <null>                                                             false       false            mmuid:8c0714d6-1c72-40b4-8528-3b2c63059107          -1           <null>                                                             true      true            30         
-parts                                                              pg_catalog                                                         pg_am                                                              Table                 <null>                                                             false       false            mmuid:f6517a63-8c14-4b73-a18d-afaa5dfb35d9          -1           <null>                                                             true      false           24         
-parts                                                              pg_catalog                                                         pg_attrdef                                                         Table                 <null>                                                             false       false            mmuid:76a7dd05-9a7d-4243-b561-f3056500dcaf          -1           <null>                                                             true      false           27         
-parts                                                              pg_catalog                                                         pg_attribute                                                       Table                 <null>                                                             false       false            mmuid:fa463d98-365f-489a-a707-025193cb51eb          -1           <null>                                                             true      true            21         
-parts                                                              pg_catalog                                                         pg_class                                                           Table                 <null>                                                             false       false            mmuid:7e21f2e6-06e3-4bca-9b01-72ea47821560          -1           <null>                                                             true      true            20         
-parts                                                              pg_catalog                                                         pg_database                                                        Table                 <null>                                                             false       false            mmuid:382f9fc9-8c96-4df7-ab5d-04dfb47ee142          -1           <null>                                                             true      false           28         
-parts                                                              pg_catalog                                                         pg_index                                                           Table                 <null>                                                             false       false            mmuid:09daed8d-b0b8-4552-a261-2b6c775b46b0          -1           <null>                                                             true      true            23         
-parts                                                              pg_catalog                                                         pg_namespace                                                       Table                 <null>                                                             false       false            mmuid:6609866a-3d7b-4f4b-95fe-ebfac769d699          -1           <null>                                                             true      false           19         
-parts                                                              pg_catalog                                                         pg_proc                                                            Table                 <null>                                                             false       false            mmuid:f20c9489-10ca-4596-8a37-24218b67f764          -1           <null>                                                             true      true            25         
-parts                                                              pg_catalog                                                         pg_trigger                                                         Table                 <null>                                                             false       false            mmuid:2b75f0b1-7475-4ed5-9da3-d37a8a25f26a          -1           <null>                                                             true      false           26         
-parts                                                              pg_catalog                                                         pg_type                                                            Table                 <null>                                                             false       false            mmuid:9462e3f8-cd3c-414f-a570-f6f33c40e36a          -1           <null>                                                             true      false           22         
-parts                                                              pg_catalog                                                         pg_user                                                            Table                 <null>                                                             false       false            mmuid:e63613cb-01ee-4b37-8b91-99d1aac4dfcb          -1           <null>                                                             true      false           29         
+parts                                                              pg_catalog                                                         matpg_datatype                                                     Table                 <null>                                                             false       false            mmuid:17448311-6679-4dfd-aeb6-4aabbd894729          -1           <null>                                                             true      true            19         
+parts                                                              pg_catalog                                                         matpg_relatt                                                       Table                 <null>                                                             false       false            mmuid:8c0714d6-1c72-40b4-8528-3b2c63059107          -1           <null>                                                             true      true            20         
+parts                                                              pg_catalog                                                         pg_am                                                              Table                 <null>                                                             false       false            mmuid:f6517a63-8c14-4b73-a18d-afaa5dfb35d9          -1           <null>                                                             true      false           21         
+parts                                                              pg_catalog                                                         pg_attrdef                                                         Table                 <null>                                                             false       false            mmuid:76a7dd05-9a7d-4243-b561-f3056500dcaf          -1           <null>                                                             true      false           22         
+parts                                                              pg_catalog                                                         pg_attribute                                                       Table                 <null>                                                             false       false            mmuid:fa463d98-365f-489a-a707-025193cb51eb          -1           <null>                                                             true      true            23         
+parts                                                              pg_catalog                                                         pg_class                                                           Table                 <null>                                                             false       false            mmuid:7e21f2e6-06e3-4bca-9b01-72ea47821560          -1           <null>                                                             true      true            24         
+parts                                                              pg_catalog                                                         pg_database                                                        Table                 <null>                                                             false       false            mmuid:382f9fc9-8c96-4df7-ab5d-04dfb47ee142          -1           <null>                                                             true      false           25         
+parts                                                              pg_catalog                                                         pg_index                                                           Table                 <null>                                                             false       false            mmuid:09daed8d-b0b8-4552-a261-2b6c775b46b0          -1           <null>                                                             true      true            26         
+parts                                                              pg_catalog                                                         pg_namespace                                                       Table                 <null>                                                             false       false            mmuid:6609866a-3d7b-4f4b-95fe-ebfac769d699          -1           <null>                                                             true      false           27         
+parts                                                              pg_catalog                                                         pg_proc                                                            Table                 <null>                                                             false       false            mmuid:f20c9489-10ca-4596-8a37-24218b67f764          -1           <null>                                                             true      true            28         
+parts                                                              pg_catalog                                                         pg_trigger                                                         Table                 <null>                                                             false       false            mmuid:2b75f0b1-7475-4ed5-9da3-d37a8a25f26a          -1           <null>                                                             true      false           29         
+parts                                                              pg_catalog                                                         pg_type                                                            Table                 <null>                                                             false       false            mmuid:9462e3f8-cd3c-414f-a570-f6f33c40e36a          -1           <null>                                                             true      false           30         
+parts                                                              pg_catalog                                                         pg_user                                                            Table                 <null>                                                             false       false            mmuid:e63613cb-01ee-4b37-8b91-99d1aac4dfcb          -1           <null>                                                             true      false           31         
 Row Count : 31
 getColumnName    getColumnType  getCatalogName  getColumnClassName  getColumnLabel   getColumnTypeName  getSchemaName  getTableName  getColumnDisplaySize  getPrecision  getScale  isAutoIncrement  isCaseSensitive  isCurrency  isDefinitelyWritable  isNullable  isReadOnly  isSearchable  isSigned  isWritable  
 VDBName          12             parts           java.lang.String    VDBName          string             SYS            Tables        255                   255           0         false            true             false       true                  1           false       true          true      true        

Modified: trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_ATTRIBUTE.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_ATTRIBUTE.expected	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_ATTRIBUTE.expected	2011-12-14 22:19:17 UTC (rev 3740)
@@ -9,14 +9,14 @@
 7            3            STATUS_ID                                                          21           2       1       4            true        false         false    
 8            3            STATUS_NAME                                                        1043         -1      2       34           false       false         false    
 9            4            SUPPLIER_ID                                                        1043         -1      1       14           true        false         false    
-10           4            PART_ID                                                            1043         -1      2       8            true        false         false    
-11           4            QUANTITY                                                           21           2       3       4            false       false         false    
-12           4            SHIPPER_ID                                                         21           2       4       4            false       false         false    
-13           5            SUPPLIER_ID                                                        1043         -1      1       14           true        false         false    
-14           5            SUPPLIER_NAME                                                      1043         -1      2       34           false       false         false    
-15           5            SUPPLIER_STATUS                                                    21           2       3       4            false       false         false    
-16           5            SUPPLIER_CITY                                                      1043         -1      4       34           false       false         false    
-17           5            SUPPLIER_STATE                                                     1043         -1      5       6            false       false         false    
+10           4            SUPPLIER_NAME                                                      1043         -1      2       34           false       false         false    
+11           4            SUPPLIER_STATUS                                                    21           2       3       4            false       false         false    
+12           4            SUPPLIER_CITY                                                      1043         -1      4       34           false       false         false    
+13           4            SUPPLIER_STATE                                                     1043         -1      5       6            false       false         false    
+14           5            SUPPLIER_ID                                                        1043         -1      1       14           true        false         false    
+15           5            PART_ID                                                            1043         -1      2       8            true        false         false    
+16           5            QUANTITY                                                           21           2       3       4            false       false         false    
+17           5            SHIPPER_ID                                                         21           2       4       4            false       false         false    
 18           6            VDBName                                                            1043         -1      1       259          true        false         false    
 19           6            SchemaName                                                         1043         -1      2       259          true        false         false    
 20           6            Name                                                               1043         -1      3       259          true        false         false    
@@ -165,93 +165,93 @@
 163          18           Name                                                               1043         -1      1       259          true        false         false    
 164          18           Version                                                            1043         -1      2       54           true        false         false    
 165          19           oid                                                                23           4       1       4            false       false         false    
-166          19           nspname                                                            1043         -1      2       4            false       false         false    
-167          20           oid                                                                23           4       1       4            false       false         false    
-168          20           relname                                                            1043         -1      2       4            false       false         false    
-169          20           relnamespace                                                       23           4       3       4            false       false         false    
-170          20           relkind                                                            1042         1       4       4            false       false         false    
-171          20           relam                                                              23           4       5       4            false       false         false    
-172          20           reltuples                                                          700          4       6       4            false       false         false    
-173          20           relpages                                                           23           4       7       4            false       false         false    
-174          20           relhasrules                                                        16           1       8       4            false       false         false    
-175          20           relhasoids                                                         16           1       9       4            false       false         false    
-176          21           oid                                                                23           4       1       4            false       false         false    
-177          21           attrelid                                                           23           4       2       4            false       false         false    
-178          21           attname                                                            1043         -1      3       4            false       false         false    
-179          21           atttypid                                                           23           4       4       4            false       false         false    
-180          21           attlen                                                             21           2       5       4            false       false         false    
-181          21           attnum                                                             21           2       6       4            false       false         false    
-182          21           atttypmod                                                          23           4       7       4            false       false         false    
-183          21           attnotnull                                                         16           1       8       4            false       false         false    
-184          21           attisdropped                                                       16           1       9       4            false       false         false    
-185          21           atthasdef                                                          16           1       10      4            false       false         false    
-186          22           oid                                                                23           4       1       4            false       false         false    
-187          22           typname                                                            1043         -1      2       4            false       false         false    
-188          22           typnamespace                                                       23           4       3       4            false       false         false    
-189          22           typlen                                                             21           2       4       4            false       false         false    
-190          22           typtype                                                            1042         1       5       4            false       false         false    
-191          22           typbasetype                                                        23           4       6       4            false       false         false    
-192          22           typtypmod                                                          23           4       7       4            false       false         false    
-193          22           typrelid                                                           23           4       8       4            false       false         false    
-194          22           typelem                                                            23           4       9       4            false       false         false    
-195          23           oid                                                                23           4       1       4            false       false         false    
-196          23           indexrelid                                                         23           4       2       4            false       false         false    
-197          23           indrelid                                                           23           4       3       4            false       false         false    
-198          23           indisclustered                                                     16           1       4       4            false       false         false    
-199          23           indisunique                                                        16           1       5       4            false       false         false    
-200          23           indisprimary                                                       16           1       6       4            false       false         false    
-201          23           indexprs                                                           1043         -1      7       4            false       false         false    
-202          23           indkey                                                             1043         -1      8       4            false       false         false    
-203          24           oid                                                                23           4       1       4            false       false         false    
-204          24           amname                                                             1043         -1      2       4            false       false         false    
-205          25           oid                                                                23           4       1       4            false       false         false    
-206          25           proname                                                            1043         -1      2       4            false       false         false    
-207          25           proretset                                                          16           1       3       4            false       false         false    
-208          25           prorettype                                                         23           4       4       4            false       false         false    
-209          25           pronargs                                                           21           2       5       4            false       false         false    
-210          25           proargtypes                                                        705          -2      6       4            false       false         false    
-211          25           proargnames                                                        705          -2      7       4            false       false         false    
-212          25           proargmodes                                                        705          -2      8       4            false       false         false    
-213          25           proallargtypes                                                     705          -2      9       4            false       false         false    
-214          25           pronamespace                                                       23           4       10      4            false       false         false    
-215          26           oid                                                                23           4       1       4            false       false         false    
-216          26           tgconstrrelid                                                      23           4       2       4            false       false         false    
-217          26           tgfoid                                                             23           4       3       4            false       false         false    
-218          26           tgargs                                                             23           4       4       4            false       false         false    
-219          26           tgnargs                                                            23           4       5       4            false       false         false    
-220          26           tgdeferrable                                                       16           1       6       4            false       false         false    
-221          26           tginitdeferred                                                     16           1       7       4            false       false         false    
-222          26           tgconstrname                                                       1043         -1      8       4            false       false         false    
-223          26           tgrelid                                                            23           4       9       4            false       false         false    
-224          27           adrelid                                                            23           4       1       4            false       false         false    
-225          27           adnum                                                              23           4       2       4            false       false         false    
-226          27           adbin                                                              1043         -1      3       4            false       false         false    
-227          27           adsrc                                                              1043         -1      4       4            false       false         false    
-228          28           oid                                                                23           4       1       4            false       false         false    
-229          28           datname                                                            1043         -1      2       4            false       false         false    
-230          28           encoding                                                           23           4       3       4            false       false         false    
-231          28           datlastsysoid                                                      23           4       4       4            false       false         false    
-232          28           datallowconn                                                       1042         1       5       4            false       false         false    
-233          28           datconfig                                                          705          -2      6       4            false       false         false    
-234          28           datacl                                                             705          -2      7       4            false       false         false    
-235          28           datdba                                                             23           4       8       4            false       false         false    
-236          28           dattablespace                                                      23           4       9       4            false       false         false    
-237          29           oid                                                                23           4       1       4            false       false         false    
-238          29           usename                                                            1043         -1      2       4            false       false         false    
-239          29           usecreatedb                                                        16           1       3       4            false       false         false    
-240          29           usesuper                                                           16           1       4       4            false       false         false    
-241          30           attrelid                                                           23           4       1       4            false       false         false    
-242          30           attnum                                                             21           2       2       4            false       false         false    
-243          30           attname                                                            1043         -1      3       4            false       false         false    
-244          30           relname                                                            1043         -1      4       4            false       false         false    
-245          30           nspname                                                            1043         -1      5       4            false       false         false    
-246          30           autoinc                                                            16           1       6       4            false       false         false    
-247          30           typoid                                                             23           4       7       4            false       false         false    
-248          31           oid                                                                23           4       1       4            false       false         false    
-249          31           typname                                                            1043         -1      2       4            false       false         false    
-250          31           name                                                               1043         -1      3       4            false       false         false    
-251          31           uid                                                                1043         -1      4       4            false       false         false    
-252          31           typlen                                                             21           2       5       4            false       false         false    
+166          19           typname                                                            1043         -1      2       4            false       false         false    
+167          19           name                                                               1043         -1      3       4            false       false         false    
+168          19           uid                                                                1043         -1      4       4            false       false         false    
+169          19           typlen                                                             21           2       5       4            false       false         false    
+170          20           attrelid                                                           23           4       1       4            false       false         false    
+171          20           attnum                                                             21           2       2       4            false       false         false    
+172          20           attname                                                            1043         -1      3       4            false       false         false    
+173          20           relname                                                            1043         -1      4       4            false       false         false    
+174          20           nspname                                                            1043         -1      5       4            false       false         false    
+175          20           autoinc                                                            16           1       6       4            false       false         false    
+176          20           typoid                                                             23           4       7       4            false       false         false    
+177          21           oid                                                                23           4       1       4            false       false         false    
+178          21           amname                                                             1043         -1      2       4            false       false         false    
+179          22           adrelid                                                            23           4       1       4            false       false         false    
+180          22           adnum                                                              23           4       2       4            false       false         false    
+181          22           adbin                                                              1043         -1      3       4            false       false         false    
+182          22           adsrc                                                              1043         -1      4       4            false       false         false    
+183          23           oid                                                                23           4       1       4            false       false         false    
+184          23           attrelid                                                           23           4       2       4            false       false         false    
+185          23           attname                                                            1043         -1      3       4            false       false         false    
+186          23           atttypid                                                           23           4       4       4            false       false         false    
+187          23           attlen                                                             21           2       5       4            false       false         false    
+188          23           attnum                                                             21           2       6       4            false       false         false    
+189          23           atttypmod                                                          23           4       7       4            false       false         false    
+190          23           attnotnull                                                         16           1       8       4            false       false         false    
+191          23           attisdropped                                                       16           1       9       4            false       false         false    
+192          23           atthasdef                                                          16           1       10      4            false       false         false    
+193          24           oid                                                                23           4       1       4            false       false         false    
+194          24           relname                                                            1043         -1      2       4            false       false         false    
+195          24           relnamespace                                                       23           4       3       4            false       false         false    
+196          24           relkind                                                            1042         1       4       4            false       false         false    
+197          24           relam                                                              23           4       5       4            false       false         false    
+198          24           reltuples                                                          700          4       6       4            false       false         false    
+199          24           relpages                                                           23           4       7       4            false       false         false    
+200          24           relhasrules                                                        16           1       8       4            false       false         false    
+201          24           relhasoids                                                         16           1       9       4            false       false         false    
+202          25           oid                                                                23           4       1       4            false       false         false    
+203          25           datname                                                            1043         -1      2       4            false       false         false    
+204          25           encoding                                                           23           4       3       4            false       false         false    
+205          25           datlastsysoid                                                      23           4       4       4            false       false         false    
+206          25           datallowconn                                                       1042         1       5       4            false       false         false    
+207          25           datconfig                                                          705          -2      6       4            false       false         false    
+208          25           datacl                                                             705          -2      7       4            false       false         false    
+209          25           datdba                                                             23           4       8       4            false       false         false    
+210          25           dattablespace                                                      23           4       9       4            false       false         false    
+211          26           oid                                                                23           4       1       4            false       false         false    
+212          26           indexrelid                                                         23           4       2       4            false       false         false    
+213          26           indrelid                                                           23           4       3       4            false       false         false    
+214          26           indisclustered                                                     16           1       4       4            false       false         false    
+215          26           indisunique                                                        16           1       5       4            false       false         false    
+216          26           indisprimary                                                       16           1       6       4            false       false         false    
+217          26           indexprs                                                           1043         -1      7       4            false       false         false    
+218          26           indkey                                                             1043         -1      8       4            false       false         false    
+219          27           oid                                                                23           4       1       4            false       false         false    
+220          27           nspname                                                            1043         -1      2       4            false       false         false    
+221          28           oid                                                                23           4       1       4            false       false         false    
+222          28           proname                                                            1043         -1      2       4            false       false         false    
+223          28           proretset                                                          16           1       3       4            false       false         false    
+224          28           prorettype                                                         23           4       4       4            false       false         false    
+225          28           pronargs                                                           21           2       5       4            false       false         false    
+226          28           proargtypes                                                        705          -2      6       4            false       false         false    
+227          28           proargnames                                                        705          -2      7       4            false       false         false    
+228          28           proargmodes                                                        705          -2      8       4            false       false         false    
+229          28           proallargtypes                                                     705          -2      9       4            false       false         false    
+230          28           pronamespace                                                       23           4       10      4            false       false         false    
+231          29           oid                                                                23           4       1       4            false       false         false    
+232          29           tgconstrrelid                                                      23           4       2       4            false       false         false    
+233          29           tgfoid                                                             23           4       3       4            false       false         false    
+234          29           tgargs                                                             23           4       4       4            false       false         false    
+235          29           tgnargs                                                            23           4       5       4            false       false         false    
+236          29           tgdeferrable                                                       16           1       6       4            false       false         false    
+237          29           tginitdeferred                                                     16           1       7       4            false       false         false    
+238          29           tgconstrname                                                       1043         -1      8       4            false       false         false    
+239          29           tgrelid                                                            23           4       9       4            false       false         false    
+240          30           oid                                                                23           4       1       4            false       false         false    
+241          30           typname                                                            1043         -1      2       4            false       false         false    
+242          30           typnamespace                                                       23           4       3       4            false       false         false    
+243          30           typlen                                                             21           2       4       4            false       false         false    
+244          30           typtype                                                            1042         1       5       4            false       false         false    
+245          30           typbasetype                                                        23           4       6       4            false       false         false    
+246          30           typtypmod                                                          23           4       7       4            false       false         false    
+247          30           typrelid                                                           23           4       8       4            false       false         false    
+248          30           typelem                                                            23           4       9       4            false       false         false    
+249          31           oid                                                                23           4       1       4            false       false         false    
+250          31           usename                                                            1043         -1      2       4            false       false         false    
+251          31           usecreatedb                                                        16           1       3       4            false       false         false    
+252          31           usesuper                                                           16           1       4       4            false       false         false    
 Row Count : 252
 getColumnName  getColumnType  getCatalogName  getColumnClassName  getColumnLabel  getColumnTypeName  getSchemaName  getTableName  getColumnDisplaySize  getPrecision  getScale  isAutoIncrement  isCaseSensitive  isCurrency  isDefinitelyWritable  isNullable  isReadOnly  isSearchable  isSigned  isWritable  
 oid            4              PartsSupplier   java.lang.Integer   oid             integer            pg_catalog     pg_attribute  11                    10            0         false            false            false       false                 2           true        true          false     false       

Modified: trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_CLASS.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_CLASS.expected	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_CLASS.expected	2011-12-14 22:19:17 UTC (rev 3740)
@@ -3,8 +3,8 @@
 1            PARTSSUPPLIER.PARTS                                                1             r        0            0.0                     0            false        false     
 2            PARTSSUPPLIER.SHIP_VIA                                             1             r        0            0.0                     0            false        false     
 3            PARTSSUPPLIER.STATUS                                               1             r        0            0.0                     0            false        false     
-4            PARTSSUPPLIER.SUPPLIER_PARTS                                       1             r        0            0.0                     0            false        false     
-5            PARTSSUPPLIER.SUPPLIER                                             1             r        0            0.0                     0            false        false     
+4            PARTSSUPPLIER.SUPPLIER                                             1             r        0            0.0                     0            false        false     
+5            PARTSSUPPLIER.SUPPLIER_PARTS                                       1             r        0            0.0                     0            false        false     
 6            MatViews                                                           2             r        0            0.0                     0            false        false     
 7            VDBResources                                                       2             r        0            0.0                     0            false        false     
 8            Columns                                                            3             r        0            0.0                     0            false        false     
@@ -18,19 +18,19 @@
 16           Schemas                                                            3             r        0            0.0                     0            false        false     
 17           Tables                                                             3             r        0            0.0                     0            false        false     
 18           VirtualDatabases                                                   3             r        0            0.0                     0            false        false     
-19           pg_namespace                                                       4             v        0            0.0                     0            false        false     
-20           pg_class                                                           4             v        0            0.0                     0            false        false     
-21           pg_attribute                                                       4             v        0            0.0                     0            false        false     
-22           pg_type                                                            4             v        0            0.0                     0            false        false     
-23           pg_index                                                           4             v        0            0.0                     0            false        false     
-24           pg_am                                                              4             v        0            0.0                     0            false        false     
-25           pg_proc                                                            4             v        0            0.0                     0            false        false     
-26           pg_trigger                                                         4             v        0            0.0                     0            false        false     
-27           pg_attrdef                                                         4             v        0            0.0                     0            false        false     
-28           pg_database                                                        4             v        0            0.0                     0            false        false     
-29           pg_user                                                            4             v        0            0.0                     0            false        false     
-30           matpg_relatt                                                       4             v        0            0.0                     0            false        false     
-31           matpg_datatype                                                     4             v        0            0.0                     0            false        false     
+19           matpg_datatype                                                     4             v        0            0.0                     0            false        false     
+20           matpg_relatt                                                       4             v        0            0.0                     0            false        false     
+21           pg_am                                                              4             v        0            0.0                     0            false        false     
+22           pg_attrdef                                                         4             v        0            0.0                     0            false        false     
+23           pg_attribute                                                       4             v        0            0.0                     0            false        false     
+24           pg_class                                                           4             v        0            0.0                     0            false        false     
+25           pg_database                                                        4             v        0            0.0                     0            false        false     
+26           pg_index                                                           4             v        0            0.0                     0            false        false     
+27           pg_namespace                                                       4             v        0            0.0                     0            false        false     
+28           pg_proc                                                            4             v        0            0.0                     0            false        false     
+29           pg_trigger                                                         4             v        0            0.0                     0            false        false     
+30           pg_type                                                            4             v        0            0.0                     0            false        false     
+31           pg_user                                                            4             v        0            0.0                     0            false        false     
 Row Count : 31
 getColumnName  getColumnType  getCatalogName  getColumnClassName  getColumnLabel  getColumnTypeName  getSchemaName  getTableName  getColumnDisplaySize  getPrecision  getScale  isAutoIncrement  isCaseSensitive  isCurrency  isDefinitelyWritable  isNullable  isReadOnly  isSearchable  isSigned  isWritable  
 oid            4              PartsSupplier   java.lang.Integer   oid             integer            pg_catalog     pg_class      11                    10            0         false            false            false       false                 2           true        true          false     false       

Modified: trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_INDEX.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_INDEX.expected	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_INDEX.expected	2011-12-14 22:19:17 UTC (rev 3740)
@@ -4,24 +4,24 @@
 2            2            2            false           false        true                                                                             0                                                                
 3            3            3            false           false        true                                                                             0                                                                
 4            4            4            false           false        true                                                                             0                                                                
-5            5            4            false           false        true                                                                             0                                                                
-6            6            4            false           false        false                                                                            0                                                                
-7            7            4            false           false        false                                                                            0                                                                
-8            8            5            false           false        true                                                                             0                                                                
+5            5            4            false           false        false                                                                            0                                                                
+6            6            5            false           false        true                                                                             0                                                                
+7            7            5            false           false        true                                                                             0                                                                
+8            8            5            false           false        false                                                                            0                                                                
 9            9            5            false           false        false                                                                            0                                                                
-10           10           20           false           false        true                                                                             0                                                                
-11           11           21           false           false        true                                                                             0                                                                
-12           12           23           false           false        true                                                                             0                                                                
-13           13           25           false           false        true                                                                             0                                                                
-14           14           30           false           false        true                                                                             0                                                                
-15           15           30           false           false        true                                                                             0                                                                
-16           16           30           false           false        true                                                                             0                                                                
-17           17           30           false           false        false                                                                            0                                                                
-18           18           30           false           false        false                                                                            0                                                                
-19           19           31           false           false        true                                                                             0                                                                
-20           20           31           false           false        true                                                                             0                                                                
-21           21           31           false           false        false                                                                            0                                                                
-22           22           31           false           false        false                                                                            0                                                                
+10           10           19           false           false        true                                                                             0                                                                
+11           11           19           false           false        true                                                                             0                                                                
+12           12           19           false           false        false                                                                            0                                                                
+13           13           19           false           false        false                                                                            0                                                                
+14           14           20           false           false        true                                                                             0                                                                
+15           15           20           false           false        true                                                                             0                                                                
+16           16           20           false           false        true                                                                             0                                                                
+17           17           20           false           false        false                                                                            0                                                                
+18           18           20           false           false        false                                                                            0                                                                
+19           19           23           false           false        true                                                                             0                                                                
+20           20           24           false           false        true                                                                             0                                                                
+21           21           26           false           false        true                                                                             0                                                                
+22           22           28           false           false        true                                                                             0                                                                
 Row Count : 22
 getColumnName   getColumnType  getCatalogName  getColumnClassName  getColumnLabel  getColumnTypeName  getSchemaName  getTableName  getColumnDisplaySize  getPrecision  getScale  isAutoIncrement  isCaseSensitive  isCurrency  isDefinitelyWritable  isNullable  isReadOnly  isSearchable  isSigned  isWritable  
 oid             4              PartsSupplier   java.lang.Integer   oid             integer            pg_catalog     pg_index      11                    10            0         false            false            false       false                 2           true        true          false     false       

Modified: trunk/test-integration/common/src/test/resources/TestODBCSocketTransport/testSelect.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestODBCSocketTransport/testSelect.expected	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/test-integration/common/src/test/resources/TestODBCSocketTransport/testSelect.expected	2011-12-14 22:19:17 UTC (rev 3740)
@@ -8,8 +8,8 @@
 parts                                                              PartsSupplier                                                      PARTSSUPPLIER.PARTS                                                Table                                                              PARTS                                                              true        true             mmuuid:f6276601-73fe-1edc-a81c-ecf397b10590                        16           <null>                                                             false     false           1          
 parts                                                              PartsSupplier                                                      PARTSSUPPLIER.SHIP_VIA                                             Table                                                              SHIP_VIA                                                           true        true             mmuuid:0f4e9b80-73ff-1edc-a81c-ecf397b10590                        4            <null>                                                             false     false           2          
 parts                                                              PartsSupplier                                                      PARTSSUPPLIER.STATUS                                               Table                                                              STATUS                                                             true        true             mmuuid:1f297200-73ff-1edc-a81c-ecf397b10590                        3            <null>                                                             false     false           3          
-parts                                                              PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER                                             Table                                                              SUPPLIER                                                           true        true             mmuuid:2c371ec0-73ff-1edc-a81c-ecf397b10590                        16           <null>                                                             false     false           5          
-parts                                                              PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER_PARTS                                       Table                                                              SUPPLIER_PARTS                                                     true        true             mmuuid:3deafb00-73ff-1edc-a81c-ecf397b10590                        227          <null>                                                             false     false           4          
+parts                                                              PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER                                             Table                                                              SUPPLIER                                                           true        true             mmuuid:2c371ec0-73ff-1edc-a81c-ecf397b10590                        16           <null>                                                             false     false           4          
+parts                                                              PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER_PARTS                                       Table                                                              SUPPLIER_PARTS                                                     true        true             mmuuid:3deafb00-73ff-1edc-a81c-ecf397b10590                        227          <null>                                                             false     false           5          
 parts                                                              SYS                                                                ProcedureParams                                                    Table                                                              <null>                                                             true        false            mmuuid:a56bd7fe-c87a-411c-8f5d-661975a25626                        -1           <null>                                                             true      false           12         
 parts                                                              SYS                                                                Procedures                                                         Table                                                              <null>                                                             true        false            mmuuid:0bc132a5-9f8d-4a3c-9f5d-98156a98a962                        -1           <null>                                                             true      false           13         
 parts                                                              SYS                                                                Properties                                                         Table                                                              <null>                                                             true        false            mmuuid:7a45e50a-d03f-4548-ba35-761651bbca85                        -1           <null>                                                             true      false           14         
@@ -18,19 +18,19 @@
 parts                                                              SYS                                                                Tables                                                             Table                                                              <null>                                                             true        false            mmuuid:8551b3bd-11cc-4049-9bcf-fe91a0eb7ba7                        -1           <null>                                                             true      false           17         
 parts                                                              SYSADMIN                                                           VDBResources                                                       Table                                                              <null>                                                             true        false            mmuuid:1785804d-beaf-4831-9531-e59164fedd49                        -1           <null>                                                             true      false           7          
 parts                                                              SYS                                                                VirtualDatabases                                                   Table                                                              <null>                                                             true        false            mmuuid:47297c72-d621-4f4e-af4e-74060ac5f489                        -1           <null>                                                             true      false           18         
-parts                                                              pg_catalog                                                         matpg_datatype                                                     Table                                                              <null>                                                             false       false            mmuid:17448311-6679-4dfd-aeb6-4aabbd894729                         -1           <null>                                                             true      true            31         
-parts                                                              pg_catalog                                                         matpg_relatt                                                       Table                                                              <null>                                                             false       false            mmuid:8c0714d6-1c72-40b4-8528-3b2c63059107                         -1           <null>                                                             true      true            30         
-parts                                                              pg_catalog                                                         pg_am                                                              Table                                                              <null>                                                             false       false            mmuid:f6517a63-8c14-4b73-a18d-afaa5dfb35d9                         -1           <null>                                                             true      false           24         
-parts                                                              pg_catalog                                                         pg_attrdef                                                         Table                                                              <null>                                                             false       false            mmuid:76a7dd05-9a7d-4243-b561-f3056500dcaf                         -1           <null>                                                             true      false           27         
-parts                                                              pg_catalog                                                         pg_attribute                                                       Table                                                              <null>                                                             false       false            mmuid:fa463d98-365f-489a-a707-025193cb51eb                         -1           <null>                                                             true      true            21         
-parts                                                              pg_catalog                                                         pg_class                                                           Table                                                              <null>                                                             false       false            mmuid:7e21f2e6-06e3-4bca-9b01-72ea47821560                         -1           <null>                                                             true      true            20         
-parts                                                              pg_catalog                                                         pg_database                                                        Table                                                              <null>                                                             false       false            mmuid:382f9fc9-8c96-4df7-ab5d-04dfb47ee142                         -1           <null>                                                             true      false           28         
-parts                                                              pg_catalog                                                         pg_index                                                           Table                                                              <null>                                                             false       false            mmuid:09daed8d-b0b8-4552-a261-2b6c775b46b0                         -1           <null>                                                             true      true            23         
-parts                                                              pg_catalog                                                         pg_namespace                                                       Table                                                              <null>                                                             false       false            mmuid:6609866a-3d7b-4f4b-95fe-ebfac769d699                         -1           <null>                                                             true      false           19         
-parts                                                              pg_catalog                                                         pg_proc                                                            Table                                                              <null>                                                             false       false            mmuid:f20c9489-10ca-4596-8a37-24218b67f764                         -1           <null>                                                             true      true            25         
-parts                                                              pg_catalog                                                         pg_trigger                                                         Table                                                              <null>                                                             false       false            mmuid:2b75f0b1-7475-4ed5-9da3-d37a8a25f26a                         -1           <null>                                                             true      false           26         
-parts                                                              pg_catalog                                                         pg_type                                                            Table                                                              <null>                                                             false       false            mmuid:9462e3f8-cd3c-414f-a570-f6f33c40e36a                         -1           <null>                                                             true      false           22         
-parts                                                              pg_catalog                                                         pg_user                                                            Table                                                              <null>                                                             false       false            mmuid:e63613cb-01ee-4b37-8b91-99d1aac4dfcb                         -1           <null>                                                             true      false           29         
+parts                                                              pg_catalog                                                         matpg_datatype                                                     Table                                                              <null>                                                             false       false            mmuid:17448311-6679-4dfd-aeb6-4aabbd894729                         -1           <null>                                                             true      true            19         
+parts                                                              pg_catalog                                                         matpg_relatt                                                       Table                                                              <null>                                                             false       false            mmuid:8c0714d6-1c72-40b4-8528-3b2c63059107                         -1           <null>                                                             true      true            20         
+parts                                                              pg_catalog                                                         pg_am                                                              Table                                                              <null>                                                             false       false            mmuid:f6517a63-8c14-4b73-a18d-afaa5dfb35d9                         -1           <null>                                                             true      false           21         
+parts                                                              pg_catalog                                                         pg_attrdef                                                         Table                                                              <null>                                                             false       false            mmuid:76a7dd05-9a7d-4243-b561-f3056500dcaf                         -1           <null>                                                             true      false           22         
+parts                                                              pg_catalog                                                         pg_attribute                                                       Table                                                              <null>                                                             false       false            mmuid:fa463d98-365f-489a-a707-025193cb51eb                         -1           <null>                                                             true      true            23         
+parts                                                              pg_catalog                                                         pg_class                                                           Table                                                              <null>                                                             false       false            mmuid:7e21f2e6-06e3-4bca-9b01-72ea47821560                         -1           <null>                                                             true      true            24         
+parts                                                              pg_catalog                                                         pg_database                                                        Table                                                              <null>                                                             false       false            mmuid:382f9fc9-8c96-4df7-ab5d-04dfb47ee142                         -1           <null>                                                             true      false           25         
+parts                                                              pg_catalog                                                         pg_index                                                           Table                                                              <null>                                                             false       false            mmuid:09daed8d-b0b8-4552-a261-2b6c775b46b0                         -1           <null>                                                             true      true            26         
+parts                                                              pg_catalog                                                         pg_namespace                                                       Table                                                              <null>                                                             false       false            mmuid:6609866a-3d7b-4f4b-95fe-ebfac769d699                         -1           <null>                                                             true      false           27         
+parts                                                              pg_catalog                                                         pg_proc                                                            Table                                                              <null>                                                             false       false            mmuid:f20c9489-10ca-4596-8a37-24218b67f764                         -1           <null>                                                             true      true            28         
+parts                                                              pg_catalog                                                         pg_trigger                                                         Table                                                              <null>                                                             false       false            mmuid:2b75f0b1-7475-4ed5-9da3-d37a8a25f26a                         -1           <null>                                                             true      false           29         
+parts                                                              pg_catalog                                                         pg_type                                                            Table                                                              <null>                                                             false       false            mmuid:9462e3f8-cd3c-414f-a570-f6f33c40e36a                         -1           <null>                                                             true      false           30         
+parts                                                              pg_catalog                                                         pg_user                                                            Table                                                              <null>                                                             false       false            mmuid:e63613cb-01ee-4b37-8b91-99d1aac4dfcb                         -1           <null>                                                             true      false           31         
 Row Count : 31
 getColumnName    getColumnType  getCatalogName  getColumnClassName  getColumnLabel   getColumnTypeName  getSchemaName  getTableName  getColumnDisplaySize  getPrecision  getScale  isAutoIncrement  isCaseSensitive  isCurrency  isDefinitelyWritable  isNullable  isReadOnly  isSearchable  isSigned  isWritable  
 vdbname          12                             java.lang.String    vdbname          varchar                                         2147483647            0             0         false            true             false       false                 1           false       true          false     true        

Modified: trunk/test-integration/common/src/test/resources/TestPartsDatabaseMetadata/testPrimaryKeys.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestPartsDatabaseMetadata/testPrimaryKeys.expected	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/test-integration/common/src/test/resources/TestPartsDatabaseMetadata/testPrimaryKeys.expected	2011-12-14 22:19:17 UTC (rev 3740)
@@ -4,16 +4,16 @@
 PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER_PARTS                                       PART_ID                                                            2        PK_SUPPLIER_PARTS                                                
 PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SHIP_VIA                                             SHIPPER_ID                                                         1        PK_SHIP_VIA                                                      
 PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.STATUS                                               STATUS_ID                                                          1        PK_STATUS                                                        
+PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER                                             SUPPLIER_ID                                                        1        PK_SUPPLIER                                                      
 PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER_PARTS                                       SUPPLIER_ID                                                        1        PK_SUPPLIER_PARTS                                                
-PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER                                             SUPPLIER_ID                                                        1        PK_SUPPLIER                                                      
 PartsSupplier                                                      pg_catalog                                                         matpg_relatt                                                       attname                                                            1        pk_matpg_relatt_names                                            
 PartsSupplier                                                      pg_catalog                                                         matpg_datatype                                                     name                                                               2        matpg_datatype_names                                             
 PartsSupplier                                                      pg_catalog                                                         matpg_relatt                                                       nspname                                                            3        pk_matpg_relatt_names                                            
+PartsSupplier                                                      pg_catalog                                                         matpg_datatype                                                     oid                                                                1        matpg_datatype_names                                             
+PartsSupplier                                                      pg_catalog                                                         pg_attribute                                                       oid                                                                1        pk_pg_attr                                                       
 PartsSupplier                                                      pg_catalog                                                         pg_class                                                           oid                                                                1        pk_pg_class                                                      
-PartsSupplier                                                      pg_catalog                                                         pg_attribute                                                       oid                                                                1        pk_pg_attr                                                       
 PartsSupplier                                                      pg_catalog                                                         pg_index                                                           oid                                                                1        pk_pg_index                                                      
 PartsSupplier                                                      pg_catalog                                                         pg_proc                                                            oid                                                                1        pk_pg_proc                                                       
-PartsSupplier                                                      pg_catalog                                                         matpg_datatype                                                     oid                                                                1        matpg_datatype_names                                             
 PartsSupplier                                                      pg_catalog                                                         matpg_relatt                                                       relname                                                            2        pk_matpg_relatt_names                                            
 Row Count : 15
 getColumnName  getColumnType  getCatalogName  getColumnClassName  getColumnLabel  getColumnTypeName  getSchemaName  getTableName  getColumnDisplaySize  getPrecision  getScale  isAutoIncrement  isCaseSensitive  isCurrency  isDefinitelyWritable  isNullable  isReadOnly  isSearchable  isSigned  isWritable  

Modified: trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testColumns.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testColumns.expected	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testColumns.expected	2011-12-14 22:19:17 UTC (rev 3740)
@@ -79,7 +79,7 @@
 PartsSupplier                                                      SYS                                                                ProcedureParams                                                    Optional                                                           8            <null>                                                             boolean                                                            0            1            true           true            false            false            false     false       false              No Nulls              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  1            1                10           mmuuid:4033f891-5ef5-!
 4a75-8a50-bd1d021e43ad         <null>                                                             107        
 PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.PARTS                                                PART_COLOR                                                         3            PART_COLOR                                                         string                                                             0            30           false          true            true             true             true      false       false              Nullable              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            30               10           mmuuid:015c0d00-73ff-!
 1edc-a81c-ecf397b10590         <null>                                                             3          
 PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.PARTS                                                PART_ID                                                            1            PART_ID                                                            string                                                             0            4            true           true            true             true             true      false       false              No Nulls              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            4                10           mmuuid:fadcd7c0-73fe-!
 1edc-a81c-ecf397b10590         <null>                                                             1          
-PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER_PARTS                                       PART_ID                                                            2            PART_ID                                                            string                                                             0            4            true           true            true             true             true      false       false              No Nulls              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            4                10           mmuuid:3fc400c0-73ff-!
 1edc-a81c-ecf397b10590         <null>                                                             10         
+PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER_PARTS                                       PART_ID                                                            2            PART_ID                                                            string                                                             0            4            true           true            true             true             true      false       false              No Nulls              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            4                10           mmuuid:3fc400c0-73ff-!
 1edc-a81c-ecf397b10590         <null>                                                             15         
 PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.PARTS                                                PART_NAME                                                          2            PART_NAME                                                          string                                                             0            255          false          true            true             true             true      false       false              Nullable              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            255              10           mmuuid:0067e900-73ff-!
 1edc-a81c-ecf397b10590         <null>                                                             2          
 PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.PARTS                                                PART_WEIGHT                                                        4            PART_WEIGHT                                                        string                                                             0            255          false          true            true             true             true      false       false              Nullable              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            255              10           mmuuid:015c0d01-73ff-!
 1edc-a81c-ecf397b10590         <null>                                                             4          
 PartsSupplier                                                      SYS                                                                ReferenceKeyColumns                                                PKCOLUMN_NAME                                                      4            <null>                                                             string                                                             0            255          false          true            true             true             true      false       false              Nullable              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   255          255              10           mmuuid:0125a80a-95f9-!
 486f-aa90-debb21cb5f1b         <null>                                                             132        
@@ -95,7 +95,7 @@
 PartsSupplier                                                      SYS                                                                ProcedureParams                                                    Precision                                                          9            <null>                                                             integer                                                            0            10           true           true            false            false            false     false       false              No Nulls              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  10           10               10           mmuuid:00fe7cad-0a83-!
 42f0-90f2-d6a9584916b2         <null>                                                             108        
 PartsSupplier                                                      SYS                                                                Schemas                                                            PrimaryMetamodelURI                                                6            <null>                                                             string                                                             0            255          false          true            false            false            false     false       false              No Nulls              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   255          255              10           mmuuid:eadfaba5-ce44-!
 4529-816f-6af94666baec         <null>                                                             148        
 PartsSupplier                                                      SYS                                                                ProcedureParams                                                    ProcedureName                                                      3            <null>                                                             string                                                             0            255          true           true            false            true             false     false       false              No Nulls              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   255          255              10           mmuuid:8081b3a6-fc79-!
 42fd-b7c9-a19d682a1658         <null>                                                             102        
-PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER_PARTS                                       QUANTITY                                                           3            QUANTITY                                                           short                                                              0            0            true           true            true             false            true      false       false              Nullable              <null>                                              <null>                                              -1             -1           All Except Like       <null>                                                             <null>                                                             java.lang.Short                                                    3            0                10           mmuuid:3fc400c1-73ff-!
 1edc-a81c-ecf397b10590         <null>                                                             11         
+PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER_PARTS                                       QUANTITY                                                           3            QUANTITY                                                           short                                                              0            0            true           true            true             false            true      false       false              Nullable              <null>                                              <null>                                              -1             -1           All Except Like       <null>                                                             <null>                                                             java.lang.Short                                                    3            0                10           mmuuid:3fc400c1-73ff-!
 1edc-a81c-ecf397b10590         <null>                                                             16         
 PartsSupplier                                                      SYS                                                                Columns                                                            Radix                                                              28           <null>                                                             integer                                                            0            10           true           true            false            false            false     false       false              No Nulls              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  10           10               10           mmuuid:43a6124c-972f-!
 4c4c-af05-24080c2a8ad7         <null>                                                             56         
 PartsSupplier                                                      SYS                                                                DataTypes                                                          Radix                                                              13           <null>                                                             integer                                                            0            10           true           true            false            false            false     false       false              Nullable              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  10           10               10           mmuuid:967ab8fd-3226-!
 4a78-8cf2-2eb7fbf2981a         <null>                                                             72         
 PartsSupplier                                                      SYS                                                                ProcedureParams                                                    Radix                                                              12           <null>                                                             integer                                                            0            10           true           true            false            false            false     false       false              No Nulls              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  10           10               10           mmuuid:8df37c99-3b12-!
 4789-8128-4aa496f895c4         <null>                                                             111        
@@ -104,16 +104,16 @@
 PartsSupplier                                                      SYS                                                                Procedures                                                         ReturnsResults                                                     5            <null>                                                             boolean                                                            0            1            true           true            false            false            false     false       false              No Nulls              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  1            1                10           mmuuid:b01164c8-dd10-!
 410d-a91b-fcb2fc0450ce         <null>                                                             120        
 PartsSupplier                                                      SYS                                                                DataTypes                                                          RuntimeType                                                        16           <null>                                                             string                                                             0            64           true           true            false            true             true      false       false              Nullable              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   64           64               10           mmuuid:3c7bc9d0-b73f-!
 49a0-b9ab-dc97a4d2a124         <null>                                                             75         
 PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SHIP_VIA                                             SHIPPER_ID                                                         1            SHIPPER_ID                                                         short                                                              0            0            true           true            true             false            true      false       false              No Nulls              <null>                                              <null>                                              -1             -1           All Except Like       <null>                                                             <null>                                                             java.lang.Short                                                    2            0                10           mmuuid:121bc540-73ff-!
 1edc-a81c-ecf397b10590         <null>                                                             5          
-PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER_PARTS                                       SHIPPER_ID                                                         4            SHIPPER_ID                                                         short                                                              0            0            true           true            true             false            true      false       false              Nullable              <null>                                              <null>                                              -1             -1           All Except Like       <null>                                                             <null>                                                             java.lang.Short                                                    2            0                10           mmuuid:3fc400c2-73ff-!
 1edc-a81c-ecf397b10590         <null>                                                             12         
+PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER_PARTS                                       SHIPPER_ID                                                         4            SHIPPER_ID                                                         short                                                              0            0            true           true            true             false            true      false       false              Nullable              <null>                                              <null>                                              -1             -1           All Except Like       <null>                                                             <null>                                                             java.lang.Short                                                    2            0                10           mmuuid:3fc400c2-73ff-!
 1edc-a81c-ecf397b10590         <null>                                                             17         
 PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SHIP_VIA                                             SHIPPER_NAME                                                       2            SHIPPER_NAME                                                       string                                                             0            30           false          true            true             true             true      false       false              Nullable              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            30               10           mmuuid:130fe940-73ff-!
 1edc-a81c-ecf397b10590         <null>                                                             6          
 PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.STATUS                                               STATUS_ID                                                          1            STATUS_ID                                                          short                                                              0            0            true           true            true             false            true      false       false              No Nulls              <null>                                              <null>                                              -1             -1           All Except Like       <null>                                                             <null>                                                             java.lang.Short                                                    2            0                10           mmuuid:201d9600-73ff-!
 1edc-a81c-ecf397b10590         <null>                                                             7          
 PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.STATUS                                               STATUS_NAME                                                        2            STATUS_NAME                                                        string                                                             0            30           false          true            true             true             true      false       false              Nullable              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            30               10           mmuuid:201d9601-73ff-!
 1edc-a81c-ecf397b10590         <null>                                                             8          
-PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER                                             SUPPLIER_CITY                                                      4            SUPPLIER_CITY                                                      string                                                             0            30           false          true            true             true             true      false       false              Nullable              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            30               10           mmuuid:2fe92a40-73ff-!
 1edc-a81c-ecf397b10590         <null>                                                             16         
-PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER_PARTS                                       SUPPLIER_ID                                                        1            SUPPLIER_ID                                                        string                                                             0            10           false          true            true             true             true      false       false              No Nulls              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            10               10           mmuuid:3ecfdcc0-73ff-!
 1edc-a81c-ecf397b10590         <null>                                                             9          
-PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER                                             SUPPLIER_ID                                                        1            SUPPLIER_ID                                                        string                                                             0            10           false          true            true             true             true      false       false              No Nulls              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            10               10           mmuuid:2f044880-73ff-!
 1edc-a81c-ecf397b10590         <null>                                                             13         
-PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER                                             SUPPLIER_NAME                                                      2            SUPPLIER_NAME                                                      string                                                             0            30           false          true            true             true             true      false       false              Nullable              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            30               10           mmuuid:2f044881-73ff-!
 1edc-a81c-ecf397b10590         <null>                                                             14         
-PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER                                             SUPPLIER_STATE                                                     5            SUPPLIER_STATE                                                     string                                                             0            2            false          true            true             true             true      false       false              Nullable              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            2                10           mmuuid:2fe92a41-73ff-!
 1edc-a81c-ecf397b10590         <null>                                                             17         
-PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER                                             SUPPLIER_STATUS                                                    3            SUPPLIER_STATUS                                                    short                                                              0            0            true           true            true             false            true      false       false              Nullable              <null>                                              <null>                                              -1             -1           All Except Like       <null>                                                             <null>                                                             java.lang.Short                                                    2            0                10           mmuuid:2f044882-73ff-!
 1edc-a81c-ecf397b10590         <null>                                                             15         
+PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER                                             SUPPLIER_CITY                                                      4            SUPPLIER_CITY                                                      string                                                             0            30           false          true            true             true             true      false       false              Nullable              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            30               10           mmuuid:2fe92a40-73ff-!
 1edc-a81c-ecf397b10590         <null>                                                             12         
+PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER                                             SUPPLIER_ID                                                        1            SUPPLIER_ID                                                        string                                                             0            10           false          true            true             true             true      false       false              No Nulls              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            10               10           mmuuid:2f044880-73ff-!
 1edc-a81c-ecf397b10590         <null>                                                             9          
+PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER_PARTS                                       SUPPLIER_ID                                                        1            SUPPLIER_ID                                                        string                                                             0            10           false          true            true             true             true      false       false              No Nulls              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            10               10           mmuuid:3ecfdcc0-73ff-!
 1edc-a81c-ecf397b10590         <null>                                                             14         
+PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER                                             SUPPLIER_NAME                                                      2            SUPPLIER_NAME                                                      string                                                             0            30           false          true            true             true             true      false       false              Nullable              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            30               10           mmuuid:2f044881-73ff-!
 1edc-a81c-ecf397b10590         <null>                                                             10         
+PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER                                             SUPPLIER_STATE                                                     5            SUPPLIER_STATE                                                     string                                                             0            2            false          true            true             true             true      false       false              Nullable              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            2                10           mmuuid:2fe92a41-73ff-!
 1edc-a81c-ecf397b10590         <null>                                                             13         
+PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER                                             SUPPLIER_STATUS                                                    3            SUPPLIER_STATUS                                                    short                                                              0            0            true           true            true             false            true      false       false              Nullable              <null>                                              <null>                                              -1             -1           All Except Like       <null>                                                             <null>                                                             java.lang.Short                                                    2            0                10           mmuuid:2f044882-73ff-!
 1edc-a81c-ecf397b10590         <null>                                                             11         
 PartsSupplier                                                      SYS                                                                Columns                                                            Scale                                                              8            <null>                                                             integer                                                            0            10           true           true            false            false            false     false       false              No Nulls              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  10           10               10           mmuuid:cc6c6113-8d70-!
 40c8-84c0-94e17c14e22e         <null>                                                             36         
 PartsSupplier                                                      SYS                                                                DataTypes                                                          Scale                                                              6            <null>                                                             integer                                                            0            10           true           true            false            false            false     false       false              Nullable              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             (0)                                                                java.lang.Integer                                                  10           10               10           mmuuid:e8655204-e97a-!
 45cd-909b-1e37731e9546         <null>                                                             65         
 PartsSupplier                                                      SYS                                                                ProcedureParams                                                    Scale                                                              11           <null>                                                             integer                                                            0            10           true           true            true             false            false     false       false              No Nulls              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             (0)                                                                java.lang.Integer                                                  10           10               10           mmuuid:360c8b1d-4b3d-!
 42fd-952c-bf5763cad69e         <null>                                                             110        
@@ -162,96 +162,96 @@
 PartsSupplier                                                      SYSADMIN                                                           MatViews                                                           Valid                                                              6            <null>                                                             boolean                                                            0            0            false          true            false            true             true      false       false              Nullable              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  0            0                10           mmuuid:13098912-bce2-!
 4842-9ea9-b162fcd7383e         <null>                                                             23         
 PartsSupplier                                                      SYS                                                                Properties                                                         Value                                                              2            <null>                                                             string                                                             0            255          true           true            false            true             true      false       false              No Nulls              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   255          255              10           mmuuid:c917257d-06b7-!
 41dd-a6cb-44c0ff0f897e         <null>                                                             125        
 PartsSupplier                                                      SYS                                                                VirtualDatabases                                                   Version                                                            2            <null>                                                             string                                                             0            50           true           true            false            true             false     false       false              No Nulls              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   50           50               10           mmuuid:c876d749-a512-!
 4810-9910-3034ca524c45         <null>                                                             164        
-PartsSupplier                                                      pg_catalog                                                         pg_attrdef                                                         adbin                                                              3            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:e22c521a-e208-4!
 181-9dbd-89f5de7014b9          <null>                                                             226        
-PartsSupplier                                                      pg_catalog                                                         pg_attrdef                                                         adnum                                                              2            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:e9b278d4-49af-4!
 42f-9a5a-b699fe3b102b          <null>                                                             225        
-PartsSupplier                                                      pg_catalog                                                         pg_attrdef                                                         adrelid                                                            1            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:4589389f-4abd-4!
 2a6-818f-ff1f2a085dfb          <null>                                                             224        
-PartsSupplier                                                      pg_catalog                                                         pg_attrdef                                                         adsrc                                                              4            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:492dd834-907f-4!
 29b-aa6e-958ad65204c6          <null>                                                             227        
-PartsSupplier                                                      pg_catalog                                                         pg_am                                                              amname                                                             2            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:da4b747e-7d87-4!
 03a-8309-2cdf1399031b          <null>                                                             204        
-PartsSupplier                                                      pg_catalog                                                         pg_attribute                                                       atthasdef                                                          10           <null>                                                             boolean                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  0            0                0            mmuid:5868e549-4bbe-4!
 79e-bc7e-632c05cc2329          <null>                                                             185        
-PartsSupplier                                                      pg_catalog                                                         pg_attribute                                                       attisdropped                                                       9            <null>                                                             boolean                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  0            0                0            mmuid:7beb42a9-dfe6-4!
 3de-98b6-7e8948b1a666          <null>                                                             184        
-PartsSupplier                                                      pg_catalog                                                         pg_attribute                                                       attlen                                                             5            <null>                                                             short                                                              0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Short                                                    0            0                0            mmuid:d1214249-95cd-4!
 26f-b8f6-4bf68c0504c7          <null>                                                             180        
-PartsSupplier                                                      pg_catalog                                                         pg_attribute                                                       attname                                                            3            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:6064d149-4102-4!
 c2d-9132-582342f25e90          <null>                                                             178        
-PartsSupplier                                                      pg_catalog                                                         matpg_relatt                                                       attname                                                            3            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:5cfb2b62-a912-4!
 bfb-bf4f-51e107fe210c          <null>                                                             243        
-PartsSupplier                                                      pg_catalog                                                         pg_attribute                                                       attnotnull                                                         8            <null>                                                             boolean                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  0            0                0            mmuid:91ce8bde-8570-4!
 867-be17-80acfa9275a6          <null>                                                             183        
-PartsSupplier                                                      pg_catalog                                                         pg_attribute                                                       attnum                                                             6            <null>                                                             short                                                              0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Short                                                    0            0                0            mmuid:141fd911-f2dd-4!
 edd-8f08-ad8a67ffd0fb          <null>                                                             181        
-PartsSupplier                                                      pg_catalog                                                         matpg_relatt                                                       attnum                                                             2            <null>                                                             short                                                              0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Short                                                    0            0                0            mmuid:0b0894ba-e1ea-4!
 eaf-bcd2-ea9ebd05e47d          <null>                                                             242        
-PartsSupplier                                                      pg_catalog                                                         pg_attribute                                                       attrelid                                                           2            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:3be6b5de-2287-4!
 279-93f3-4f5064799118          <null>                                                             177        
-PartsSupplier                                                      pg_catalog                                                         matpg_relatt                                                       attrelid                                                           1            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:5c7bf056-ecc5-4!
 1ea-a122-7a4b1de9908a          <null>                                                             241        
-PartsSupplier                                                      pg_catalog                                                         pg_attribute                                                       atttypid                                                           4            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:99782493-1cce-4!
 e14-9c1b-4de7ce50e2c8          <null>                                                             179        
-PartsSupplier                                                      pg_catalog                                                         pg_attribute                                                       atttypmod                                                          7            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:2e2bae3c-ab93-4!
 9f5-b96c-7a7b9d66782d          <null>                                                             182        
-PartsSupplier                                                      pg_catalog                                                         matpg_relatt                                                       autoinc                                                            6            <null>                                                             boolean                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  0            0                0            mmuid:23454408-0347-4!
 0d2-a3f9-3faa664fb5e9          <null>                                                             246        
+PartsSupplier                                                      pg_catalog                                                         pg_attrdef                                                         adbin                                                              3            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:e22c521a-e208-4!
 181-9dbd-89f5de7014b9          <null>                                                             181        
+PartsSupplier                                                      pg_catalog                                                         pg_attrdef                                                         adnum                                                              2            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:e9b278d4-49af-4!
 42f-9a5a-b699fe3b102b          <null>                                                             180        
+PartsSupplier                                                      pg_catalog                                                         pg_attrdef                                                         adrelid                                                            1            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:4589389f-4abd-4!
 2a6-818f-ff1f2a085dfb          <null>                                                             179        
+PartsSupplier                                                      pg_catalog                                                         pg_attrdef                                                         adsrc                                                              4            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:492dd834-907f-4!
 29b-aa6e-958ad65204c6          <null>                                                             182        
+PartsSupplier                                                      pg_catalog                                                         pg_am                                                              amname                                                             2            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:da4b747e-7d87-4!
 03a-8309-2cdf1399031b          <null>                                                             178        
+PartsSupplier                                                      pg_catalog                                                         pg_attribute                                                       atthasdef                                                          10           <null>                                                             boolean                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  0            0                0            mmuid:5868e549-4bbe-4!
 79e-bc7e-632c05cc2329          <null>                                                             192        
+PartsSupplier                                                      pg_catalog                                                         pg_attribute                                                       attisdropped                                                       9            <null>                                                             boolean                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  0            0                0            mmuid:7beb42a9-dfe6-4!
 3de-98b6-7e8948b1a666          <null>                                                             191        
+PartsSupplier                                                      pg_catalog                                                         pg_attribute                                                       attlen                                                             5            <null>                                                             short                                                              0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Short                                                    0            0                0            mmuid:d1214249-95cd-4!
 26f-b8f6-4bf68c0504c7          <null>                                                             187        
+PartsSupplier                                                      pg_catalog                                                         matpg_relatt                                                       attname                                                            3            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:5cfb2b62-a912-4!
 bfb-bf4f-51e107fe210c          <null>                                                             172        
+PartsSupplier                                                      pg_catalog                                                         pg_attribute                                                       attname                                                            3            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:6064d149-4102-4!
 c2d-9132-582342f25e90          <null>                                                             185        
+PartsSupplier                                                      pg_catalog                                                         pg_attribute                                                       attnotnull                                                         8            <null>                                                             boolean                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  0            0                0            mmuid:91ce8bde-8570-4!
 867-be17-80acfa9275a6          <null>                                                             190        
+PartsSupplier                                                      pg_catalog                                                         matpg_relatt                                                       attnum                                                             2            <null>                                                             short                                                              0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Short                                                    0            0                0            mmuid:0b0894ba-e1ea-4!
 eaf-bcd2-ea9ebd05e47d          <null>                                                             171        
+PartsSupplier                                                      pg_catalog                                                         pg_attribute                                                       attnum                                                             6            <null>                                                             short                                                              0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Short                                                    0            0                0            mmuid:141fd911-f2dd-4!
 edd-8f08-ad8a67ffd0fb          <null>                                                             188        
+PartsSupplier                                                      pg_catalog                                                         matpg_relatt                                                       attrelid                                                           1            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:5c7bf056-ecc5-4!
 1ea-a122-7a4b1de9908a          <null>                                                             170        
+PartsSupplier                                                      pg_catalog                                                         pg_attribute                                                       attrelid                                                           2            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:3be6b5de-2287-4!
 279-93f3-4f5064799118          <null>                                                             184        
+PartsSupplier                                                      pg_catalog                                                         pg_attribute                                                       atttypid                                                           4            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:99782493-1cce-4!
 e14-9c1b-4de7ce50e2c8          <null>                                                             186        
+PartsSupplier                                                      pg_catalog                                                         pg_attribute                                                       atttypmod                                                          7            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:2e2bae3c-ab93-4!
 9f5-b96c-7a7b9d66782d          <null>                                                             189        
+PartsSupplier                                                      pg_catalog                                                         matpg_relatt                                                       autoinc                                                            6            <null>                                                             boolean                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  0            0                0            mmuid:23454408-0347-4!
 0d2-a3f9-3faa664fb5e9          <null>                                                             175        
 PartsSupplier                                                      SYSADMIN                                                           VDBResources                                                       contents                                                           2            <null>                                                             blob                                                               0            0            false          true            false            true             true      false       false              Nullable              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             org.teiid.core.types.BlobType                                      0            0                10           mmuuid:f9421669-3564-!
 451d-9293-96c1e5e72c4f         <null>                                                             28         
-PartsSupplier                                                      pg_catalog                                                         pg_database                                                        datacl                                                             7            <null>                                                             object                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Object                                                   0            0                0            mmuid:8b993c11-de2b-4!
 8bc-beb1-3e44c46811b4          <null>                                                             234        
-PartsSupplier                                                      pg_catalog                                                         pg_database                                                        datallowconn                                                       5            <null>                                                             char                                                               0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Character                                                0            0                0            mmuid:5c9d54b2-433f-4!
 43a-85ce-821f42ed109e          <null>                                                             232        
-PartsSupplier                                                      pg_catalog                                                         pg_database                                                        datconfig                                                          6            <null>                                                             object                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Object                                                   0            0                0            mmuid:4b5beb14-03a0-4!
 652-9d6f-5f8cc74d470c          <null>                                                             233        
-PartsSupplier                                                      pg_catalog                                                         pg_database                                                        datdba                                                             8            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:36db343d-e99a-4!
 27c-a4e2-763a720ce4a4          <null>                                                             235        
-PartsSupplier                                                      pg_catalog                                                         pg_database                                                        datlastsysoid                                                      4            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:c2bdf40c-ec58-4!
 39c-a403-7adf604ceadd          <null>                                                             231        
-PartsSupplier                                                      pg_catalog                                                         pg_database                                                        datname                                                            2            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:1aedd02c-5801-4!
 1e7-accd-da1f257c26e8          <null>                                                             229        
-PartsSupplier                                                      pg_catalog                                                         pg_database                                                        dattablespace                                                      9            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:28d034eb-6f39-4!
 02f-b642-9c9560e57247          <null>                                                             236        
-PartsSupplier                                                      pg_catalog                                                         pg_database                                                        encoding                                                           3            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:3b621b25-171c-4!
 05b-8bf9-635cf93f2273          <null>                                                             230        
-PartsSupplier                                                      pg_catalog                                                         pg_index                                                           indexprs                                                           7            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:1e6dbecd-9a2d-4!
 aef-afbe-665de7acb9d6          <null>                                                             201        
-PartsSupplier                                                      pg_catalog                                                         pg_index                                                           indexrelid                                                         2            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:8709e084-48df-4!
 17d-b3f8-f4e9b7d8802b          <null>                                                             196        
-PartsSupplier                                                      pg_catalog                                                         pg_index                                                           indisclustered                                                     4            <null>                                                             boolean                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  0            0                0            mmuid:9f873e0f-903d-4!
 c9d-8c37-1073b5ec4c67          <null>                                                             198        
-PartsSupplier                                                      pg_catalog                                                         pg_index                                                           indisprimary                                                       6            <null>                                                             boolean                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  0            0                0            mmuid:9ea3b6d2-b27b-4!
 bb1-a99d-b703c3308384          <null>                                                             200        
-PartsSupplier                                                      pg_catalog                                                         pg_index                                                           indisunique                                                        5            <null>                                                             boolean                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  0            0                0            mmuid:a52c714d-dfe9-4!
 06c-906b-fadd53ac4e98          <null>                                                             199        
-PartsSupplier                                                      pg_catalog                                                         pg_index                                                           indkey                                                             8            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:347ec08c-6b41-4!
 1d0-8475-031ce7d99ac0          <null>                                                             202        
-PartsSupplier                                                      pg_catalog                                                         pg_index                                                           indrelid                                                           3            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:16998907-e1dd-4!
 47e-898d-780994d30619          <null>                                                             197        
-PartsSupplier                                                      pg_catalog                                                         matpg_datatype                                                     name                                                               3            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:b4e04928-9a59-4!
 718-a7f1-3a60bcae7449          <null>                                                             250        
-PartsSupplier                                                      pg_catalog                                                         pg_namespace                                                       nspname                                                            2            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:0e513513-b35a-4!
 8be-975d-5dbed6ace7e9          <null>                                                             166        
-PartsSupplier                                                      pg_catalog                                                         matpg_relatt                                                       nspname                                                            5            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:f1998229-2c1a-4!
 7b7-8f46-9dda81446db6          <null>                                                             245        
-PartsSupplier                                                      pg_catalog                                                         pg_namespace                                                       oid                                                                1            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:688e5112-4083-4!
 b67-b42c-62d9a614c59a          <null>                                                             165        
-PartsSupplier                                                      pg_catalog                                                         pg_class                                                           oid                                                                1            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:c1e736ac-c9d4-4!
 026-8904-23c90e6eb1c0          <null>                                                             167        
-PartsSupplier                                                      pg_catalog                                                         pg_attribute                                                       oid                                                                1            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:f735e545-a81c-4!
 ee2-84d0-3ea35d4083a2          <null>                                                             176        
-PartsSupplier                                                      pg_catalog                                                         pg_type                                                            oid                                                                1            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:b6f64d16-b147-4!
 59d-8e84-1bd3048fb900          <null>                                                             186        
-PartsSupplier                                                      pg_catalog                                                         pg_index                                                           oid                                                                1            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:83ae2247-7eec-4!
 59f-b037-ffd3cdca0627          <null>                                                             195        
-PartsSupplier                                                      pg_catalog                                                         pg_am                                                              oid                                                                1            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:3c67619c-7d8f-4!
 378-b7e9-84a0451ea5e5          <null>                                                             203        
-PartsSupplier                                                      pg_catalog                                                         pg_proc                                                            oid                                                                1            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:bdf3ee1e-b5b7-4!
 8ab-b43c-4bbb2c8ae1e2          <null>                                                             205        
-PartsSupplier                                                      pg_catalog                                                         pg_trigger                                                         oid                                                                1            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:635b6634-632c-4!
 3c9-8cc7-bcaa016133e8          <null>                                                             215        
-PartsSupplier                                                      pg_catalog                                                         pg_database                                                        oid                                                                1            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:689cde3b-a631-4!
 f25-94b4-ff2ffe022b0f          <null>                                                             228        
-PartsSupplier                                                      pg_catalog                                                         pg_user                                                            oid                                                                1            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:bb78401d-d10c-4!
 3b1-af84-e4fa6b95db42          <null>                                                             237        
-PartsSupplier                                                      pg_catalog                                                         matpg_datatype                                                     oid                                                                1            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:053375a4-3971-4!
 705-9146-9ecc640022c2          <null>                                                             248        
-PartsSupplier                                                      pg_catalog                                                         pg_proc                                                            proallargtypes                                                     9            <null>                                                             object                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Object                                                   0            0                0            mmuid:a385751f-a31a-4!
 d5d-9197-3fbd390b0251          <null>                                                             213        
-PartsSupplier                                                      pg_catalog                                                         pg_proc                                                            proargmodes                                                        8            <null>                                                             object                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Object                                                   0            0                0            mmuid:bcbed548-176c-4!
 116-a5d6-7638cb0206e1          <null>                                                             212        
-PartsSupplier                                                      pg_catalog                                                         pg_proc                                                            proargnames                                                        7            <null>                                                             object                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Object                                                   0            0                0            mmuid:d9f36bdc-7b25-4!
 af0-b9f5-a96aac6d3094          <null>                                                             211        
-PartsSupplier                                                      pg_catalog                                                         pg_proc                                                            proargtypes                                                        6            <null>                                                             object                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Object                                                   0            0                0            mmuid:ffa4ac73-b549-4!
 70e-931f-dc36330cb8c4          <null>                                                             210        
-PartsSupplier                                                      pg_catalog                                                         pg_proc                                                            proname                                                            2            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:b288b3aa-37f2-4!
 a8e-8b1b-e932a2ce3e25          <null>                                                             206        
-PartsSupplier                                                      pg_catalog                                                         pg_proc                                                            pronamespace                                                       10           <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:e5715456-245f-4!
 846-b90b-01d06d1c3672          <null>                                                             214        
-PartsSupplier                                                      pg_catalog                                                         pg_proc                                                            pronargs                                                           5            <null>                                                             short                                                              0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Short                                                    0            0                0            mmuid:6796c2e7-48a4-4!
 f9f-bc98-d47913e2491c          <null>                                                             209        
-PartsSupplier                                                      pg_catalog                                                         pg_proc                                                            proretset                                                          3            <null>                                                             boolean                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  0            0                0            mmuid:e0244e1d-431c-4!
 1fa-8194-1e357e2b688b          <null>                                                             207        
-PartsSupplier                                                      pg_catalog                                                         pg_proc                                                            prorettype                                                         4            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:9fb5a34a-3a7e-4!
 d38-b7cd-239f28a3504e          <null>                                                             208        
-PartsSupplier                                                      pg_catalog                                                         pg_class                                                           relam                                                              5            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:c2f92b1a-6ba0-4!
 486-8936-f5185d926178          <null>                                                             171        
-PartsSupplier                                                      pg_catalog                                                         pg_class                                                           relhasoids                                                         9            <null>                                                             boolean                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  0            0                0            mmuid:3ac5a14a-1f9e-4!
 55b-8ea1-cf0878774fd7          <null>                                                             175        
-PartsSupplier                                                      pg_catalog                                                         pg_class                                                           relhasrules                                                        8            <null>                                                             boolean                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  0            0                0            mmuid:6c26fd66-2a4a-4!
 ccf-949a-a06a858db7f6          <null>                                                             174        
-PartsSupplier                                                      pg_catalog                                                         pg_class                                                           relkind                                                            4            <null>                                                             char                                                               0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Character                                                0            0                0            mmuid:ef4359eb-6d51-4!
 249-bfea-40bc0f407d10          <null>                                                             170        
-PartsSupplier                                                      pg_catalog                                                         pg_class                                                           relname                                                            2            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:5f9b50fa-8188-4!
 048-93c2-3ad1587915df          <null>                                                             168        
-PartsSupplier                                                      pg_catalog                                                         matpg_relatt                                                       relname                                                            4            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:ffbf69c1-2e34-4!
 764-a9b3-9a1b61bfd4af          <null>                                                             244        
-PartsSupplier                                                      pg_catalog                                                         pg_class                                                           relnamespace                                                       3            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:4591ef08-bff8-4!
 f3b-9de7-420f9c7f9d2b          <null>                                                             169        
-PartsSupplier                                                      pg_catalog                                                         pg_class                                                           relpages                                                           7            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:44dee7d6-b6ae-4!
 4c7-85f2-e87364d8d059          <null>                                                             173        
-PartsSupplier                                                      pg_catalog                                                         pg_class                                                           reltuples                                                          6            <null>                                                             float                                                              0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Float                                                    0            0                0            mmuid:b9ed4b49-5a7b-4!
 ba4-863a-37fd95b2a34c          <null>                                                             172        
+PartsSupplier                                                      pg_catalog                                                         pg_database                                                        datacl                                                             7            <null>                                                             object                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Object                                                   0            0                0            mmuid:8b993c11-de2b-4!
 8bc-beb1-3e44c46811b4          <null>                                                             208        
+PartsSupplier                                                      pg_catalog                                                         pg_database                                                        datallowconn                                                       5            <null>                                                             char                                                               0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Character                                                0            0                0            mmuid:5c9d54b2-433f-4!
 43a-85ce-821f42ed109e          <null>                                                             206        
+PartsSupplier                                                      pg_catalog                                                         pg_database                                                        datconfig                                                          6            <null>                                                             object                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Object                                                   0            0                0            mmuid:4b5beb14-03a0-4!
 652-9d6f-5f8cc74d470c          <null>                                                             207        
+PartsSupplier                                                      pg_catalog                                                         pg_database                                                        datdba                                                             8            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:36db343d-e99a-4!
 27c-a4e2-763a720ce4a4          <null>                                                             209        
+PartsSupplier                                                      pg_catalog                                                         pg_database                                                        datlastsysoid                                                      4            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:c2bdf40c-ec58-4!
 39c-a403-7adf604ceadd          <null>                                                             205        
+PartsSupplier                                                      pg_catalog                                                         pg_database                                                        datname                                                            2            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:1aedd02c-5801-4!
 1e7-accd-da1f257c26e8          <null>                                                             203        
+PartsSupplier                                                      pg_catalog                                                         pg_database                                                        dattablespace                                                      9            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:28d034eb-6f39-4!
 02f-b642-9c9560e57247          <null>                                                             210        
+PartsSupplier                                                      pg_catalog                                                         pg_database                                                        encoding                                                           3            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:3b621b25-171c-4!
 05b-8bf9-635cf93f2273          <null>                                                             204        
+PartsSupplier                                                      pg_catalog                                                         pg_index                                                           indexprs                                                           7            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:1e6dbecd-9a2d-4!
 aef-afbe-665de7acb9d6          <null>                                                             217        
+PartsSupplier                                                      pg_catalog                                                         pg_index                                                           indexrelid                                                         2            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:8709e084-48df-4!
 17d-b3f8-f4e9b7d8802b          <null>                                                             212        
+PartsSupplier                                                      pg_catalog                                                         pg_index                                                           indisclustered                                                     4            <null>                                                             boolean                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  0            0                0            mmuid:9f873e0f-903d-4!
 c9d-8c37-1073b5ec4c67          <null>                                                             214        
+PartsSupplier                                                      pg_catalog                                                         pg_index                                                           indisprimary                                                       6            <null>                                                             boolean                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  0            0                0            mmuid:9ea3b6d2-b27b-4!
 bb1-a99d-b703c3308384          <null>                                                             216        
+PartsSupplier                                                      pg_catalog                                                         pg_index                                                           indisunique                                                        5            <null>                                                             boolean                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  0            0                0            mmuid:a52c714d-dfe9-4!
 06c-906b-fadd53ac4e98          <null>                                                             215        
+PartsSupplier                                                      pg_catalog                                                         pg_index                                                           indkey                                                             8            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:347ec08c-6b41-4!
 1d0-8475-031ce7d99ac0          <null>                                                             218        
+PartsSupplier                                                      pg_catalog                                                         pg_index                                                           indrelid                                                           3            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:16998907-e1dd-4!
 47e-898d-780994d30619          <null>                                                             213        
+PartsSupplier                                                      pg_catalog                                                         matpg_datatype                                                     name                                                               3            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:b4e04928-9a59-4!
 718-a7f1-3a60bcae7449          <null>                                                             167        
+PartsSupplier                                                      pg_catalog                                                         matpg_relatt                                                       nspname                                                            5            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:f1998229-2c1a-4!
 7b7-8f46-9dda81446db6          <null>                                                             174        
+PartsSupplier                                                      pg_catalog                                                         pg_namespace                                                       nspname                                                            2            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:0e513513-b35a-4!
 8be-975d-5dbed6ace7e9          <null>                                                             220        
+PartsSupplier                                                      pg_catalog                                                         matpg_datatype                                                     oid                                                                1            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:053375a4-3971-4!
 705-9146-9ecc640022c2          <null>                                                             165        
+PartsSupplier                                                      pg_catalog                                                         pg_am                                                              oid                                                                1            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:3c67619c-7d8f-4!
 378-b7e9-84a0451ea5e5          <null>                                                             177        
+PartsSupplier                                                      pg_catalog                                                         pg_attribute                                                       oid                                                                1            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:f735e545-a81c-4!
 ee2-84d0-3ea35d4083a2          <null>                                                             183        
+PartsSupplier                                                      pg_catalog                                                         pg_class                                                           oid                                                                1            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:c1e736ac-c9d4-4!
 026-8904-23c90e6eb1c0          <null>                                                             193        
+PartsSupplier                                                      pg_catalog                                                         pg_database                                                        oid                                                                1            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:689cde3b-a631-4!
 f25-94b4-ff2ffe022b0f          <null>                                                             202        
+PartsSupplier                                                      pg_catalog                                                         pg_index                                                           oid                                                                1            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:83ae2247-7eec-4!
 59f-b037-ffd3cdca0627          <null>                                                             211        
+PartsSupplier                                                      pg_catalog                                                         pg_namespace                                                       oid                                                                1            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:688e5112-4083-4!
 b67-b42c-62d9a614c59a          <null>                                                             219        
+PartsSupplier                                                      pg_catalog                                                         pg_proc                                                            oid                                                                1            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:bdf3ee1e-b5b7-4!
 8ab-b43c-4bbb2c8ae1e2          <null>                                                             221        
+PartsSupplier                                                      pg_catalog                                                         pg_trigger                                                         oid                                                                1            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:635b6634-632c-4!
 3c9-8cc7-bcaa016133e8          <null>                                                             231        
+PartsSupplier                                                      pg_catalog                                                         pg_type                                                            oid                                                                1            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:b6f64d16-b147-4!
 59d-8e84-1bd3048fb900          <null>                                                             240        
+PartsSupplier                                                      pg_catalog                                                         pg_user                                                            oid                                                                1            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:bb78401d-d10c-4!
 3b1-af84-e4fa6b95db42          <null>                                                             249        
+PartsSupplier                                                      pg_catalog                                                         pg_proc                                                            proallargtypes                                                     9            <null>                                                             object                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Object                                                   0            0                0            mmuid:a385751f-a31a-4!
 d5d-9197-3fbd390b0251          <null>                                                             229        
+PartsSupplier                                                      pg_catalog                                                         pg_proc                                                            proargmodes                                                        8            <null>                                                             object                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Object                                                   0            0                0            mmuid:bcbed548-176c-4!
 116-a5d6-7638cb0206e1          <null>                                                             228        
+PartsSupplier                                                      pg_catalog                                                         pg_proc                                                            proargnames                                                        7            <null>                                                             object                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Object                                                   0            0                0            mmuid:d9f36bdc-7b25-4!
 af0-b9f5-a96aac6d3094          <null>                                                             227        
+PartsSupplier                                                      pg_catalog                                                         pg_proc                                                            proargtypes                                                        6            <null>                                                             object                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Object                                                   0            0                0            mmuid:ffa4ac73-b549-4!
 70e-931f-dc36330cb8c4          <null>                                                             226        
+PartsSupplier                                                      pg_catalog                                                         pg_proc                                                            proname                                                            2            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:b288b3aa-37f2-4!
 a8e-8b1b-e932a2ce3e25          <null>                                                             222        
+PartsSupplier                                                      pg_catalog                                                         pg_proc                                                            pronamespace                                                       10           <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:e5715456-245f-4!
 846-b90b-01d06d1c3672          <null>                                                             230        
+PartsSupplier                                                      pg_catalog                                                         pg_proc                                                            pronargs                                                           5            <null>                                                             short                                                              0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Short                                                    0            0                0            mmuid:6796c2e7-48a4-4!
 f9f-bc98-d47913e2491c          <null>                                                             225        
+PartsSupplier                                                      pg_catalog                                                         pg_proc                                                            proretset                                                          3            <null>                                                             boolean                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  0            0                0            mmuid:e0244e1d-431c-4!
 1fa-8194-1e357e2b688b          <null>                                                             223        
+PartsSupplier                                                      pg_catalog                                                         pg_proc                                                            prorettype                                                         4            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:9fb5a34a-3a7e-4!
 d38-b7cd-239f28a3504e          <null>                                                             224        
+PartsSupplier                                                      pg_catalog                                                         pg_class                                                           relam                                                              5            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:c2f92b1a-6ba0-4!
 486-8936-f5185d926178          <null>                                                             197        
+PartsSupplier                                                      pg_catalog                                                         pg_class                                                           relhasoids                                                         9            <null>                                                             boolean                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  0            0                0            mmuid:3ac5a14a-1f9e-4!
 55b-8ea1-cf0878774fd7          <null>                                                             201        
+PartsSupplier                                                      pg_catalog                                                         pg_class                                                           relhasrules                                                        8            <null>                                                             boolean                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  0            0                0            mmuid:6c26fd66-2a4a-4!
 ccf-949a-a06a858db7f6          <null>                                                             200        
+PartsSupplier                                                      pg_catalog                                                         pg_class                                                           relkind                                                            4            <null>                                                             char                                                               0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Character                                                0            0                0            mmuid:ef4359eb-6d51-4!
 249-bfea-40bc0f407d10          <null>                                                             196        
+PartsSupplier                                                      pg_catalog                                                         matpg_relatt                                                       relname                                                            4            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:ffbf69c1-2e34-4!
 764-a9b3-9a1b61bfd4af          <null>                                                             173        
+PartsSupplier                                                      pg_catalog                                                         pg_class                                                           relname                                                            2            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:5f9b50fa-8188-4!
 048-93c2-3ad1587915df          <null>                                                             194        
+PartsSupplier                                                      pg_catalog                                                         pg_class                                                           relnamespace                                                       3            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:4591ef08-bff8-4!
 f3b-9de7-420f9c7f9d2b          <null>                                                             195        
+PartsSupplier                                                      pg_catalog                                                         pg_class                                                           relpages                                                           7            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:44dee7d6-b6ae-4!
 4c7-85f2-e87364d8d059          <null>                                                             199        
+PartsSupplier                                                      pg_catalog                                                         pg_class                                                           reltuples                                                          6            <null>                                                             float                                                              0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Float                                                    0            0                0            mmuid:b9ed4b49-5a7b-4!
 ba4-863a-37fd95b2a34c          <null>                                                             198        
 PartsSupplier                                                      SYSADMIN                                                           VDBResources                                                       resourcePath                                                       1            <null>                                                             string                                                             0            255          false          true            false            true             true      false       false              Nullable              <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            255              10           mmuuid:b1bc5150-3dcc-!
 452e-9e75-4a506997f612         <null>                                                             27         
-PartsSupplier                                                      pg_catalog                                                         pg_trigger                                                         tgargs                                                             4            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:0c20dbe7-5d89-4!
 11f-a8ab-3d77b999595b          <null>                                                             218        
-PartsSupplier                                                      pg_catalog                                                         pg_trigger                                                         tgconstrname                                                       8            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:c010d12f-2074-4!
 5db-8e18-979cee2c45da          <null>                                                             222        
-PartsSupplier                                                      pg_catalog                                                         pg_trigger                                                         tgconstrrelid                                                      2            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:64977f3e-f2a0-4!
 66e-a5d1-80bb058cbe08          <null>                                                             216        
-PartsSupplier                                                      pg_catalog                                                         pg_trigger                                                         tgdeferrable                                                       6            <null>                                                             boolean                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  0            0                0            mmuid:bfbff036-caf2-4!
 652-80cf-398af17ed7d1          <null>                                                             220        
-PartsSupplier                                                      pg_catalog                                                         pg_trigger                                                         tgfoid                                                             3            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:250d7c06-728a-4!
 b2a-b557-91f2a69bb184          <null>                                                             217        
-PartsSupplier                                                      pg_catalog                                                         pg_trigger                                                         tginitdeferred                                                     7            <null>                                                             boolean                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  0            0                0            mmuid:da4b59ca-ebff-4!
 5a8-ad68-9777bc587813          <null>                                                             221        
-PartsSupplier                                                      pg_catalog                                                         pg_trigger                                                         tgnargs                                                            5            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:d70f020b-658c-4!
 f58-86dc-0fbb12e2d8af          <null>                                                             219        
-PartsSupplier                                                      pg_catalog                                                         pg_trigger                                                         tgrelid                                                            9            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:71091853-c65e-4!
 6a9-9947-aa024f806e2d          <null>                                                             223        
-PartsSupplier                                                      pg_catalog                                                         pg_type                                                            typbasetype                                                        6            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:a17d2f61-cd68-4!
 c0d-8d25-132f68eb3b67          <null>                                                             191        
-PartsSupplier                                                      pg_catalog                                                         pg_type                                                            typelem                                                            9            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:22ac431d-e6e6-4!
 eef-9d74-b31795424e97          <null>                                                             194        
-PartsSupplier                                                      pg_catalog                                                         pg_type                                                            typlen                                                             4            <null>                                                             short                                                              0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Short                                                    0            0                0            mmuid:931c09e1-937a-4!
 37e-aab2-2360f8d90e2b          <null>                                                             189        
-PartsSupplier                                                      pg_catalog                                                         matpg_datatype                                                     typlen                                                             5            <null>                                                             short                                                              0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Short                                                    0            0                0            mmuid:0e9c4439-48d0-4!
 115-a343-5baab7a236b6          <null>                                                             252        
-PartsSupplier                                                      pg_catalog                                                         pg_type                                                            typname                                                            2            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:d600d818-2aad-4!
 c92-9343-267d044dd97d          <null>                                                             187        
-PartsSupplier                                                      pg_catalog                                                         matpg_datatype                                                     typname                                                            2            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:0f312b3c-98ca-4!
 a09-81fa-f1ff83f0a6c1          <null>                                                             249        
-PartsSupplier                                                      pg_catalog                                                         pg_type                                                            typnamespace                                                       3            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:e47217d2-2b07-4!
 353-bfbd-d7c883a5e7e0          <null>                                                             188        
-PartsSupplier                                                      pg_catalog                                                         matpg_relatt                                                       typoid                                                             7            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:595a823f-cec1-4!
 2dc-b8b2-c95c8b4e4e66          <null>                                                             247        
-PartsSupplier                                                      pg_catalog                                                         pg_type                                                            typrelid                                                           8            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:bec25882-b292-4!
 ed1-a610-cad5d504837d          <null>                                                             193        
-PartsSupplier                                                      pg_catalog                                                         pg_type                                                            typtype                                                            5            <null>                                                             char                                                               0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Character                                                0            0                0            mmuid:83199eba-7af4-4!
 4a9-822f-006677b1b895          <null>                                                             190        
-PartsSupplier                                                      pg_catalog                                                         pg_type                                                            typtypmod                                                          7            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:cee3559d-1ce6-4!
 b17-ad57-2ecb79a9e1d2          <null>                                                             192        
-PartsSupplier                                                      pg_catalog                                                         matpg_datatype                                                     uid                                                                4            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:87826ebc-98a5-4!
 f19-a6d8-6b7b96cbed48          <null>                                                             251        
-PartsSupplier                                                      pg_catalog                                                         pg_user                                                            usecreatedb                                                        3            <null>                                                             boolean                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  0            0                0            mmuid:6da98878-b46e-4!
 ed1-b032-1bc72da595f4          <null>                                                             239        
-PartsSupplier                                                      pg_catalog                                                         pg_user                                                            usename                                                            2            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:236445e1-408c-4!
 0a1-a61c-40e96fb5dc9f          <null>                                                             238        
-PartsSupplier                                                      pg_catalog                                                         pg_user                                                            usesuper                                                           4            <null>                                                             boolean                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  0            0                0            mmuid:9bfddc66-af75-4!
 366-8eac-b9fef3421219          <null>                                                             240        
+PartsSupplier                                                      pg_catalog                                                         pg_trigger                                                         tgargs                                                             4            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:0c20dbe7-5d89-4!
 11f-a8ab-3d77b999595b          <null>                                                             234        
+PartsSupplier                                                      pg_catalog                                                         pg_trigger                                                         tgconstrname                                                       8            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:c010d12f-2074-4!
 5db-8e18-979cee2c45da          <null>                                                             238        
+PartsSupplier                                                      pg_catalog                                                         pg_trigger                                                         tgconstrrelid                                                      2            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:64977f3e-f2a0-4!
 66e-a5d1-80bb058cbe08          <null>                                                             232        
+PartsSupplier                                                      pg_catalog                                                         pg_trigger                                                         tgdeferrable                                                       6            <null>                                                             boolean                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  0            0                0            mmuid:bfbff036-caf2-4!
 652-80cf-398af17ed7d1          <null>                                                             236        
+PartsSupplier                                                      pg_catalog                                                         pg_trigger                                                         tgfoid                                                             3            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:250d7c06-728a-4!
 b2a-b557-91f2a69bb184          <null>                                                             233        
+PartsSupplier                                                      pg_catalog                                                         pg_trigger                                                         tginitdeferred                                                     7            <null>                                                             boolean                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  0            0                0            mmuid:da4b59ca-ebff-4!
 5a8-ad68-9777bc587813          <null>                                                             237        
+PartsSupplier                                                      pg_catalog                                                         pg_trigger                                                         tgnargs                                                            5            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:d70f020b-658c-4!
 f58-86dc-0fbb12e2d8af          <null>                                                             235        
+PartsSupplier                                                      pg_catalog                                                         pg_trigger                                                         tgrelid                                                            9            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:71091853-c65e-4!
 6a9-9947-aa024f806e2d          <null>                                                             239        
+PartsSupplier                                                      pg_catalog                                                         pg_type                                                            typbasetype                                                        6            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:a17d2f61-cd68-4!
 c0d-8d25-132f68eb3b67          <null>                                                             245        
+PartsSupplier                                                      pg_catalog                                                         pg_type                                                            typelem                                                            9            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:22ac431d-e6e6-4!
 eef-9d74-b31795424e97          <null>                                                             248        
+PartsSupplier                                                      pg_catalog                                                         matpg_datatype                                                     typlen                                                             5            <null>                                                             short                                                              0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Short                                                    0            0                0            mmuid:0e9c4439-48d0-4!
 115-a343-5baab7a236b6          <null>                                                             169        
+PartsSupplier                                                      pg_catalog                                                         pg_type                                                            typlen                                                             4            <null>                                                             short                                                              0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Short                                                    0            0                0            mmuid:931c09e1-937a-4!
 37e-aab2-2360f8d90e2b          <null>                                                             243        
+PartsSupplier                                                      pg_catalog                                                         matpg_datatype                                                     typname                                                            2            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:0f312b3c-98ca-4!
 a09-81fa-f1ff83f0a6c1          <null>                                                             166        
+PartsSupplier                                                      pg_catalog                                                         pg_type                                                            typname                                                            2            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:d600d818-2aad-4!
 c92-9343-267d044dd97d          <null>                                                             241        
+PartsSupplier                                                      pg_catalog                                                         pg_type                                                            typnamespace                                                       3            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:e47217d2-2b07-4!
 353-bfbd-d7c883a5e7e0          <null>                                                             242        
+PartsSupplier                                                      pg_catalog                                                         matpg_relatt                                                       typoid                                                             7            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:595a823f-cec1-4!
 2dc-b8b2-c95c8b4e4e66          <null>                                                             176        
+PartsSupplier                                                      pg_catalog                                                         pg_type                                                            typrelid                                                           8            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:bec25882-b292-4!
 ed1-a610-cad5d504837d          <null>                                                             247        
+PartsSupplier                                                      pg_catalog                                                         pg_type                                                            typtype                                                            5            <null>                                                             char                                                               0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Character                                                0            0                0            mmuid:83199eba-7af4-4!
 4a9-822f-006677b1b895          <null>                                                             244        
+PartsSupplier                                                      pg_catalog                                                         pg_type                                                            typtypmod                                                          7            <null>                                                             integer                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Integer                                                  0            0                0            mmuid:cee3559d-1ce6-4!
 b17-ad57-2ecb79a9e1d2          <null>                                                             246        
+PartsSupplier                                                      pg_catalog                                                         matpg_datatype                                                     uid                                                                4            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:87826ebc-98a5-4!
 f19-a6d8-6b7b96cbed48          <null>                                                             168        
+PartsSupplier                                                      pg_catalog                                                         pg_user                                                            usecreatedb                                                        3            <null>                                                             boolean                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  0            0                0            mmuid:6da98878-b46e-4!
 ed1-b032-1bc72da595f4          <null>                                                             251        
+PartsSupplier                                                      pg_catalog                                                         pg_user                                                            usename                                                            2            <null>                                                             string                                                             0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.String                                                   0            0                0            mmuid:236445e1-408c-4!
 0a1-a61c-40e96fb5dc9f          <null>                                                             250        
+PartsSupplier                                                      pg_catalog                                                         pg_user                                                            usesuper                                                           4            <null>                                                             boolean                                                            0            0            false          true            false            false            false     false       false              Unknown               <null>                                              <null>                                              -1             -1           Searchable            <null>                                                             <null>                                                             java.lang.Boolean                                                  0            0                0            mmuid:9bfddc66-af75-4!
 366-8eac-b9fef3421219          <null>                                                             252        
 Row Count : 252
 getColumnName      getColumnType  getCatalogName  getColumnClassName  getColumnLabel     getColumnTypeName  getSchemaName  getTableName  getColumnDisplaySize  getPrecision  getScale  isAutoIncrement  isCaseSensitive  isCurrency  isDefinitelyWritable  isNullable  isReadOnly  isSearchable  isSigned  isWritable  
 VDBName            12             PartsSupplier   java.lang.String    VDBName            string             SYS            Columns       255                   255           0         false            false            false       false                 0           true        true          false     false       

Modified: trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testKeyColumns.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testKeyColumns.expected	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testKeyColumns.expected	2011-12-14 22:19:17 UTC (rev 3740)
@@ -1,27 +1,27 @@
 string                                                             string                                                             string                                                             string                                                             string                                                             string                string                                              string                                              integer      integer    
 VDBName                                                            SchemaName                                                         TableName                                                          Name                                                               KeyName                                                            KeyType               RefKeyUID                                           UID                                                 Position     OID        
-PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER_PARTS                                       PART_ID                                                            FK_SPLIER_PRTS_PRTS                                                Foreign               mmuuid:07db4240-73ff-1edc-a81c-ecf397b10590         mmuuid:66ddc4c0-73ff-1edc-a81c-ecf397b10590         1            6          
+PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER_PARTS                                       PART_ID                                                            FK_SPLIER_PRTS_PRTS                                                Foreign               mmuuid:07db4240-73ff-1edc-a81c-ecf397b10590         mmuuid:66ddc4c0-73ff-1edc-a81c-ecf397b10590         1            8          
 PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.PARTS                                                PART_ID                                                            PK_PARTS                                                           Primary               <null>                                              mmuuid:07db4240-73ff-1edc-a81c-ecf397b10590         1            1          
-PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER_PARTS                                       PART_ID                                                            PK_SUPPLIER_PARTS                                                  Primary               <null>                                              mmuuid:455e5440-73ff-1edc-a81c-ecf397b10590         2            5          
+PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER_PARTS                                       PART_ID                                                            PK_SUPPLIER_PARTS                                                  Primary               <null>                                              mmuuid:455e5440-73ff-1edc-a81c-ecf397b10590         2            7          
 PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SHIP_VIA                                             SHIPPER_ID                                                         PK_SHIP_VIA                                                        Primary               <null>                                              mmuuid:18aa3cc0-73ff-1edc-a81c-ecf397b10590         1            2          
 PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.STATUS                                               STATUS_ID                                                          PK_STATUS                                                          Primary               <null>                                              mmuuid:25a8a740-73ff-1edc-a81c-ecf397b10590         1            3          
-PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER_PARTS                                       SUPPLIER_ID                                                        FK_SPLY_PRTS_SPLY                                                  Foreign               mmuuid:375c8380-73ff-1edc-a81c-ecf397b10590         mmuuid:66ddc4c1-73ff-1edc-a81c-ecf397b10590         1            7          
-PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER                                             SUPPLIER_ID                                                        PK_SUPPLIER                                                        Primary               <null>                                              mmuuid:375c8380-73ff-1edc-a81c-ecf397b10590         1            8          
-PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER_PARTS                                       SUPPLIER_ID                                                        PK_SUPPLIER_PARTS                                                  Primary               <null>                                              mmuuid:455e5440-73ff-1edc-a81c-ecf397b10590         1            4          
-PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER                                             SUPPLIER_STATUS                                                    FK_SPLIER_STATS                                                    Foreign               mmuuid:25a8a740-73ff-1edc-a81c-ecf397b10590         mmuuid:5ac43c00-73ff-1edc-a81c-ecf397b10590         1            9          
+PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER_PARTS                                       SUPPLIER_ID                                                        FK_SPLY_PRTS_SPLY                                                  Foreign               mmuuid:375c8380-73ff-1edc-a81c-ecf397b10590         mmuuid:66ddc4c1-73ff-1edc-a81c-ecf397b10590         1            9          
+PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER                                             SUPPLIER_ID                                                        PK_SUPPLIER                                                        Primary               <null>                                              mmuuid:375c8380-73ff-1edc-a81c-ecf397b10590         1            4          
+PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER_PARTS                                       SUPPLIER_ID                                                        PK_SUPPLIER_PARTS                                                  Primary               <null>                                              mmuuid:455e5440-73ff-1edc-a81c-ecf397b10590         1            6          
+PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER                                             SUPPLIER_STATUS                                                    FK_SPLIER_STATS                                                    Foreign               mmuuid:25a8a740-73ff-1edc-a81c-ecf397b10590         mmuuid:5ac43c00-73ff-1edc-a81c-ecf397b10590         1            5          
 PartsSupplier                                                      pg_catalog                                                         matpg_relatt                                                       attname                                                            pk_matpg_relatt_names                                              Primary               <null>                                              mmuid:559efade-b320-49bd-8524-1d325ae11c82          1            14         
 PartsSupplier                                                      pg_catalog                                                         matpg_relatt                                                       attnum                                                             idx_matpg_relatt_ids                                               Index                 <null>                                              mmuid:349f0c8c-7c64-4e0a-a84a-aee3deaf83af          2            18         
 PartsSupplier                                                      pg_catalog                                                         matpg_relatt                                                       attrelid                                                           idx_matpg_relatt_ids                                               Index                 <null>                                              mmuid:349f0c8c-7c64-4e0a-a84a-aee3deaf83af          1            17         
-PartsSupplier                                                      pg_catalog                                                         matpg_datatype                                                     name                                                               matpg_datatype_names                                               Primary               <null>                                              mmuid:eda814fb-0a5a-4fbf-87bc-b57952292038          2            20         
+PartsSupplier                                                      pg_catalog                                                         matpg_datatype                                                     name                                                               matpg_datatype_names                                               Primary               <null>                                              mmuid:eda814fb-0a5a-4fbf-87bc-b57952292038          2            11         
 PartsSupplier                                                      pg_catalog                                                         matpg_relatt                                                       nspname                                                            pk_matpg_relatt_names                                              Primary               <null>                                              mmuid:559efade-b320-49bd-8524-1d325ae11c82          3            16         
-PartsSupplier                                                      pg_catalog                                                         matpg_datatype                                                     oid                                                                matpg_datatype_ids                                                 Index                 <null>                                              mmuid:443a2ab3-8257-4c4c-838e-9a47deaf4cf9          2            22         
-PartsSupplier                                                      pg_catalog                                                         matpg_datatype                                                     oid                                                                matpg_datatype_names                                               Primary               <null>                                              mmuid:eda814fb-0a5a-4fbf-87bc-b57952292038          1            19         
-PartsSupplier                                                      pg_catalog                                                         pg_attribute                                                       oid                                                                pk_pg_attr                                                         Primary               <null>                                              mmuid:649c1635-60ad-4c28-9b20-035c562bb1be          1            11         
-PartsSupplier                                                      pg_catalog                                                         pg_class                                                           oid                                                                pk_pg_class                                                        Primary               <null>                                              mmuid:59f7dc95-95fe-4d90-9813-1a097188e768          1            10         
-PartsSupplier                                                      pg_catalog                                                         pg_index                                                           oid                                                                pk_pg_index                                                        Primary               <null>                                              mmuid:1462b28e-0bab-436f-9654-013821506337          1            12         
-PartsSupplier                                                      pg_catalog                                                         pg_proc                                                            oid                                                                pk_pg_proc                                                         Primary               <null>                                              mmuid:9569efdb-21b2-4b4f-a2db-e7406267b8ed          1            13         
+PartsSupplier                                                      pg_catalog                                                         matpg_datatype                                                     oid                                                                matpg_datatype_ids                                                 Index                 <null>                                              mmuid:443a2ab3-8257-4c4c-838e-9a47deaf4cf9          2            13         
+PartsSupplier                                                      pg_catalog                                                         matpg_datatype                                                     oid                                                                matpg_datatype_names                                               Primary               <null>                                              mmuid:eda814fb-0a5a-4fbf-87bc-b57952292038          1            10         
+PartsSupplier                                                      pg_catalog                                                         pg_attribute                                                       oid                                                                pk_pg_attr                                                         Primary               <null>                                              mmuid:649c1635-60ad-4c28-9b20-035c562bb1be          1            19         
+PartsSupplier                                                      pg_catalog                                                         pg_class                                                           oid                                                                pk_pg_class                                                        Primary               <null>                                              mmuid:59f7dc95-95fe-4d90-9813-1a097188e768          1            20         
+PartsSupplier                                                      pg_catalog                                                         pg_index                                                           oid                                                                pk_pg_index                                                        Primary               <null>                                              mmuid:1462b28e-0bab-436f-9654-013821506337          1            21         
+PartsSupplier                                                      pg_catalog                                                         pg_proc                                                            oid                                                                pk_pg_proc                                                         Primary               <null>                                              mmuid:9569efdb-21b2-4b4f-a2db-e7406267b8ed          1            22         
 PartsSupplier                                                      pg_catalog                                                         matpg_relatt                                                       relname                                                            pk_matpg_relatt_names                                              Primary               <null>                                              mmuid:559efade-b320-49bd-8524-1d325ae11c82          2            15         
-PartsSupplier                                                      pg_catalog                                                         matpg_datatype                                                     typname                                                            matpg_datatype_ids                                                 Index                 <null>                                              mmuid:443a2ab3-8257-4c4c-838e-9a47deaf4cf9          1            21         
+PartsSupplier                                                      pg_catalog                                                         matpg_datatype                                                     typname                                                            matpg_datatype_ids                                                 Index                 <null>                                              mmuid:443a2ab3-8257-4c4c-838e-9a47deaf4cf9          1            12         
 Row Count : 22
 getColumnName  getColumnType  getCatalogName  getColumnClassName  getColumnLabel  getColumnTypeName  getSchemaName  getTableName  getColumnDisplaySize  getPrecision  getScale  isAutoIncrement  isCaseSensitive  isCurrency  isDefinitelyWritable  isNullable  isReadOnly  isSearchable  isSigned  isWritable  
 VDBName        12             PartsSupplier   java.lang.String    VDBName         string             SYS            KeyColumns    255                   255           0         false            false            false       false                 0           true        true          false     false       

Modified: trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testKeys.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testKeys.expected	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testKeys.expected	2011-12-14 22:19:17 UTC (rev 3740)
@@ -1,21 +1,21 @@
 string                                                             string                                                             string                                                             string                                                             string                                                             string                                                             string                boolean    string                                              string                                              integer    
 VDBName                                                            SchemaName                                                         TableName                                                          Name                                                               Description                                                        NameInSource                                                       Type                  IsIndexed  RefKeyUID                                           UID                                                 OID        
-PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER_PARTS                                       FK_SPLIER_PRTS_PRTS                                                <null>                                                             FK_SPLIER_PRTS_PRTS                                                Foreign               false      mmuuid:07db4240-73ff-1edc-a81c-ecf397b10590         mmuuid:66ddc4c0-73ff-1edc-a81c-ecf397b10590         5          
-PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER                                             FK_SPLIER_STATS                                                    <null>                                                             FK_SPLIER_STATS                                                    Foreign               false      mmuuid:25a8a740-73ff-1edc-a81c-ecf397b10590         mmuuid:5ac43c00-73ff-1edc-a81c-ecf397b10590         8          
-PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER_PARTS                                       FK_SPLY_PRTS_SPLY                                                  <null>                                                             FK_SPLY_PRTS_SPLY                                                  Foreign               false      mmuuid:375c8380-73ff-1edc-a81c-ecf397b10590         mmuuid:66ddc4c1-73ff-1edc-a81c-ecf397b10590         6          
+PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER_PARTS                                       FK_SPLIER_PRTS_PRTS                                                <null>                                                             FK_SPLIER_PRTS_PRTS                                                Foreign               false      mmuuid:07db4240-73ff-1edc-a81c-ecf397b10590         mmuuid:66ddc4c0-73ff-1edc-a81c-ecf397b10590         7          
+PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER                                             FK_SPLIER_STATS                                                    <null>                                                             FK_SPLIER_STATS                                                    Foreign               false      mmuuid:25a8a740-73ff-1edc-a81c-ecf397b10590         mmuuid:5ac43c00-73ff-1edc-a81c-ecf397b10590         5          
+PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER_PARTS                                       FK_SPLY_PRTS_SPLY                                                  <null>                                                             FK_SPLY_PRTS_SPLY                                                  Foreign               false      mmuuid:375c8380-73ff-1edc-a81c-ecf397b10590         mmuuid:66ddc4c1-73ff-1edc-a81c-ecf397b10590         8          
 PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.PARTS                                                PK_PARTS                                                           <null>                                                             <null>                                                             Primary               false      <null>                                              mmuuid:07db4240-73ff-1edc-a81c-ecf397b10590         1          
 PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SHIP_VIA                                             PK_SHIP_VIA                                                        <null>                                                             <null>                                                             Primary               false      <null>                                              mmuuid:18aa3cc0-73ff-1edc-a81c-ecf397b10590         2          
 PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.STATUS                                               PK_STATUS                                                          <null>                                                             <null>                                                             Primary               false      <null>                                              mmuuid:25a8a740-73ff-1edc-a81c-ecf397b10590         3          
-PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER                                             PK_SUPPLIER                                                        <null>                                                             <null>                                                             Primary               false      <null>                                              mmuuid:375c8380-73ff-1edc-a81c-ecf397b10590         7          
-PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER_PARTS                                       PK_SUPPLIER_PARTS                                                  <null>                                                             <null>                                                             Primary               false      <null>                                              mmuuid:455e5440-73ff-1edc-a81c-ecf397b10590         4          
-PartsSupplier                                                      pg_catalog                                                         matpg_relatt                                                       idx_matpg_relatt_ids                                               <null>                                                             <null>                                                             Index                 false      <null>                                              mmuid:349f0c8c-7c64-4e0a-a84a-aee3deaf83af          14         
-PartsSupplier                                                      pg_catalog                                                         matpg_datatype                                                     matpg_datatype_ids                                                 <null>                                                             <null>                                                             Index                 false      <null>                                              mmuid:443a2ab3-8257-4c4c-838e-9a47deaf4cf9          16         
-PartsSupplier                                                      pg_catalog                                                         matpg_datatype                                                     matpg_datatype_names                                               <null>                                                             <null>                                                             Primary               false      <null>                                              mmuid:eda814fb-0a5a-4fbf-87bc-b57952292038          15         
-PartsSupplier                                                      pg_catalog                                                         matpg_relatt                                                       pk_matpg_relatt_names                                              <null>                                                             <null>                                                             Primary               false      <null>                                              mmuid:559efade-b320-49bd-8524-1d325ae11c82          13         
-PartsSupplier                                                      pg_catalog                                                         pg_attribute                                                       pk_pg_attr                                                         <null>                                                             <null>                                                             Primary               false      <null>                                              mmuid:649c1635-60ad-4c28-9b20-035c562bb1be          10         
-PartsSupplier                                                      pg_catalog                                                         pg_class                                                           pk_pg_class                                                        <null>                                                             <null>                                                             Primary               false      <null>                                              mmuid:59f7dc95-95fe-4d90-9813-1a097188e768          9          
-PartsSupplier                                                      pg_catalog                                                         pg_index                                                           pk_pg_index                                                        <null>                                                             <null>                                                             Primary               false      <null>                                              mmuid:1462b28e-0bab-436f-9654-013821506337          11         
-PartsSupplier                                                      pg_catalog                                                         pg_proc                                                            pk_pg_proc                                                         <null>                                                             <null>                                                             Primary               false      <null>                                              mmuid:9569efdb-21b2-4b4f-a2db-e7406267b8ed          12         
+PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER                                             PK_SUPPLIER                                                        <null>                                                             <null>                                                             Primary               false      <null>                                              mmuuid:375c8380-73ff-1edc-a81c-ecf397b10590         4          
+PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER_PARTS                                       PK_SUPPLIER_PARTS                                                  <null>                                                             <null>                                                             Primary               false      <null>                                              mmuuid:455e5440-73ff-1edc-a81c-ecf397b10590         6          
+PartsSupplier                                                      pg_catalog                                                         matpg_relatt                                                       idx_matpg_relatt_ids                                               <null>                                                             <null>                                                             Index                 false      <null>                                              mmuid:349f0c8c-7c64-4e0a-a84a-aee3deaf83af          12         
+PartsSupplier                                                      pg_catalog                                                         matpg_datatype                                                     matpg_datatype_ids                                                 <null>                                                             <null>                                                             Index                 false      <null>                                              mmuid:443a2ab3-8257-4c4c-838e-9a47deaf4cf9          10         
+PartsSupplier                                                      pg_catalog                                                         matpg_datatype                                                     matpg_datatype_names                                               <null>                                                             <null>                                                             Primary               false      <null>                                              mmuid:eda814fb-0a5a-4fbf-87bc-b57952292038          9          
+PartsSupplier                                                      pg_catalog                                                         matpg_relatt                                                       pk_matpg_relatt_names                                              <null>                                                             <null>                                                             Primary               false      <null>                                              mmuid:559efade-b320-49bd-8524-1d325ae11c82          11         
+PartsSupplier                                                      pg_catalog                                                         pg_attribute                                                       pk_pg_attr                                                         <null>                                                             <null>                                                             Primary               false      <null>                                              mmuid:649c1635-60ad-4c28-9b20-035c562bb1be          13         
+PartsSupplier                                                      pg_catalog                                                         pg_class                                                           pk_pg_class                                                        <null>                                                             <null>                                                             Primary               false      <null>                                              mmuid:59f7dc95-95fe-4d90-9813-1a097188e768          14         
+PartsSupplier                                                      pg_catalog                                                         pg_index                                                           pk_pg_index                                                        <null>                                                             <null>                                                             Primary               false      <null>                                              mmuid:1462b28e-0bab-436f-9654-013821506337          15         
+PartsSupplier                                                      pg_catalog                                                         pg_proc                                                            pk_pg_proc                                                         <null>                                                             <null>                                                             Primary               false      <null>                                              mmuid:9569efdb-21b2-4b4f-a2db-e7406267b8ed          16         
 Row Count : 16
 getColumnName  getColumnType  getCatalogName  getColumnClassName  getColumnLabel  getColumnTypeName  getSchemaName  getTableName  getColumnDisplaySize  getPrecision  getScale  isAutoIncrement  isCaseSensitive  isCurrency  isDefinitelyWritable  isNullable  isReadOnly  isSearchable  isSigned  isWritable  
 VDBName        12             PartsSupplier   java.lang.String    VDBName         string             SYS            Keys          255                   255           0         false            false            false       false                 0           true        true          false     false       

Modified: trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testProcedureParams.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testProcedureParams.expected	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testProcedureParams.expected	2011-12-14 22:19:17 UTC (rev 3740)
@@ -1,15 +1,15 @@
 string                                                             string                                                             string                                                             string                                                             string                     integer      string                                                             boolean   integer      integer      integer      integer      string      string                                              string                                                             integer    
 VDBName                                                            SchemaName                                                         ProcedureName                                                      Name                                                               DataType                   Position     Type                                                               Optional  Precision    TypeLength   Scale        Radix        NullType    UID                                                 Description                                                        OID        
-PartsSupplier                                                      SYSADMIN                                                           refreshMatView                                                     Invalidate                                                         boolean                    2            In                                                                 false     0            0            0            10           No Nulls    mmuuid:5736cfd3-750f-42d8-b083-102061e11c60         <null>                                                             12         
-PartsSupplier                                                      SYSADMIN                                                           refreshMatViewRow                                                  Key                                                                object                     2            In                                                                 false     0            0            0            10           No Nulls    mmuuid:7af5a63b-1b91-4d1e-912e-846a7e84c579         <null>                                                             9          
+PartsSupplier                                                      SYSADMIN                                                           refreshMatView                                                     Invalidate                                                         boolean                    2            In                                                                 false     0            0            0            10           No Nulls    mmuuid:5736cfd3-750f-42d8-b083-102061e11c60         <null>                                                             9          
+PartsSupplier                                                      SYSADMIN                                                           refreshMatViewRow                                                  Key                                                                object                     2            In                                                                 false     0            0            0            10           No Nulls    mmuuid:7af5a63b-1b91-4d1e-912e-846a7e84c579         <null>                                                             12         
 PartsSupplier                                                      SYSADMIN                                                           setProperty                                                        Name                                                               string                     3            In                                                                 false     0            0            0            10           No Nulls    mmuuid:ea92812c-1516-4c75-b5d3-c531fdbd8475         <null>                                                             22         
 PartsSupplier                                                      SYSADMIN                                                           setProperty                                                        OldValue                                                           clob                       1            ReturnValue                                                        false     0            2097152      0            10           No Nulls    mmuuid:48034d50-dd11-4653-aeae-b0d8d3d55656         <null>                                                             20         
-PartsSupplier                                                      SYSADMIN                                                           refreshMatViewRow                                                  RowsUpdated                                                        integer                    3            ReturnValue                                                        false     0            0            0            10           No Nulls    mmuuid:05a6a9be-c014-4d06-bcac-746cee4f118b         <null>                                                             10         
-PartsSupplier                                                      SYSADMIN                                                           refreshMatView                                                     RowsUpdated                                                        integer                    3            ReturnValue                                                        false     0            0            0            10           No Nulls    mmuuid:d07a6a75-aa12-4dac-8eab-b2acdbaaffd8         <null>                                                             13         
+PartsSupplier                                                      SYSADMIN                                                           refreshMatView                                                     RowsUpdated                                                        integer                    3            ReturnValue                                                        false     0            0            0            10           No Nulls    mmuuid:d07a6a75-aa12-4dac-8eab-b2acdbaaffd8         <null>                                                             10         
+PartsSupplier                                                      SYSADMIN                                                           refreshMatViewRow                                                  RowsUpdated                                                        integer                    3            ReturnValue                                                        false     0            0            0            10           No Nulls    mmuuid:05a6a9be-c014-4d06-bcac-746cee4f118b         <null>                                                             13         
 PartsSupplier                                                      SYSADMIN                                                           setProperty                                                        UID                                                                string                     2            In                                                                 false     0            50           0            10           No Nulls    mmuuid:d377510e-2ec5-445e-bdf0-59c7c0380962         <null>                                                             21         
 PartsSupplier                                                      SYSADMIN                                                           setProperty                                                        Value                                                              clob                       4            In                                                                 false     0            2097152      0            10           Nullable    mmuuid:ac5beeb8-2d0d-48ff-a533-4237d53b67e8         <null>                                                             23         
-PartsSupplier                                                      SYSADMIN                                                           refreshMatViewRow                                                  ViewName                                                           string                     1            In                                                                 false     0            0            0            10           No Nulls    mmuuid:ba635c44-a052-496d-9c35-ca010c0ebebe         <null>                                                             8          
-PartsSupplier                                                      SYSADMIN                                                           refreshMatView                                                     ViewName                                                           string                     1            In                                                                 false     0            0            0            10           No Nulls    mmuuid:e0c28e00-d987-48e4-8c60-5f637f10bf33         <null>                                                             11         
+PartsSupplier                                                      SYSADMIN                                                           refreshMatView                                                     ViewName                                                           string                     1            In                                                                 false     0            0            0            10           No Nulls    mmuuid:e0c28e00-d987-48e4-8c60-5f637f10bf33         <null>                                                             8          
+PartsSupplier                                                      SYSADMIN                                                           refreshMatViewRow                                                  ViewName                                                           string                     1            In                                                                 false     0            0            0            10           No Nulls    mmuuid:ba635c44-a052-496d-9c35-ca010c0ebebe         <null>                                                             11         
 PartsSupplier                                                      SYSADMIN                                                           setTableStats                                                      cardinality                                                        integer                    2            In                                                                 false     0            0            0            10           No Nulls    mmuuid:0aba7849-7fd3-4bc6-a3d3-dfe433bc67a4         <null>                                                             25         
 PartsSupplier                                                      SYSADMIN                                                           setColumnStats                                                     columnName                                                         string                     2            In                                                                 false     0            0            0            10           No Nulls    mmuuid:76553706-632f-4e60-8489-9d0361f58541         <null>                                                             15         
 PartsSupplier                                                      SYSADMIN                                                           isLoggable                                                         context                                                            string                     3            In                                                                 false     0            0            0            10           No Nulls    mmuuid:d62e3ceb-8e58-4c22-96b7-d76ee923e180         <null>                                                             3          

Modified: trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testProcedures.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testProcedures.expected	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testProcedures.expected	2011-12-14 22:19:17 UTC (rev 3740)
@@ -3,8 +3,8 @@
 PartsSupplier                                                      SYS                                                                getXMLSchemas                                                      <null>                                                             true            mmuuid:68497bd9-30f5-461b-bf13-6b26aeb2fc4f         <null>                                                             8          
 PartsSupplier                                                      SYSADMIN                                                           isLoggable                                                         <null>                                                             false           mmuuid:36769e93-4cc3-417b-853e-5ee5e6653d01         <null>                                                             1          
 PartsSupplier                                                      SYSADMIN                                                           logMsg                                                             <null>                                                             false           mmuuid:9a754e95-853b-40b2-a085-56d57f45953d         <null>                                                             2          
-PartsSupplier                                                      SYSADMIN                                                           refreshMatView                                                     <null>                                                             false           mmuuid:52178344-dca8-4c76-8549-00a4515c7044         <null>                                                             4          
-PartsSupplier                                                      SYSADMIN                                                           refreshMatViewRow                                                  <null>                                                             false           mmuuid:1674912b-af56-465a-a1b9-d1de8b761f10         <null>                                                             3          
+PartsSupplier                                                      SYSADMIN                                                           refreshMatView                                                     <null>                                                             false           mmuuid:52178344-dca8-4c76-8549-00a4515c7044         <null>                                                             3          
+PartsSupplier                                                      SYSADMIN                                                           refreshMatViewRow                                                  <null>                                                             false           mmuuid:1674912b-af56-465a-a1b9-d1de8b761f10         <null>                                                             4          
 PartsSupplier                                                      SYSADMIN                                                           setColumnStats                                                     <null>                                                             false           mmuuid:49c367be-918f-43be-8b9e-99e275179859         <null>                                                             5          
 PartsSupplier                                                      SYSADMIN                                                           setProperty                                                        <null>                                                             false           mmuuid:8db9b08e-3d6e-415a-9ceb-3fef726f424c         <null>                                                             6          
 PartsSupplier                                                      SYSADMIN                                                           setTableStats                                                      <null>                                                             false           mmuuid:6d167c35-04d1-41f6-83ff-888c39423823         <null>                                                             7          

Modified: trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testTables.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testTables.expected	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testTables.expected	2011-12-14 22:19:17 UTC (rev 3740)
@@ -8,8 +8,8 @@
 PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.PARTS                                                Table                 PARTS                                                              true        true             mmuuid:f6276601-73fe-1edc-a81c-ecf397b10590         16           <null>                                                             false     false           1          
 PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SHIP_VIA                                             Table                 SHIP_VIA                                                           true        true             mmuuid:0f4e9b80-73ff-1edc-a81c-ecf397b10590         4            <null>                                                             false     false           2          
 PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.STATUS                                               Table                 STATUS                                                             true        true             mmuuid:1f297200-73ff-1edc-a81c-ecf397b10590         3            <null>                                                             false     false           3          
-PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER                                             Table                 SUPPLIER                                                           true        true             mmuuid:2c371ec0-73ff-1edc-a81c-ecf397b10590         16           <null>                                                             false     false           5          
-PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER_PARTS                                       Table                 SUPPLIER_PARTS                                                     true        true             mmuuid:3deafb00-73ff-1edc-a81c-ecf397b10590         227          <null>                                                             false     false           4          
+PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER                                             Table                 SUPPLIER                                                           true        true             mmuuid:2c371ec0-73ff-1edc-a81c-ecf397b10590         16           <null>                                                             false     false           4          
+PartsSupplier                                                      PartsSupplier                                                      PARTSSUPPLIER.SUPPLIER_PARTS                                       Table                 SUPPLIER_PARTS                                                     true        true             mmuuid:3deafb00-73ff-1edc-a81c-ecf397b10590         227          <null>                                                             false     false           5          
 PartsSupplier                                                      SYS                                                                ProcedureParams                                                    Table                 <null>                                                             true        false            mmuuid:a56bd7fe-c87a-411c-8f5d-661975a25626         -1           <null>                                                             true      false           12         
 PartsSupplier                                                      SYS                                                                Procedures                                                         Table                 <null>                                                             true        false            mmuuid:0bc132a5-9f8d-4a3c-9f5d-98156a98a962         -1           <null>                                                             true      false           13         
 PartsSupplier                                                      SYS                                                                Properties                                                         Table                 <null>                                                             true        false            mmuuid:7a45e50a-d03f-4548-ba35-761651bbca85         -1           <null>                                                             true      false           14         
@@ -18,19 +18,19 @@
 PartsSupplier                                                      SYS                                                                Tables                                                             Table                 <null>                                                             true        false            mmuuid:8551b3bd-11cc-4049-9bcf-fe91a0eb7ba7         -1           <null>                                                             true      false           17         
 PartsSupplier                                                      SYSADMIN                                                           VDBResources                                                       Table                 <null>                                                             true        false            mmuuid:1785804d-beaf-4831-9531-e59164fedd49         -1           <null>                                                             true      false           7          
 PartsSupplier                                                      SYS                                                                VirtualDatabases                                                   Table                 <null>                                                             true        false            mmuuid:47297c72-d621-4f4e-af4e-74060ac5f489         -1           <null>                                                             true      false           18         
-PartsSupplier                                                      pg_catalog                                                         matpg_datatype                                                     Table                 <null>                                                             false       false            mmuid:17448311-6679-4dfd-aeb6-4aabbd894729          -1           <null>                                                             true      true            31         
-PartsSupplier                                                      pg_catalog                                                         matpg_relatt                                                       Table                 <null>                                                             false       false            mmuid:8c0714d6-1c72-40b4-8528-3b2c63059107          -1           <null>                                                             true      true            30         
-PartsSupplier                                                      pg_catalog                                                         pg_am                                                              Table                 <null>                                                             false       false            mmuid:f6517a63-8c14-4b73-a18d-afaa5dfb35d9          -1           <null>                                                             true      false           24         
-PartsSupplier                                                      pg_catalog                                                         pg_attrdef                                                         Table                 <null>                                                             false       false            mmuid:76a7dd05-9a7d-4243-b561-f3056500dcaf          -1           <null>                                                             true      false           27         
-PartsSupplier                                                      pg_catalog                                                         pg_attribute                                                       Table                 <null>                                                             false       false            mmuid:fa463d98-365f-489a-a707-025193cb51eb          -1           <null>                                                             true      true            21         
-PartsSupplier                                                      pg_catalog                                                         pg_class                                                           Table                 <null>                                                             false       false            mmuid:7e21f2e6-06e3-4bca-9b01-72ea47821560          -1           <null>                                                             true      true            20         
-PartsSupplier                                                      pg_catalog                                                         pg_database                                                        Table                 <null>                                                             false       false            mmuid:382f9fc9-8c96-4df7-ab5d-04dfb47ee142          -1           <null>                                                             true      false           28         
-PartsSupplier                                                      pg_catalog                                                         pg_index                                                           Table                 <null>                                                             false       false            mmuid:09daed8d-b0b8-4552-a261-2b6c775b46b0          -1           <null>                                                             true      true            23         
-PartsSupplier                                                      pg_catalog                                                         pg_namespace                                                       Table                 <null>                                                             false       false            mmuid:6609866a-3d7b-4f4b-95fe-ebfac769d699          -1           <null>                                                             true      false           19         
-PartsSupplier                                                      pg_catalog                                                         pg_proc                                                            Table                 <null>                                                             false       false            mmuid:f20c9489-10ca-4596-8a37-24218b67f764          -1           <null>                                                             true      true            25         
-PartsSupplier                                                      pg_catalog                                                         pg_trigger                                                         Table                 <null>                                                             false       false            mmuid:2b75f0b1-7475-4ed5-9da3-d37a8a25f26a          -1           <null>                                                             true      false           26         
-PartsSupplier                                                      pg_catalog                                                         pg_type                                                            Table                 <null>                                                             false       false            mmuid:9462e3f8-cd3c-414f-a570-f6f33c40e36a          -1           <null>                                                             true      false           22         
-PartsSupplier                                                      pg_catalog                                                         pg_user                                                            Table                 <null>                                                             false       false            mmuid:e63613cb-01ee-4b37-8b91-99d1aac4dfcb          -1           <null>                                                             true      false           29         
+PartsSupplier                                                      pg_catalog                                                         matpg_datatype                                                     Table                 <null>                                                             false       false            mmuid:17448311-6679-4dfd-aeb6-4aabbd894729          -1           <null>                                                             true      true            19         
+PartsSupplier                                                      pg_catalog                                                         matpg_relatt                                                       Table                 <null>                                                             false       false            mmuid:8c0714d6-1c72-40b4-8528-3b2c63059107          -1           <null>                                                             true      true            20         
+PartsSupplier                                                      pg_catalog                                                         pg_am                                                              Table                 <null>                                                             false       false            mmuid:f6517a63-8c14-4b73-a18d-afaa5dfb35d9          -1           <null>                                                             true      false           21         
+PartsSupplier                                                      pg_catalog                                                         pg_attrdef                                                         Table                 <null>                                                             false       false            mmuid:76a7dd05-9a7d-4243-b561-f3056500dcaf          -1           <null>                                                             true      false           22         
+PartsSupplier                                                      pg_catalog                                                         pg_attribute                                                       Table                 <null>                                                             false       false            mmuid:fa463d98-365f-489a-a707-025193cb51eb          -1           <null>                                                             true      true            23         
+PartsSupplier                                                      pg_catalog                                                         pg_class                                                           Table                 <null>                                                             false       false            mmuid:7e21f2e6-06e3-4bca-9b01-72ea47821560          -1           <null>                                                             true      true            24         
+PartsSupplier                                                      pg_catalog                                                         pg_database                                                        Table                 <null>                                                             false       false            mmuid:382f9fc9-8c96-4df7-ab5d-04dfb47ee142          -1           <null>                                                             true      false           25         
+PartsSupplier                                                      pg_catalog                                                         pg_index                                                           Table                 <null>                                                             false       false            mmuid:09daed8d-b0b8-4552-a261-2b6c775b46b0          -1           <null>                                                             true      true            26         
+PartsSupplier                                                      pg_catalog                                                         pg_namespace                                                       Table                 <null>                                                             false       false            mmuid:6609866a-3d7b-4f4b-95fe-ebfac769d699          -1           <null>                                                             true      false           27         
+PartsSupplier                                                      pg_catalog                                                         pg_proc                                                            Table                 <null>                                                             false       false            mmuid:f20c9489-10ca-4596-8a37-24218b67f764          -1           <null>                                                             true      true            28         
+PartsSupplier                                                      pg_catalog                                                         pg_trigger                                                         Table                 <null>                                                             false       false            mmuid:2b75f0b1-7475-4ed5-9da3-d37a8a25f26a          -1           <null>                                                             true      false           29         
+PartsSupplier                                                      pg_catalog                                                         pg_type                                                            Table                 <null>                                                             false       false            mmuid:9462e3f8-cd3c-414f-a570-f6f33c40e36a          -1           <null>                                                             true      false           30         
+PartsSupplier                                                      pg_catalog                                                         pg_user                                                            Table                 <null>                                                             false       false            mmuid:e63613cb-01ee-4b37-8b91-99d1aac4dfcb          -1           <null>                                                             true      false           31         
 Row Count : 31
 getColumnName    getColumnType  getCatalogName  getColumnClassName  getColumnLabel   getColumnTypeName  getSchemaName  getTableName  getColumnDisplaySize  getPrecision  getScale  isAutoIncrement  isCaseSensitive  isCurrency  isDefinitelyWritable  isNullable  isReadOnly  isSearchable  isSigned  isWritable  
 VDBName          12             PartsSupplier   java.lang.String    VDBName          string             SYS            Tables        255                   255           0         false            true             false       true                  1           false       true          true      true        

Modified: trunk/test-integration/db/src/main/java/org/teiid/test/client/ctc/QueryResults.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/client/ctc/QueryResults.java	2011-12-14 18:56:43 UTC (rev 3739)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/client/ctc/QueryResults.java	2011-12-14 22:19:17 UTC (rev 3740)
@@ -36,8 +36,9 @@
 import org.teiid.core.types.DataTypeManager;
 import org.teiid.query.sql.symbol.AliasSymbol;
 import org.teiid.query.sql.symbol.ElementSymbol;
+import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.Symbol;
 
 
 
@@ -482,8 +483,8 @@
         List infos = new ArrayList(symbols.size());
         Iterator iter = symbols.iterator();
         while (iter.hasNext()) {
-            SingleElementSymbol symbol = (SingleElementSymbol)iter.next();
-            String name = symbol.getName();
+            Expression symbol = (Expression)iter.next();
+            String name = Symbol.getName(symbol);
             if (symbol instanceof AliasSymbol) {
                 AliasSymbol alias = (AliasSymbol)symbol;
                 symbol = alias.getSymbol();



More information about the teiid-commits mailing list