You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by rh...@apache.org on 2014/02/14 19:28:22 UTC

svn commit: r1568436 [1/2] - /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/

Author: rhillegas
Date: Fri Feb 14 18:28:21 2014
New Revision: 1568436

URL: http://svn.apache.org/r1568436
Log:
DERBY-6464: Improve the encapsulation of ResultSetNode; commit derby-6464-04-ac-ResultSetNode.diff.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CurrentOfNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DistinctNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromSubquery.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromTable.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GroupByNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/HalfOuterJoinNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/HashTableNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/IndexToBaseRowNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/IntersectOrExceptNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JoinNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MatchingClauseNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MaterializeResultSetNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MergeNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NormalizeResultSetNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrderByNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ProjectRestrictNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultSetNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RowCountNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RowResultSetNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ScrollInsensitiveResultSetNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SelectNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetOperatorNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SingleChildResultSetNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SubqueryNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableOperatorNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UnionNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/WindowResultSetNode.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CurrentOfNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CurrentOfNode.java?rev=1568436&r1=1568435&r2=1568436&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CurrentOfNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CurrentOfNode.java Fri Feb 14 18:28:21 2014
@@ -225,7 +225,7 @@ public final class CurrentOfNode extends
 		** the result columns from preparedStatement and
 		** turn them into an RCL that we can run with.
 		*/
-        resultColumns = new ResultColumnList(getContextManager());
+        setResultColumns( new ResultColumnList(getContextManager()) );
 		ColumnDescriptorList cdl = td.getColumnDescriptorList();
 		int					 cdlSize = cdl.size();
 
@@ -243,7 +243,7 @@ public final class CurrentOfNode extends
                 colDesc, bcn, getContextManager());
 
 			/* Build the ResultColumnList to return */
-			resultColumns.addResultColumn(rc);
+			getResultColumns().addResultColumn(rc);
 		}
 
 		/* Assign the tableNumber */
@@ -336,7 +336,7 @@ public final class CurrentOfNode extends
             boolean notfound;
 
 			resultColumn =
-				resultColumns.getResultColumn(columnReference.getColumnName());
+				getResultColumns().getResultColumn(columnReference.getColumnName());
 
 			if (resultColumn != null) 
 			{
@@ -394,7 +394,7 @@ public final class CurrentOfNode extends
 								throws StandardException
 	{
 		/* Generate an empty referenced table map */
-		referencedTableMap = new JBitSet(numTables);
+		setReferencedTableMap( new JBitSet(numTables) );
 		return this;
 	}
 
@@ -443,7 +443,7 @@ public final class CurrentOfNode extends
 							throws StandardException {
 
 		if (SanityManager.DEBUG)
-		SanityManager.ASSERT(!statementResultSet, 
+            SanityManager.ASSERT(!isStatementResultSet(), 
 			"CurrentOfNode not expected to be statement node");
 
 		/* Get the next ResultSet #, so that we can number this ResultSetNode, its
@@ -461,7 +461,7 @@ public final class CurrentOfNode extends
 
 		  mb.push(cursorName);
 		  acb.pushThisAsActivation(mb);
-		  mb.push(resultSetNumber);
+		  mb.push(getResultSetNumber());
 		
 		mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null, "getCurrentOfResultSet",
 						ClassName.NoPutResultSet, 3);

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java?rev=1568436&r1=1568435&r2=1568436&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java Fri Feb 14 18:28:21 2014
@@ -212,7 +212,7 @@ class DeleteNode extends DMLModStatement
 			/* Generate a select list for the ResultSetNode - CurrentRowLocation(). */
 			if ( SanityManager.DEBUG )
             {
-				SanityManager.ASSERT((resultSet.resultColumns == null),
+				SanityManager.ASSERT((resultSet.getResultColumns() == null),
 							  "resultColumns is expected to be null until bind time");
             }
 
@@ -279,7 +279,7 @@ class DeleteNode extends DMLModStatement
 				correlateAddedColumns( resultColumnList, targetTable );
 			
                 /* Add the new result columns to the driving result set */
-                ResultColumnList    originalRCL = resultSet.resultColumns;
+                ResultColumnList    originalRCL = resultSet.getResultColumns();
                 if ( originalRCL != null )
                 {
                     originalRCL.appendResultColumns( resultColumnList, false );

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DistinctNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DistinctNode.java?rev=1568436&r1=1568435&r2=1568436&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DistinctNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DistinctNode.java Fri Feb 14 18:28:21 2014
@@ -99,19 +99,19 @@ class DistinctNode extends SingleChildRe
 		 */
         final ResultColumnList prRCList =
                 this.childResult.getResultColumns().copyListAndObjects();
-        this.resultColumns = this.childResult.getResultColumns();
+        setResultColumns( this.childResult.getResultColumns() );
 		this.childResult.setResultColumns(prRCList);
 
 		/* Replace ResultColumn.expression with new VirtualColumnNodes
 		 * in the DistinctNode's RCL.  (VirtualColumnNodes include
 		 * pointers to source ResultSetNode, this, and source ResultColumn.)
 		 */
-        this.resultColumns.genVirtualColumnNodes(this, prRCList);
+        getResultColumns().genVirtualColumnNodes(this, prRCList);
 
 		/* Verify that we can perform a DISTINCT on the
 		 * underlying tree.
 		 */
-        this.resultColumns.verifyAllOrderable();
+        getResultColumns().verifyAllOrderable();
         this.inSortedOrder = inSortedOrder;
 	}
 
@@ -161,8 +161,8 @@ class DistinctNode extends SingleChildRe
 									optimizer,
 									rowOrdering);
 
-		costEstimate = getCostEstimate(optimizer);
-		costEstimate.setCost(childCost.getEstimatedCost(),
+		setCostEstimate( getCostEstimate(optimizer) );
+		getCostEstimate().setCost(childCost.getEstimatedCost(),
 							 childCost.rowCount(),
 							 childCost.singleScanRowCount());
 
@@ -171,7 +171,7 @@ class DistinctNode extends SingleChildRe
 		** No need to use estimateCost on join strategy - that has already
 		** been done on the child.
 		*/
-		return costEstimate;
+		return getCostEstimate();
 	}
 
 	/**
@@ -215,9 +215,9 @@ class DistinctNode extends SingleChildRe
 
 		// RESOLVE: NEED TO FACTOR IN COST OF SORTING AND FIGURE OUT HOW
 		// MANY ROWS HAVE BEEN ELIMINATED.
-        costEstimate = getOptimizerFactory().getCostEstimate();
+        setCostEstimate( getOptimizerFactory().getCostEstimate() );
 
-		costEstimate.setCost(childResult.getCostEstimate().getEstimatedCost(),
+		getCostEstimate().setCost(childResult.getCostEstimate().getEstimatedCost(),
 							 childResult.getCostEstimate().rowCount(),
 							 childResult.getCostEstimate().singleScanRowCount());
 
@@ -265,12 +265,12 @@ class DistinctNode extends SingleChildRe
 		assignResultSetNumber();
 
 		// Get the final cost estimate based on the child's cost.
-		costEstimate = childResult.getFinalCostEstimate();
+		setCostEstimate( childResult.getFinalCostEstimate() );
 
 		/*
 			create the orderItem and stuff it in.
 		 */
-		int orderItem = acb.addItem(acb.getColumnOrdering(resultColumns));
+		int orderItem = acb.addItem(acb.getColumnOrdering(getResultColumns()));
 
 		/* Generate the SortResultSet:
 		 *	arg1: childExpress - Expression for childResultSet
@@ -289,11 +289,11 @@ class DistinctNode extends SingleChildRe
 		mb.push(true);
 		mb.push(inSortedOrder);
 		mb.push(orderItem);
-        mb.push(acb.addItem(resultColumns.buildRowTemplate()));
-		mb.push(resultColumns.getTotalColumnSize());
-		mb.push(resultSetNumber);
-		mb.push(costEstimate.rowCount());
-		mb.push(costEstimate.getEstimatedCost());
+        mb.push(acb.addItem(getResultColumns().buildRowTemplate()));
+		mb.push(getResultColumns().getTotalColumnSize());
+		mb.push(getResultSetNumber());
+		mb.push(getCostEstimate().rowCount());
+		mb.push(getCostEstimate().getEstimatedCost());
 
 		mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null, "getSortResultSet",
                 ClassName.NoPutResultSet, 9);

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java?rev=1568436&r1=1568435&r2=1568436&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java Fri Feb 14 18:28:21 2014
@@ -212,9 +212,9 @@ class FromBaseTable extends FromTable
     {
         super(correlationName, tableProperties, cm);
         this.tableName = tableName;
-        resultColumns = derivedRCL;
+        setResultColumns( derivedRCL );
         setOrigTableName(this.tableName);
-        templateColumns = resultColumns;
+        templateColumns = getResultColumns();
     }
 
     /**
@@ -235,9 +235,9 @@ class FromBaseTable extends FromTable
         super(correlationName, null, cm);
         this.tableName = tableName;
         this.updateOrDelete = updateOrDelete;
-        resultColumns = derivedRCL;
+        setResultColumns( derivedRCL );
 		setOrigTableName(this.tableName);
-		templateColumns = resultColumns;
+		templateColumns = getResultColumns();
 	}
 
     /** Set the name of the row location column */
@@ -619,7 +619,7 @@ class FromBaseTable extends FromTable
 		baseCols = irg.baseColumnPositions();
 
 		/* First we check to see if this is a covering index */
-        for (ResultColumn rc : resultColumns)
+        for (ResultColumn rc : getResultColumns())
 		{
 			/* Ignore unreferenced columns */
 			if (! rc.isReferenced())
@@ -2091,7 +2091,7 @@ class FromBaseTable extends FromTable
 		 * or it is (or was) the target table of an
 		 * updatable cursor.
 		 */
-		return (updateOrDelete != 0) || cursorTargetTable || getUpdateLocks;
+		return (updateOrDelete != 0) || isCursorTargetTable() || getUpdateLocks;
 	}
 
 	/** @see org.apache.derby.iapi.sql.compile.Optimizable#initialCapacity */
@@ -2312,13 +2312,13 @@ class FromBaseTable extends FromTable
 			ResultSetNode vtiNode = mapTableAsVTI(
                     tabDescr,
 					getCorrelationName(),
-					resultColumns,
+					getResultColumns(),
 					getProperties(),
 					getContextManager());
 			return vtiNode.bindNonVTITables(dataDictionary, fromListParam);
 		}	
 		
-		ResultColumnList	derivedRCL = resultColumns;
+		ResultColumnList	derivedRCL = getResultColumns();
   
 		// make sure there's a restriction list
         restrictionList = new PredicateList(getContextManager());
@@ -2328,8 +2328,8 @@ class FromBaseTable extends FromTable
 		CompilerContext compilerContext = getCompilerContext();
 
 		/* Generate the ResultColumnList */
-		resultColumns = genResultColList();
-		templateColumns = resultColumns;
+		setResultColumns( genResultColList() );
+		templateColumns = getResultColumns();
 
 		/* Resolve the view, if this is a view */
         if (tabDescr.getTableType() == TableDescriptor.VIEW_TYPE)
@@ -2374,7 +2374,7 @@ class FromBaseTable extends FromTable
 				 */
 				if (rsn.getResultColumns().containsAllResultColumn())
 				{
-					resultColumns.setCountMismatchAllowed(true);
+					getResultColumns().setCountMismatchAllowed(true);
 				}
 				//Views execute with definer's privileges and if any one of 
 				//those privileges' are revoked from the definer, the view gets
@@ -2386,7 +2386,7 @@ class FromBaseTable extends FromTable
 				//sql accessing a view, we only need to look for select privilege
 				//on the actual view and that is what the following code is
 				//checking.
-                for (ResultColumn rc : resultColumns) {
+                for (ResultColumn rc : getResultColumns()) {
                     if (isPrivilegeCollectionRequired()) {
 						compilerContext.addRequiredColumnPriv( rc.getTableColumnDescriptor());
                     }
@@ -2400,7 +2400,7 @@ class FromBaseTable extends FromTable
                     cvn.hasJDBClimitClause(),
 					(correlationName != null) ? 
                         correlationName : getOrigTableName().getTableName(), 
-					resultColumns,
+					getResultColumns(),
 					tableProperties,
 					getContextManager());
 				// Transfer the nesting level to the new FromSubquery
@@ -2464,14 +2464,14 @@ class FromBaseTable extends FromTable
             }
 
 			/* Build the 0-based array of base column names. */
-			columnNames = resultColumns.getColumnNames();
+			columnNames = getResultColumns().getColumnNames();
 
 			/* Do error checking on derived column list and update "exposed"
 			 * column names if valid.
 			 */
 			if (derivedRCL != null)
 			{
-				 resultColumns.propagateDCLInfo(derivedRCL, 
+                getResultColumns().propagateDCLInfo(derivedRCL, 
 											    origTableName.getFullTableName());
 			}
 
@@ -2790,13 +2790,13 @@ class FromBaseTable extends FromTable
             //         sys.systables systabs
             //     where systabs.tabletype = 'T' and systabs.tableid = tt.tableid;
             //
-            if ( resultColumns == null )
+            if ( getResultColumns() == null )
             {
                 throw StandardException.newException
                     ( SQLState.LANG_BAD_TABLE_FUNCTION_PARAM_REF, columnReference.getColumnName() );
             }
             
-			resultColumn = resultColumns.getResultColumn(columnReference.getColumnName());
+			resultColumn = getResultColumns().getResultColumn(columnReference.getColumnName());
             /* Did we find a match? */
 			if (resultColumn != null)
 			{
@@ -2876,7 +2876,7 @@ class FromBaseTable extends FromTable
         {
             int passwordColNum = SYSUSERSRowFactory.PASSWORD_COL_NUM;
 
-            FormatableBitSet    refCols = resultColumns.getReferencedFormatableBitSet( false, true, false );
+            FormatableBitSet    refCols = getResultColumns().getReferencedFormatableBitSet( false, true, false );
 
             if (
                 (refCols.getLength() >= passwordColNum ) && refCols.isSet( passwordColNum - 1 )
@@ -2888,8 +2888,8 @@ class FromBaseTable extends FromTable
         }
         
         /* Generate the referenced table map */
-		referencedTableMap = new JBitSet(numTables);
-		referencedTableMap.set(tableNumber);
+		setReferencedTableMap( new JBitSet(numTables) );
+		getReferencedTableMap().set(tableNumber);
 
         return genProjectRestrict(numTables);
 	}
@@ -2924,9 +2924,9 @@ class FromBaseTable extends FromTable
 		/* We get a shallow copy of the ResultColumnList and its 
 		 * ResultColumns.  (Copy maintains ResultColumn.expression for now.)
 		 */
-		ResultColumnList prRCList = resultColumns;
-		resultColumns = resultColumns.copyListAndObjects();
-		resultColumns.setIndexRow( baseConglomerateDescriptor.getConglomerateNumber(), forUpdate() );
+		ResultColumnList prRCList = getResultColumns();
+		setResultColumns( getResultColumns().copyListAndObjects() );
+		getResultColumns().setIndexRow( baseConglomerateDescriptor.getConglomerateNumber(), forUpdate() );
 
 		/* Replace ResultColumn.expression with new VirtualColumnNodes
 		 * in the ProjectRestrictNode's ResultColumnList.  (VirtualColumnNodes include
@@ -2934,7 +2934,7 @@ class FromBaseTable extends FromTable
 		 * NOTE: We don't want to mark the underlying RCs as referenced, otherwise
 		 * we won't be able to project out any of them.
 		 */
-		prRCList.genVirtualColumnNodes(this, resultColumns, false);
+		prRCList.genVirtualColumnNodes(this, getResultColumns(), false);
 
 		/* Project out any unreferenced columns.  If there are no referenced 
 		 * columns, generate and bind a single ResultColumn whose expression is 1.
@@ -3096,27 +3096,33 @@ class FromBaseTable extends FromTable
 			/* Template must reflect full row.
 			 * Compact RCL down to partial row.
 			 */
-			templateColumns = resultColumns;
-			referencedCols = resultColumns.getReferencedFormatableBitSet(cursorTargetTable, isSysstatements, false);
-			resultColumns = resultColumns.compactColumns(cursorTargetTable, isSysstatements);
+			templateColumns = getResultColumns();
+			referencedCols = getResultColumns().getReferencedFormatableBitSet(isCursorTargetTable(), isSysstatements, false);
+			setResultColumns( getResultColumns().compactColumns(isCursorTargetTable(), isSysstatements) );
 			return this;
 		}
 		
 		/* No need to go to the data page if this is a covering index */
 		/* Derby-1087: use data page when returning an updatable resultset */
-		if (ap.getCoveringIndexScan() && (!cursorTargetTable()))
+		if (ap.getCoveringIndexScan() && (!isCursorTargetTable()))
 		{
 			/* Massage resultColumns so that it matches the index. */
-			resultColumns = newResultColumns(resultColumns,
-				 							 trulyTheBestConglomerateDescriptor,
-											 baseConglomerateDescriptor,
-											 false);
+			setResultColumns
+                (
+                 newResultColumns
+                 (
+                  getResultColumns(),
+                  trulyTheBestConglomerateDescriptor,
+                  baseConglomerateDescriptor,
+                  false
+                  )
+                 );
 
 			/* We are going against the index.  The template row must be the full index row.
 			 * The template row will have the RID but the result row will not
 			 * since there is no need to go to the data page.
 			 */
-			templateColumns = newResultColumns(resultColumns,
+			templateColumns = newResultColumns(getResultColumns(),
 				 							 trulyTheBestConglomerateDescriptor,
 											 baseConglomerateDescriptor,
 											 false);
@@ -3125,7 +3131,7 @@ class FromBaseTable extends FromTable
 			// If this is for update then we need to get the RID in the result row
 			if (forUpdate())
 			{
-				resultColumns.addRCForRID();
+				getResultColumns().addRCForRID();
 			}
 			
 			/* Compact RCL down to the partial row.  We always want a new
@@ -3133,10 +3139,10 @@ class FromBaseTable extends FromTable
 			 * because we don't want the RID in the partial row returned
 			 * by the store.)
 			 */
-			referencedCols = resultColumns.getReferencedFormatableBitSet(cursorTargetTable,true, false);
-			resultColumns = resultColumns.compactColumns(cursorTargetTable,true);
+			referencedCols = getResultColumns().getReferencedFormatableBitSet(isCursorTargetTable(),true, false);
+			setResultColumns( getResultColumns().compactColumns(isCursorTargetTable(),true) );
 
-			resultColumns.setIndexRow(
+			getResultColumns().setIndexRow(
 				baseConglomerateDescriptor.getConglomerateNumber(), 
 				forUpdate());
 
@@ -3167,7 +3173,7 @@ class FromBaseTable extends FromTable
 		** a cursor can fetch the current row).
 		*/
 		ResultColumnList newResultColumns =
-			newResultColumns(resultColumns,
+			newResultColumns(getResultColumns(),
 							trulyTheBestConglomerateDescriptor,
 							baseConglomerateDescriptor,
 							true
@@ -3192,8 +3198,8 @@ class FromBaseTable extends FromTable
 			/* No BULK FETCH or requalification, XOR off the columns coming from the heap 
 			 * to get the columns coming from the index.
 			 */
-			indexReferencedCols = resultColumns.getReferencedFormatableBitSet(cursorTargetTable, true, false);
-			heapReferencedCols = resultColumns.getReferencedFormatableBitSet(cursorTargetTable, true, true);
+			indexReferencedCols = getResultColumns().getReferencedFormatableBitSet(isCursorTargetTable(), true, false);
+			heapReferencedCols = getResultColumns().getReferencedFormatableBitSet(isCursorTargetTable(), true, true);
 			if (heapReferencedCols != null)
 			{
 				indexReferencedCols.xor(heapReferencedCols);
@@ -3202,13 +3208,13 @@ class FromBaseTable extends FromTable
 		else
 		{
 			// BULK FETCH or requalification - re-get all referenced columns from the heap
-			heapReferencedCols = resultColumns.getReferencedFormatableBitSet(cursorTargetTable, true, false) ;
+			heapReferencedCols = getResultColumns().getReferencedFormatableBitSet(isCursorTargetTable(), true, false) ;
 		}
-		ResultColumnList heapRCL = resultColumns.compactColumns(cursorTargetTable, false);
+		ResultColumnList heapRCL = getResultColumns().compactColumns(isCursorTargetTable(), false);
         retval = new IndexToBaseRowNode(this,
 										baseConglomerateDescriptor,
 										heapRCL,
-                                        cursorTargetTable,
+                                        isCursorTargetTable(),
 										heapReferencedCols,
 										indexReferencedCols,
 										requalificationRestrictionList,
@@ -3220,9 +3226,9 @@ class FromBaseTable extends FromTable
 		** The template row is all the columns.  The
 		** result set is the compacted column list.
 		*/
-		resultColumns = newResultColumns;
+		setResultColumns( newResultColumns );
 
-		templateColumns = newResultColumns(resultColumns,
+		templateColumns = newResultColumns(getResultColumns(),
 			 							   trulyTheBestConglomerateDescriptor,
 										   baseConglomerateDescriptor,
 										   false);
@@ -3237,28 +3243,28 @@ class FromBaseTable extends FromTable
 		 */
 		if (bulkFetch != UNSET)
 		{
-			resultColumns.markAllUnreferenced();
+			getResultColumns().markAllUnreferenced();
 			storeRestrictionList.markReferencedColumns();
 			if (nonStoreRestrictionList != null)
 			{
 				nonStoreRestrictionList.markReferencedColumns();
 			}
 		}
-		resultColumns.addRCForRID();
+		getResultColumns().addRCForRID();
 		templateColumns.addRCForRID();
 
 		// Compact the RCL for the index scan down to the partial row.
-		referencedCols = resultColumns.getReferencedFormatableBitSet(cursorTargetTable, false, false);
-		resultColumns = resultColumns.compactColumns(cursorTargetTable, false);
-		resultColumns.setIndexRow(
+		referencedCols = getResultColumns().getReferencedFormatableBitSet(isCursorTargetTable(), false, false);
+		setResultColumns( getResultColumns().compactColumns(isCursorTargetTable(), false) );
+		getResultColumns().setIndexRow(
 				baseConglomerateDescriptor.getConglomerateNumber(), 
 				forUpdate());
 
 		/* We must remember if this was the cursorTargetTable
  		 * in order to get the right locking on the scan.
 		 */
-		getUpdateLocks = cursorTargetTable;
-		cursorTargetTable = false;
+		getUpdateLocks = isCursorTargetTable();
+		setCursorTargetTable( false );
 
 		return retval;
 	}
@@ -3355,7 +3361,7 @@ class FromBaseTable extends FromTable
 	{
         if ( rowLocationColumnName != null )
         {
-            resultColumns.conglomerateId = tableDescriptor.getHeapConglomerateId();
+            getResultColumns().conglomerateId = tableDescriptor.getHeapConglomerateId();
         }
 
 		generateResultSet( acb, mb );
@@ -3364,7 +3370,7 @@ class FromBaseTable extends FromTable
 		** Remember if this base table is the cursor target table, so we can
 		** know which table to use when doing positioned update and delete
 		*/
-		if (cursorTargetTable)
+		if (isCursorTargetTable())
 		{
 			acb.rememberCursorTarget(mb);
 		}
@@ -3530,7 +3536,7 @@ class FromBaseTable extends FromTable
 		acb.pushThisAsActivation(mb);
 		mb.push(getResultSetNumber());
         mb.push(acb.addItem(
-            resultColumns.buildRowTemplate(referencedCols, false)));
+                            getResultColumns().buildRowTemplate(referencedCols, false)));
 		mb.push(cd.getConglomerateNumber());
 		mb.push(tableDescriptor.getName());
 		//User may have supplied optimizer overrides in the sql
@@ -3590,7 +3596,7 @@ class FromBaseTable extends FromTable
 		/* Get the hash key columns and wrap them in a formattable */
         int[] hashKeyCols;
 
-        hashKeyCols = new int[resultColumns.size()];
+        hashKeyCols = new int[getResultColumns().size()];
 		if (referencedCols == null)
 		{
             for (int index = 0; index < hashKeyCols.length; index++)
@@ -3624,7 +3630,7 @@ class FromBaseTable extends FromTable
 		mb.push(conglomNumber);
 		mb.push(acb.addItem(scoci));
         mb.push(acb.addItem(
-            resultColumns.buildRowTemplate(referencedCols, false)));
+                            getResultColumns().buildRowTemplate(referencedCols, false)));
 		mb.push(getResultSetNumber());
 		mb.push(hashKeyItem);
 		mb.push(tableDescriptor.getName());
@@ -3698,7 +3704,7 @@ class FromBaseTable extends FromTable
 	{
         // Put the result row template in the saved objects.
         int resultRowTemplate =
-            acb.addItem(resultColumns.buildRowTemplate(referencedCols, false));
+            acb.addItem(getResultColumns().buildRowTemplate(referencedCols, false));
 
 		// pass in the referenced columns on the saved objects
 		// chain
@@ -3710,7 +3716,7 @@ class FromBaseTable extends FromTable
 
 		// beetle entry 3865: updateable cursor using index
 		int indexColItem = -1;
-		if (cursorTargetTable || getUpdateLocks)
+		if (isCursorTargetTable() || getUpdateLocks)
 		{
 			ConglomerateDescriptor cd = getTrulyTheBestAccessPath().getConglomerateDescriptor();
 			if (cd.isIndex())
@@ -3855,7 +3861,7 @@ class FromBaseTable extends FromTable
     ResultColumnList getAllResultColumns(TableName allTableName)
 			throws StandardException
 	{
-		return getResultColumnsForList(allTableName, resultColumns, 
+		return getResultColumnsForList(allTableName, getResultColumns(), 
 				getOrigTableName());
 	}
 
@@ -4013,7 +4019,7 @@ class FromBaseTable extends FromTable
     @Override
     boolean markAsCursorTargetTable()
 	{
-		cursorTargetTable = true;
+		setCursorTargetTable( true );
 		return true;
 	}
 
@@ -4026,7 +4032,7 @@ class FromBaseTable extends FromTable
     @Override
 	protected boolean cursorTargetTable()
 	{
-		return cursorTargetTable;
+		return isCursorTargetTable();
 	}
 
 	/**
@@ -4038,7 +4044,7 @@ class FromBaseTable extends FromTable
 	 */
 	void markUpdated(ResultColumnList updateColumns)
 	{
-		resultColumns.markUpdated(updateColumns);
+		getResultColumns().markUpdated(updateColumns);
 	}
 
 	/**
@@ -4437,7 +4443,7 @@ class FromBaseTable extends FromTable
 
 		HashSet<ValueNode> columns = new HashSet<ValueNode>();
 
-        for (ResultColumn rc : resultColumns) {
+        for (ResultColumn rc : getResultColumns()) {
 			columns.add(rc.getExpression());
 		}
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromSubquery.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromSubquery.java?rev=1568436&r1=1568435&r2=1568436&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromSubquery.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromSubquery.java Fri Feb 14 18:28:21 2014
@@ -85,7 +85,7 @@ class FromSubquery extends FromTable
         this.offset = offset;
         this.fetchFirst = fetchFirst;
         this.hasJDBClimitClause = hasJDBClimitClause;
-        resultColumns = derivedRCL;
+        setResultColumns( derivedRCL );
 	}
 
 	/**
@@ -238,7 +238,7 @@ class FromSubquery extends FromTable
         FromList            emptyFromList = new FromList(
                 getOptimizerFactory().doJoinOrderOptimization(),
                 getContextManager());
-		ResultColumnList	derivedRCL = resultColumns;
+		ResultColumnList	derivedRCL = getResultColumns();
 		ResultColumnList	subqueryRCL;
 		FromList			nestedFromList;
 
@@ -292,11 +292,11 @@ class FromSubquery extends FromTable
 		 * the table since the view was created.
 		 */
 		subqueryRCL = subquery.getResultColumns();
-		if (resultColumns != null && resultColumns.getCountMismatchAllowed() &&
-			resultColumns.size() < subqueryRCL.size())
+		if (getResultColumns() != null && getResultColumns().getCountMismatchAllowed() &&
+			getResultColumns().size() < subqueryRCL.size())
 		{
 			for (int index = subqueryRCL.size() - 1; 
-				 index >= resultColumns.size(); 
+				 index >= getResultColumns().size(); 
 				 index--)
 			{
 				subqueryRCL.removeElementAt(index);
@@ -308,12 +308,12 @@ class FromSubquery extends FromTable
          */
          ResultColumnList newRcl = subqueryRCL.copyListAndObjects();
          newRcl.genVirtualColumnNodes(subquery, subquery.getResultColumns());
-         resultColumns = newRcl;
+         setResultColumns( newRcl );
 
 		/* Propagate the name info from the derived column list */
 		if (derivedRCL != null)
 		{
-			 resultColumns.propagateDCLInfo(derivedRCL, correlationName);
+            getResultColumns().propagateDCLInfo(derivedRCL, correlationName);
 		}
 	}
 
@@ -349,11 +349,11 @@ class FromSubquery extends FromTable
 		// now but what happens if the condition is false? Investigate.
 		if (columnReference.getGeneratedToReplaceAggregate()) // 1
 		{
-			resultColumn = resultColumns.getResultColumn(columnReference.getColumnName());
+			resultColumn = getResultColumns().getResultColumn(columnReference.getColumnName());
 		}
 		else if (columnsTableName == null || columnsTableName.equals(correlationName)) // 5?
 		{
-		    resultColumn = resultColumns.getAtMostOneResultColumn(columnReference, correlationName, false);
+		    resultColumn = getResultColumns().getAtMostOneResultColumn(columnReference, correlationName, false);
 		}
 		    
 
@@ -473,7 +473,7 @@ class FromSubquery extends FromTable
 
         newPRN = new ProjectRestrictNode(
 								subquery,		/* Child ResultSet */
-								resultColumns,	/* Projection */
+								getResultColumns(),	/* Projection */
 								null,			/* Restriction */
 								null,			/* Restriction as PredicateList */
 								null,			/* Subquerys in Projection */
@@ -529,7 +529,7 @@ class FromSubquery extends FromTable
 		FromList	fromList = null;
 		SelectNode	selectNode;
 
-		resultColumns.setRedundant();
+		getResultColumns().setRedundant();
 
 		subquery.getResultColumns().setRedundant();
 
@@ -630,11 +630,11 @@ class FromSubquery extends FromTable
 
 		// Use visibleSize, because we don't want to propagate any order by
 		// columns not selected.
-		int rclSize = resultColumns.visibleSize();
+		int rclSize = getResultColumns().visibleSize();
 
 		for (int index = 0; index < rclSize; index++)
 		{
-			ResultColumn resultColumn = resultColumns.elementAt(index);
+			ResultColumn resultColumn = getResultColumns().elementAt(index);
 			ValueNode		 valueNode;
 			String			 columnName;
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromTable.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromTable.java?rev=1568436&r1=1568435&r2=1568436&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromTable.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromTable.java Fri Feb 14 18:28:21 2014
@@ -170,13 +170,13 @@ abstract class FromTable extends ResultS
 		/* Make sure there is a cost estimate to set */
 		getCostEstimate(optimizer);
 
-		setCostEstimate(singleScanCost);
+		setCostEstimateCost(singleScanCost);
 
 		/* Optimize any subqueries that need to get optimized and
 		 * are not optimized any where else.  (Like those
 		 * in a RowResultSetNode.)
 		 */
-		optimizeSubqueries(getDataDictionary(), costEstimate.rowCount());
+		optimizeSubqueries(getDataDictionary(), getCostEstimate().rowCount());
 
 		/*
 		** Get the cost of this result set in the context of the whole plan.
@@ -646,7 +646,7 @@ abstract class FromTable extends ResultS
 			getTrulyTheBestAccessPath().initializeAccessPathName(dd, td);
 		}
 
-		setCostEstimate(bestPath.getCostEstimate());
+		setCostEstimateCost(bestPath.getCostEstimate());
 
         if ( optimizerTracingIsOn() )
         { getOptimizerTracer().traceRememberingBestAccessPath( bestPath, tableNumber, planType ); }
@@ -725,15 +725,21 @@ abstract class FromTable extends ResultS
 		throws StandardException
 	{
 		// If we already found it, just return it.
-		if (finalCostEstimate != null)
-			return finalCostEstimate;
+		if (getCandidateFinalCostEstimate() != null)
+        {
+			return getCandidateFinalCostEstimate();
+        }
 
 		if (getTrulyTheBestAccessPath() == null)
-			finalCostEstimate = costEstimate;
+        {
+			setCandidateFinalCostEstimate( getCostEstimate() );
+        }
 		else
-			finalCostEstimate = getTrulyTheBestAccessPath().getCostEstimate();
+        {
+			setCandidateFinalCostEstimate( getTrulyTheBestAccessPath().getCostEstimate() );
+        }
 
-		return finalCostEstimate;
+		return getCandidateFinalCostEstimate();
 	}
 
 	/** @see Optimizable#isBaseTable */
@@ -750,7 +756,7 @@ abstract class FromTable extends ResultS
      * {@code false} otherwise
      */
     public boolean hasLargeObjectColumns() {
-        for (ResultColumn rc : resultColumns) {
+        for (ResultColumn rc : getResultColumns()) {
             if (rc.isReferenced()) {
                 DataTypeDescriptor type = rc.getType();
                 if (type != null && type.getTypeId().isLOBTypeId()) {
@@ -834,7 +840,7 @@ abstract class FromTable extends ResultS
         if( perRowUsage < 0)
         {
             // Do not use getRefCols() because the cached refCols may no longer be valid.
-            FormatableBitSet refCols = resultColumns.getReferencedFormatableBitSet(cursorTargetTable(), true, false);
+            FormatableBitSet refCols = getResultColumns().getReferencedFormatableBitSet(cursorTargetTable(), true, false);
             perRowUsage = 0.0;
 
             /* Add up the memory usage for each referenced column */
@@ -842,7 +848,7 @@ abstract class FromTable extends ResultS
             {
                 if (refCols.isSet(i))
                 {
-                    ResultColumn rc = resultColumns.elementAt(i);
+                    ResultColumn rc = getResultColumns().elementAt(i);
                     DataTypeDescriptor expressionType = rc.getExpression().getTypeServices();
                     if( expressionType != null)
                         perRowUsage += expressionType.estimatedMemoryUsage();
@@ -938,7 +944,7 @@ abstract class FromTable extends ResultS
 	 */
 	public int getNumColumnsReturned()
 	{
-		return resultColumns.size();
+		return getResultColumns().size();
 	}
 
 	/**
@@ -1028,11 +1034,11 @@ abstract class FromTable extends ResultS
 
 	protected CostEstimate getCostEstimate(Optimizer optimizer)
 	{
-		if (costEstimate == null)
+		if (getCostEstimate() == null)
 		{
-			costEstimate = getOptimizerFactory().getCostEstimate();
+			setCostEstimate( getOptimizerFactory().getCostEstimate() );
 		}
-		return costEstimate;
+		return getCostEstimate();
 	}
 
 	/*
@@ -1044,22 +1050,20 @@ abstract class FromTable extends ResultS
 	*/
 	protected CostEstimate getScratchCostEstimate(Optimizer optimizer)
 	{
-		if (scratchCostEstimate == null)
+		if ( getScratchCostEstimate() == null )
 		{
-			scratchCostEstimate = getOptimizerFactory().getCostEstimate();
+			setScratchCostEstimate( getOptimizerFactory().getCostEstimate() );
 		}
 
-		return scratchCostEstimate;
+		return getScratchCostEstimate();
 	}
 
 	/**
 	 * Set the cost estimate in this node to the given cost estimate.
 	 */
-	protected void setCostEstimate(CostEstimate newCostEstimate)
+	protected void setCostEstimateCost(CostEstimate newCostEstimate)
 	{
-		costEstimate = getCostEstimate();
-
-		costEstimate.setCost(newCostEstimate);
+		getCostEstimate().setCost(newCostEstimate);
 	}
 
 	/**
@@ -1067,7 +1071,7 @@ abstract class FromTable extends ResultS
 	 */
 	protected void assignCostEstimate(CostEstimate newCostEstimate)
 	{
-		costEstimate = newCostEstimate;
+		setCostEstimate( newCostEstimate );
 	}
 
 	/**
@@ -1422,7 +1426,7 @@ abstract class FromTable extends ResultS
 	 */
     protected void markUpdatableByCursor(List<String> updateColumns)
 	{
-		resultColumns.markUpdatableByCursor(updateColumns);
+		getResultColumns().markUpdatableByCursor(updateColumns);
 	}
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java?rev=1568436&r1=1568435&r2=1568436&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java Fri Feb 14 18:28:21 2014
@@ -182,7 +182,7 @@ class FromVTI extends FromTable implemen
             TableName exposedTableName) {
 
         this.methodCall = invocation;
-        this.resultColumns = derivedRCL;
+        setResultColumns( derivedRCL );
         this.subqueryList = new SubqueryList(getContextManager());
 
         // Cache exposed name for this table.
@@ -207,7 +207,7 @@ class FromVTI extends FromTable implemen
 				RowOrdering rowOrdering)
 			throws StandardException
 	{
-		costEstimate = getCostEstimate(optimizer);
+		setCostEstimate( getCostEstimate(optimizer) );
 
 		/* Cost the VTI if it implements VTICosting.
 		 * Otherwise we use the defaults.
@@ -238,7 +238,7 @@ class FromVTI extends FromTable implemen
 			vtiCosted = true;
 		}
 
-		costEstimate.setCost(estimatedCost, estimatedRowCount, estimatedRowCount);
+		getCostEstimate().setCost(estimatedCost, estimatedRowCount, estimatedRowCount);
 
 		/*
 		** Let the join strategy decide whether the cost of the base
@@ -256,19 +256,19 @@ class FromVTI extends FromTable implemen
 				getJoinStrategy().
 					multiplyBaseCostByOuterRows())
 		{
-			costEstimate.multiply(outerCost.rowCount(), costEstimate);
+			getCostEstimate().multiply(outerCost.rowCount(), getCostEstimate());
 		}
 
 		if ( ! optimized)
 		{
 			subqueryList.optimize(optimizer.getDataDictionary(),
-									costEstimate.rowCount());
+                                  getCostEstimate().rowCount());
 			subqueryList.modifyAccessPaths();
 		}
 
 		optimized = true;
 
-		return costEstimate;
+		return getCostEstimate();
 	}
 
 	/**
@@ -537,7 +537,7 @@ class FromVTI extends FromTable implemen
     ResultSetNode bindVTITables(FromList fromListParam)
 							throws StandardException
 	{
-		ResultColumnList	derivedRCL = resultColumns;
+		ResultColumnList	derivedRCL = getResultColumns();
 
 		LanguageConnectionContext lcc = getLanguageConnectionContext();
 
@@ -630,7 +630,7 @@ class FromVTI extends FromTable implemen
 		if ((isConstructor()) && ((triggerTableId = getSpecialTriggerVTITableName(lcc, methodCall.getJavaClassName())) != null)  )
 		{
 			TableDescriptor td = getDataDictionary().getTableDescriptor(triggerTableId);
-			resultColumns = genResultColList(td);
+			setResultColumns( genResultColList(td) );
 
 			// costing info
 			vtiCosted = true;
@@ -640,7 +640,7 @@ class FromVTI extends FromTable implemen
 		}
 		else
 		{	
-            resultColumns = new ResultColumnList((getContextManager()));
+            setResultColumns( new ResultColumnList((getContextManager())) );
 
 			// if this is a Derby-style Table Function, then build the result
 			// column list from the RowMultiSetImpl return datatype
@@ -672,16 +672,16 @@ class FromVTI extends FromTable implemen
 				numVTICols = 0;
 			    }
 
-			    resultColumns.createListFromResultSetMetaData(rsmd, exposedName, 
+			    getResultColumns().createListFromResultSetMetaData(rsmd, exposedName, 
 														  getVTIName() );
 			}
 		}
-		numVTICols = resultColumns.size();
+		numVTICols = getResultColumns().size();
 	
 		/* Propagate the name info from the derived column list */
 		if (derivedRCL != null)
 		{
-			 resultColumns.propagateDCLInfo(derivedRCL, correlationName);
+            getResultColumns().propagateDCLInfo(derivedRCL, correlationName);
 		}
 
 		return this;
@@ -1055,7 +1055,7 @@ class FromVTI extends FromTable implemen
 		 * NOTE: This method will capture any column renaming due to 
 		 * a derived column list.
 		 */
-        for (ResultColumn rc : resultColumns)
+        for (ResultColumn rc : getResultColumns())
 		{
             if (!rc.isGenerated()) {
                 // Build a ResultColumn/ColumnReference pair for the column //
@@ -1092,7 +1092,7 @@ class FromVTI extends FromTable implemen
 		/* We could get called before our RCL is built.  That's okay, we'll
 		 * just say that we don't match. 
 		 */
-		if (resultColumns == null)
+		if (getResultColumns() == null)
 		{
 			return null;
 		}
@@ -1109,7 +1109,7 @@ class FromVTI extends FromTable implemen
 		*/
 		if (columnsTableName == null || columnsTableName.equals(exposedName))
 		{
-			resultColumn = resultColumns.getResultColumn(columnReference.getColumnName());
+			resultColumn = getResultColumns().getResultColumn(columnReference.getColumnName());
 			/* Did we find a match? */
 			if (resultColumn != null)
 			{
@@ -1156,8 +1156,8 @@ class FromVTI extends FromTable implemen
             new PredicateList(getContextManager()));
 
 		/* Generate the referenced table map */
-		referencedTableMap = new JBitSet(numTables);
-		referencedTableMap.set(tableNumber);
+		setReferencedTableMap( new JBitSet(numTables) );
+		getReferencedTableMap().set(tableNumber);
 
 		/* Create the dependency map.  This FromVTI depends on any
 		 * tables which are referenced by the method call.  Note,
@@ -1217,8 +1217,8 @@ class FromVTI extends FromTable implemen
 		/* We get a shallow copy of the ResultColumnList and its 
 		 * ResultColumns.  (Copy maintains ResultColumn.expression for now.)
 		 */
-		prRCList = resultColumns;
-		resultColumns = resultColumns.copyListAndObjects();
+		prRCList = getResultColumns();
+		setResultColumns( getResultColumns().copyListAndObjects() );
 
 		/* Replace ResultColumn.expression with new VirtualColumnNodes
 		 * in the ProjectRestrictNode's ResultColumnList.  (VirtualColumnNodes include
@@ -1226,7 +1226,7 @@ class FromVTI extends FromTable implemen
 		 * NOTE: We don't want to mark the underlying RCs as referenced, otherwise
 		 * we won't be able to project out any of them.
 		 */
-		prRCList.genVirtualColumnNodes(this, resultColumns, false);
+		prRCList.genVirtualColumnNodes(this, getResultColumns(), false);
 
 		/* Project out any unreferenced columns.  If there are no referenced 
 		 * columns, generate and bind a single ResultColumn whose expression is 1.
@@ -1625,17 +1625,17 @@ class FromVTI extends FromTable implemen
 										  MethodBuilder mb)
 		throws StandardException
 	{
-		int				rclSize = resultColumns.size();
+		int				rclSize = getResultColumns().size();
 		FormatableBitSet			referencedCols = new FormatableBitSet(rclSize);
 		int				erdNumber = -1;
 		int				numSet = 0;
 
 		// Get our final cost estimate.
-		costEstimate = getFinalCostEstimate();
+		setCostEstimate( getFinalCostEstimate() );
 
 		for (int index = 0; index < rclSize; index++)
 		{
-            ResultColumn rc = resultColumns.elementAt(index);
+            ResultColumn rc = getResultColumns().elementAt(index);
 			if (rc.isReferenced())
 			{
 				referencedCols.set(index);
@@ -1661,7 +1661,7 @@ class FromVTI extends FromTable implemen
 		acb.pushThisAsActivation(mb); // arg 1
 
         // Get a row builder to allocate scan rows of the right shape and size.
-        mb.push(acb.addItem(resultColumns.buildRowTemplate())); // arg 2
+        mb.push(acb.addItem(getResultColumns().buildRowTemplate())); // arg 2
 
 		// For a Version 2 VTI we never maintain the java.sql.PreparedStatement
 		// from compile time to execute time. This would rquire the PreparedStatement
@@ -1680,7 +1680,7 @@ class FromVTI extends FromTable implemen
 
 
 
-		mb.push(resultSetNumber); // arg 3
+		mb.push(getResultSetNumber()); // arg 3
 
 		// The generated method for the constructor
 		generateConstructor(acb, mb, reuseablePs); // arg 4
@@ -1711,10 +1711,10 @@ class FromVTI extends FromTable implemen
 		mb.push(getCompilerContext().getScanIsolationLevel());
 
 		// estimated row count
-		mb.push(costEstimate.rowCount());
+		mb.push(getCostEstimate().rowCount());
 
 		// estimated cost
-		mb.push(costEstimate.getEstimatedCost());
+		mb.push(getCostEstimate().getEstimatedCost());
 
 		// Whether or not this is a Derby-style Table Function
 		mb.push(isDerbyStyleTableFunction);
@@ -1979,7 +1979,7 @@ class FromVTI extends FromTable implemen
         {
             String          columnName = columnNames[ i ];
             DataTypeDescriptor  dtd = DataTypeDescriptor.getType(types[i]);
-            ResultColumn    rc = resultColumns.addColumn
+            ResultColumn    rc = getResultColumns().addColumn
                 ( exposedName, columnName, dtd );
 
             //

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GroupByNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GroupByNode.java?rev=1568436&r1=1568435&r2=1568436&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GroupByNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GroupByNode.java Fri Feb 14 18:28:21 2014
@@ -169,7 +169,7 @@ class GroupByNode extends SingleChildRes
 		** RCL to its columns.
 		*/
 		newBottomRCL = childResult.getResultColumns().copyListAndObjects();
-		resultColumns = childResult.getResultColumns();
+		setResultColumns( childResult.getResultColumns() );
 		childResult.setResultColumns(newBottomRCL);
 
 		/*
@@ -181,7 +181,7 @@ class GroupByNode extends SingleChildRes
 
 		if (this.groupingList != null && this.groupingList.isRollup())
                 {
-			resultColumns.setNullability(true);
+                    getResultColumns().setNullability(true);
 			parent.getResultColumns().setNullability(true);
                 }
 		/* We say that the source is never in sorted order if there is a distinct aggregate.
@@ -292,7 +292,7 @@ class GroupByNode extends SingleChildRes
 		*/
         ResultColumnList rclNew = new ResultColumnList((getContextManager()));
 
-        for (ResultColumn rc : resultColumns)
+        for (ResultColumn rc : getResultColumns())
 		{
 			if (!rc.isGenerated()) {
 				rclNew.addElement(rc);
@@ -302,7 +302,7 @@ class GroupByNode extends SingleChildRes
 		// if any columns in the source RCL were generated for an order by
 		// remember it in the new RCL as well. After the sort is done it will
 		// have to be projected out upstream.
-		rclNew.copyOrderBySelect(resultColumns);
+		rclNew.copyOrderBySelect(getResultColumns());
 		
         parent = new ProjectRestrictNode(
 										this, 	// child
@@ -323,7 +323,7 @@ class GroupByNode extends SingleChildRes
 		/*
 		** Set the group by RCL to be empty
 		*/
-        resultColumns = new ResultColumnList((getContextManager()));
+        setResultColumns( new ResultColumnList((getContextManager())) );
 
 	}
 
@@ -341,7 +341,7 @@ class GroupByNode extends SingleChildRes
 	private ArrayList<SubstituteExpressionVisitor> addUnAggColumns() throws StandardException
 	{
 		ResultColumnList bottomRCL  = childResult.getResultColumns();
-		ResultColumnList groupByRCL = resultColumns;
+		ResultColumnList groupByRCL = getResultColumns();
 
 		ArrayList<SubstituteExpressionVisitor> referencesToSubstitute = new ArrayList<SubstituteExpressionVisitor>();
 		ArrayList<SubstituteExpressionVisitor> havingRefsToSubstitute = null;
@@ -592,7 +592,7 @@ class GroupByNode extends SingleChildRes
 		ResultColumn	tmpRC;
 		ResultColumn	aggResultRC;
 		ResultColumnList bottomRCL  = childResult.getResultColumns();
-		ResultColumnList groupByRCL = resultColumns;
+		ResultColumnList groupByRCL = getResultColumns();
 		ResultColumnList aggRCL;
 		int				aggregatorVColId;
 		int				aggInputVColId;
@@ -939,9 +939,9 @@ class GroupByNode extends SingleChildRes
 
 		// RESOLVE: NEED TO FACTOR IN COST OF SORTING AND FIGURE OUT HOW
 		// MANY ROWS HAVE BEEN ELIMINATED.
-        costEstimate = getOptimizerFactory().getCostEstimate();
+        setCostEstimate( getOptimizerFactory().getCostEstimate() );
 
-		costEstimate.setCost(childResult.getCostEstimate().getEstimatedCost(),
+		getCostEstimate().setCost(childResult.getCostEstimate().getEstimatedCost(),
 							childResult.getCostEstimate().rowCount(),
 							childResult.getCostEstimate().singleScanRowCount());
 
@@ -989,7 +989,7 @@ class GroupByNode extends SingleChildRes
 		assignResultSetNumber();
 
 		// Get the final cost estimate from the child.
-		costEstimate = childResult.getFinalCostEstimate();
+		setCostEstimate( childResult.getFinalCostEstimate() );
 
 		/*
 		** Get the column ordering for the sort.  Note that
@@ -1049,10 +1049,10 @@ class GroupByNode extends SingleChildRes
 		mb.push(aggInfoItem);
 		mb.push(orderingItem);
 
-        mb.push(acb.addItem(resultColumns.buildRowTemplate()));
+        mb.push(acb.addItem(getResultColumns().buildRowTemplate()));
 
-		mb.push(resultColumns.getTotalColumnSize());
-		mb.push(resultSetNumber);
+		mb.push(getResultColumns().getTotalColumnSize());
+		mb.push(getResultSetNumber());
 
 		/* Generate a (Distinct)ScalarAggregateResultSet if scalar aggregates */
 		if ((groupingList == null) ||  (groupingList.size() == 0))
@@ -1088,8 +1088,8 @@ class GroupByNode extends SingleChildRes
 		String resultSet = (addDistinctAggregate) ? "getDistinctScalarAggregateResultSet" : "getScalarAggregateResultSet";
 
 		mb.push(singleInputRowOptimization);
-		mb.push(costEstimate.rowCount());
-		mb.push(costEstimate.getEstimatedCost());
+		mb.push(getCostEstimate().rowCount());
+		mb.push(getCostEstimate().getEstimatedCost());
 
 		mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null, resultSet,
                 ClassName.NoPutResultSet, 10);
@@ -1117,8 +1117,8 @@ class GroupByNode extends SingleChildRes
 		 */
 		String resultSet = (addDistinctAggregate) ? "getDistinctGroupedAggregateResultSet" : "getGroupedAggregateResultSet";
     
-		mb.push(costEstimate.rowCount());
-		mb.push(costEstimate.getEstimatedCost());
+		mb.push(getCostEstimate().rowCount());
+		mb.push(getCostEstimate().getEstimatedCost());
 		mb.push(groupingList.isRollup());
 
 		mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null, resultSet,

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/HalfOuterJoinNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/HalfOuterJoinNode.java?rev=1568436&r1=1568435&r2=1568436&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/HalfOuterJoinNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/HalfOuterJoinNode.java Fri Feb 14 18:28:21 2014
@@ -469,7 +469,7 @@ class HalfOuterJoinNode extends JoinNode
                 rightResultSet = RChild;
 
                 // rebuild the result columns and re-bind column references
-                ((HalfOuterJoinNode)leftResultSet).resultColumns = null;
+                ((HalfOuterJoinNode)leftResultSet).setResultColumns( null );
                  // localFromList is empty:
                 ((JoinNode)leftResultSet).bindResultColumns(localFromList);
 
@@ -619,7 +619,7 @@ private boolean isNullRejecting (
 	{
 		if (anyChange)
 		{
-			this.resultColumns = null;
+			setResultColumns( null );
             FromList localFromList = new FromList(
                     getOptimizerFactory().doJoinOrderOptimization(),
                     getContextManager());
@@ -722,7 +722,7 @@ private boolean isNullRejecting (
 												rightResultSet,
 												joinClause,
 												null,
-												resultColumns,
+												getResultColumns(),
 												null,
 												null,
 												getContextManager());

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/HashTableNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/HashTableNode.java?rev=1568436&r1=1568435&r2=1568436&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/HashTableNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/HashTableNode.java Fri Feb 14 18:28:21 2014
@@ -78,11 +78,11 @@ class HashTableNode extends SingleChildR
                   ContextManager cm)
 	{
         super(childResult, tableProperties, cm);
-        this.resultColumns = resultColumns;
+        setResultColumns( resultColumns );
         this.searchPredicateList = searchPredicateList;
         this.joinPredicateList = joinPredicateList;
         this.trulyTheBestAccessPath = accessPath;
-        this.costEstimate = costEstimate;
+        setCostEstimate( costEstimate );
         this.pSubqueryList = pSubqueryList;
         this.rSubqueryList = rSubqueryList;
         setHashKeyColumns(hashKeyColumns);
@@ -147,7 +147,7 @@ class HashTableNode extends SingleChildR
 							throws StandardException
 	{
 		if (SanityManager.DEBUG)
-        SanityManager.ASSERT(resultColumns != null, "Tree structure bad");
+            SanityManager.ASSERT(getResultColumns() != null, "Tree structure bad");
 
         //
         // If we are projecting and restricting the stream from a table
@@ -239,7 +239,7 @@ class HashTableNode extends SingleChildR
 
 		// Map the result columns to the source columns
         ResultColumnList.ColumnMapping  mappingArrays =
-            resultColumns.mapSourceColumns();
+            getResultColumns().mapSourceColumns();
 
         int[] mapArray = mappingArrays.mapArray;
 
@@ -288,7 +288,7 @@ class HashTableNode extends SingleChildR
 		 */
 		if (pSubqueryList != null && pSubqueryList.size() > 0)
 		{
-			pSubqueryList.setPointOfAttachment(resultSetNumber);
+			pSubqueryList.setPointOfAttachment(getResultSetNumber());
 			if (SanityManager.DEBUG)
 			{
 				SanityManager.ASSERT(pSubqueryList.size() == 0,
@@ -297,7 +297,7 @@ class HashTableNode extends SingleChildR
 		}
 		if (rSubqueryList != null && rSubqueryList.size() > 0)
 		{
-			rSubqueryList.setPointOfAttachment(resultSetNumber);
+			rSubqueryList.setPointOfAttachment(getResultSetNumber());
 			if (SanityManager.DEBUG)
 			{
 				SanityManager.ASSERT(rSubqueryList.size() == 0,
@@ -306,7 +306,7 @@ class HashTableNode extends SingleChildR
 		}
 
 		// Get the final cost estimate based on child's cost.
-		costEstimate = childResult.getFinalCostEstimate();
+		setCostEstimate( childResult.getFinalCostEstimate() );
 
 		// if there is no searchClause, we just want to pass null.
 		if (searchClause == null)
@@ -372,23 +372,23 @@ class HashTableNode extends SingleChildR
 			// as-is, with the performance trade-off as discussed above.)
 
 			/* Generate the Row function for the projection */
-			resultColumns.generateCore(acb, mb, false);
+			getResultColumns().generateCore(acb, mb, false);
 		}
 		else
 		{
 		   	mb.pushNull(ClassName.GeneratedMethod);
 		}
 
-		mb.push(resultSetNumber);
+		mb.push(getResultSetNumber());
 		mb.push(mapArrayItem);
-		mb.push(resultColumns.reusableResult());
+		mb.push(getResultColumns().reusableResult());
 		mb.push(hashKeyItem);
 		mb.push(false);
 		mb.push(-1L);
 		mb.push(initialCapacity);
 		mb.push(loadFactor);
-		mb.push(costEstimate.singleScanRowCount());
-		mb.push(costEstimate.getEstimatedCost());
+		mb.push(getCostEstimate().singleScanRowCount());
+		mb.push(getCostEstimate().getEstimatedCost());
 
 		mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null, "getHashTableResultSet",
                 ClassName.NoPutResultSet, 14);

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/IndexToBaseRowNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/IndexToBaseRowNode.java?rev=1568436&r1=1568435&r2=1568436&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/IndexToBaseRowNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/IndexToBaseRowNode.java Fri Feb 14 18:28:21 2014
@@ -71,7 +71,7 @@ class IndexToBaseRowNode extends FromTab
         super(null, tableProperties, cm);
         this.source = source;
         this.baseCD = baseCD;
-        this.resultColumns = resultColumns;
+        setResultColumns( resultColumns );
         this.cursorTargetTable = cursorTargetTable;
         this.restrictionList = restrictionList;
         this.forUpdate = forUpdate;
@@ -164,7 +164,7 @@ class IndexToBaseRowNode extends FromTab
 		assignResultSetNumber();
 
 		// Get the CostEstimate info for the underlying scan
-		costEstimate = getFinalCostEstimate();
+		setCostEstimate( getFinalCostEstimate() );
 
 		/* Put the predicates back into the tree */
 		if (restrictionList != null)
@@ -235,10 +235,10 @@ class IndexToBaseRowNode extends FromTab
         boolean skipPropagatedCols =
                 indexReferencedCols != null &&
                 indexReferencedCols.getNumBitsSet() != 0;
-        mb.push(acb.addItem(resultColumns
+        mb.push(acb.addItem(getResultColumns()
                 .buildRowTemplate(heapReferencedCols, skipPropagatedCols)));
 
-		mb.push(resultSetNumber);
+		mb.push(getResultSetNumber());
 		mb.push(source.getBaseTableName());
 		mb.push(heapColRefItem);
 
@@ -285,8 +285,8 @@ class IndexToBaseRowNode extends FromTab
 		}
 
 		mb.push(forUpdate);
-		mb.push(costEstimate.rowCount());
-		mb.push(costEstimate.getEstimatedCost());
+		mb.push(getCostEstimate().rowCount());
+		mb.push(getCostEstimate().getEstimatedCost());
 
 		mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null, "getIndexRowToBaseRowResultSet",
 						ClassName.NoPutResultSet, 14);
@@ -394,12 +394,12 @@ class IndexToBaseRowNode extends FromTab
 	 */
 	private int[] getIndexColMapping()
 	{
-		int		rclSize = resultColumns.size();
+		int		rclSize = getResultColumns().size();
 		int[]	indexColMapping = new int[rclSize];
 
 		for (int index = 0; index < rclSize; index++)
 		{
-            ResultColumn rc = resultColumns.elementAt(index);
+            ResultColumn rc = getResultColumns().elementAt(index);
 
 			if (indexReferencedCols != null && rc.getExpression() instanceof VirtualColumnNode)
 			{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/IntersectOrExceptNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/IntersectOrExceptNode.java?rev=1568436&r1=1568435&r2=1568436&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/IntersectOrExceptNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/IntersectOrExceptNode.java Fri Feb 14 18:28:21 2014
@@ -378,7 +378,7 @@ public class IntersectOrExceptNode exten
 		assignResultSetNumber();
 
 		// Get our final cost estimate based on the child estimates.
-		costEstimate = getFinalCostEstimate();
+		setCostEstimate( getFinalCostEstimate() );
 
 		// build up the tree.
 
@@ -402,9 +402,9 @@ public class IntersectOrExceptNode exten
 		getRightResultSet().generate( acb, mb);
 
 		acb.pushThisAsActivation(mb);
-		mb.push(resultSetNumber);
-        mb.push( costEstimate.getEstimatedRowCount());
-        mb.push( costEstimate.getEstimatedCost());
+		mb.push(getResultSetNumber());
+        mb.push( getCostEstimate().getEstimatedRowCount());
+        mb.push( getCostEstimate().getEstimatedCost());
         mb.push( getOpType());
         mb.push( all);
         mb.push( getCompilerContext().addSavedObject( intermediateOrderByColumns));
@@ -431,20 +431,22 @@ public class IntersectOrExceptNode exten
     CostEstimate getFinalCostEstimate()
 		throws StandardException
 	{
-		if (finalCostEstimate != null)
-			return finalCostEstimate;
+		if (getCandidateFinalCostEstimate() != null)
+        {
+			return getCandidateFinalCostEstimate();
+        }
 
 		CostEstimate leftCE = leftResultSet.getFinalCostEstimate();
 		CostEstimate rightCE = rightResultSet.getFinalCostEstimate();
 
-		finalCostEstimate = getNewCostEstimate();
-		finalCostEstimate.setCost(
+		setCandidateFinalCostEstimate( getNewCostEstimate() );
+		getCandidateFinalCostEstimate().setCost(
 			leftCE.getEstimatedCost() + rightCE.getEstimatedCost(),
 			getRowCountEstimate(leftCE.rowCount(), rightCE.rowCount()),
 			getSingleScanRowCountEstimate(leftCE.singleScanRowCount(),
 				rightCE.singleScanRowCount()));
 
-		return finalCostEstimate;
+		return getCandidateFinalCostEstimate();
 	}
 
     String getOperatorName()

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JoinNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JoinNode.java?rev=1568436&r1=1568435&r2=1568436&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JoinNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JoinNode.java Fri Feb 14 18:28:21 2014
@@ -110,7 +110,7 @@ class JoinNode extends TableOperatorNode
              ContextManager   cm) throws StandardException {
 
         super(leftResult, rightResult, tableProperties, cm);
-        this.resultColumns = selectList;
+        setResultColumns( selectList );
         this.joinClause = onClause;
         this.joinClauseNormalized = false;
         this.usingClause = usingClause;
@@ -119,7 +119,7 @@ class JoinNode extends TableOperatorNode
 		/* JoinNodes can be generated in the parser or at the end of optimization.
 		 * Those generated in the parser do not have resultColumns yet.
 		 */
-        if (this.resultColumns != null)
+        if (getResultColumns() != null)
 		{
 			/* A longer term assertion */
 			if (SanityManager.DEBUG)
@@ -134,10 +134,10 @@ class JoinNode extends TableOperatorNode
 			/* Build the referenced table map (left || right) */
 			if (leftResultSet.getReferencedTableMap() != null)
 			{
-                this.referencedTableMap =
-                        (JBitSet) leftResultSet.getReferencedTableMap().clone();
-                this.referencedTableMap.or(
-                        rightResultSet.getReferencedTableMap());
+                setReferencedTableMap
+                    ( (JBitSet) leftResultSet.getReferencedTableMap().clone() );
+                getReferencedTableMap().or
+                    ( rightResultSet.getReferencedTableMap() );
 			}
 		}
 
@@ -224,13 +224,13 @@ class JoinNode extends TableOperatorNode
 							getRightPredicateList(),
 							leftResultSet.getCostEstimate());
 
-		costEstimate = getCostEstimate(optimizer);
+		setCostEstimate( getCostEstimate(optimizer) );
 
 		/*
 		** We add the costs for the inner and outer table, but the number
 		** of rows is that for the inner table only.
 		*/
-		costEstimate.setCost(
+		getCostEstimate().setCost(
 			leftResultSet.getCostEstimate().getEstimatedCost() +
 			rightResultSet.getCostEstimate().getEstimatedCost(),
 			rightResultSet.getCostEstimate().rowCount(),
@@ -242,7 +242,7 @@ class JoinNode extends TableOperatorNode
 		** So, adjust this value now. This method does nothing for most
 		** join types.
 		*/
-		adjustNumberOfRowsReturned(costEstimate);
+		adjustNumberOfRowsReturned(getCostEstimate());
 
 		/*
 		** Get the cost of this result set in the context of the whole plan.
@@ -255,10 +255,10 @@ class JoinNode extends TableOperatorNode
 							(ConglomerateDescriptor) null,
 							outerCost,
 							optimizer,
-							costEstimate
+							getCostEstimate()
 							);
 
-		optimizer.considerCost(this, predList, costEstimate, outerCost);
+		optimizer.considerCost(this, predList, getCostEstimate(), outerCost);
 
 		/* Optimize subqueries only once, no matter how many times we're called */
 		if ( (! optimized) && (subqueryList != null))
@@ -267,13 +267,13 @@ class JoinNode extends TableOperatorNode
 		 	* Also need to figure out the pushing of the joinClause.
 		 	*/
 			subqueryList.optimize(optimizer.getDataDictionary(),
-									costEstimate.rowCount());
+                                  getCostEstimate().rowCount());
 			subqueryList.modifyAccessPaths();
 		}
 
 		optimized = true;
 
-		return costEstimate;
+		return getCostEstimate();
 	}
 
 	/**
@@ -600,9 +600,9 @@ class JoinNode extends TableOperatorNode
 		 * for the ColumnReference will be from the wrong ResultSet
 		 * at generate().)
 		 */
-		if (resultColumns != null)
+		if (getResultColumns() != null)
 		{
-            for (ResultColumn rc : resultColumns)
+            for (ResultColumn rc : getResultColumns())
 			{
 				VirtualColumnNode vcn = (VirtualColumnNode) rc.getExpression();
 				if (resultColumn == vcn.getSourceColumn())
@@ -729,7 +729,7 @@ class JoinNode extends TableOperatorNode
 		 * exist.  This can happen in the degenerate case of an insert
 		 * select with a join expression in a derived table within the select.
 		 */
-		if (resultColumns != null)
+		if (getResultColumns() != null)
 		{
 			return;
 		}
@@ -741,15 +741,15 @@ class JoinNode extends TableOperatorNode
 		/* We get a shallow copy of the left's ResultColumnList and its 
 		 * ResultColumns.  (Copy maintains ResultColumn.expression for now.)
 		 */
-		resultColumns = leftResultSet.getResultColumns();
-		leftRCL = resultColumns.copyListAndObjects();
+		setResultColumns( leftResultSet.getResultColumns() );
+		leftRCL = getResultColumns().copyListAndObjects();
 		leftResultSet.setResultColumns(leftRCL);
 
 		/* Replace ResultColumn.expression with new VirtualColumnNodes
 		 * in the ProjectRestrictNode's ResultColumnList.  (VirtualColumnNodes include
 		 * pointers to source ResultSetNode, this, and source ResultColumn.)
 		 */
-		resultColumns.genVirtualColumnNodes(leftResultSet, leftRCL, false);
+		getResultColumns().genVirtualColumnNodes(leftResultSet, leftRCL, false);
 
 		/*
 		** If this is a right outer join, we can get nulls on the left side,
@@ -757,7 +757,7 @@ class JoinNode extends TableOperatorNode
 		*/
 		if (this instanceof HalfOuterJoinNode && ((HalfOuterJoinNode)this).isRightOuterJoin())
 		{
-			resultColumns.setNullability(true);
+			getResultColumns().setNullability(true);
 		}
 
 		/* Now, repeat the process with the right's RCL */
@@ -770,7 +770,7 @@ class JoinNode extends TableOperatorNode
 		 * pointers to source ResultSetNode, this, and source ResultColumn.)
 		 */
 		tmpRCL.genVirtualColumnNodes(rightResultSet, rightRCL, false);
-		tmpRCL.adjustVirtualColumnIds(resultColumns.size());
+		tmpRCL.adjustVirtualColumnIds(getResultColumns().size());
 
 		/*
 		** If this is a left outer join, we can get nulls on the right side,
@@ -784,7 +784,7 @@ class JoinNode extends TableOperatorNode
 		/* Now we append the propagated RCL from the right to the one from
 		 * the left and call it our own.
 		 */
-		resultColumns.nondestructiveAppend(tmpRCL);
+		getResultColumns().nondestructiveAppend(tmpRCL);
 	}
 
 	private void deferredBindExpressions(FromList fromListParam)
@@ -1100,7 +1100,7 @@ class JoinNode extends TableOperatorNode
     {
         leftResultSet.projectResultColumns();
         rightResultSet.projectResultColumns();
-        resultColumns.pullVirtualIsReferenced();
+        getResultColumns().pullVirtualIsReferenced();
         super.projectResultColumns();
     }
     
@@ -1453,7 +1453,7 @@ class JoinNode extends TableOperatorNode
 		fromList.addElement((FromTable) rightResultSet);
 
 		/* Mark our RCL as redundant */
-		resultColumns.setRedundant();
+		getResultColumns().setRedundant();
 
 		/* Remap all ColumnReferences from the outer query to this node.
 		 * (We replace those ColumnReferences with clones of the matching
@@ -1596,7 +1596,7 @@ class JoinNode extends TableOperatorNode
 		 */
 		if (subquerys != null && subquerys.size() > 0)
 		{
-			subquerys.setPointOfAttachment(resultSetNumber);
+			subquerys.setPointOfAttachment(getResultSetNumber());
 		}
 
 		// build up the tree.
@@ -1644,12 +1644,12 @@ class JoinNode extends TableOperatorNode
 		int numArgs = getNumJoinArguments();
 
 		leftResultSet.generate(acb, mb); // arg 1
-		mb.push(leftResultSet.resultColumns.size()); // arg 2
+		mb.push(leftResultSet.getResultColumns().size()); // arg 2
 		rightResultSet.generate(acb, mb); // arg 3
-		mb.push(rightResultSet.resultColumns.size()); // arg 4
+		mb.push(rightResultSet.getResultColumns().size()); // arg 4
 
 		// Get our final cost estimate based on child estimates.
-		costEstimate = getFinalCostEstimate();
+		setCostEstimate( getFinalCostEstimate() );
 
 		// for the join clause, we generate an exprFun
 		// that evaluates the expression of the clause
@@ -1700,7 +1700,7 @@ class JoinNode extends TableOperatorNode
    			acb.pushMethodReference(mb, userExprFun); // arg 5
 		}
 
-		mb.push(resultSetNumber); // arg 6
+		mb.push(getResultSetNumber()); // arg 6
 
 		addOuterJoinArguments(acb, mb);
 
@@ -1708,10 +1708,10 @@ class JoinNode extends TableOperatorNode
 		oneRowRightSide(acb, mb);
 
 		// estimated row count
-		mb.push(costEstimate.rowCount());
+		mb.push(getCostEstimate().rowCount());
 
 		// estimated cost
-		mb.push(costEstimate.getEstimatedCost());
+		mb.push(getCostEstimate().getEstimatedCost());
 
 		//User may have supplied optimizer overrides in the sql
 		//Pass them onto execute phase so it can be shown in 
@@ -1739,19 +1739,21 @@ class JoinNode extends TableOperatorNode
 		throws StandardException
 	{
 		// If we already found it, just return it.
-		if (finalCostEstimate != null)
-			return finalCostEstimate;
+		if (getCandidateFinalCostEstimate() != null)
+        {
+			return getCandidateFinalCostEstimate();
+        }
 
 		CostEstimate leftCE = leftResultSet.getFinalCostEstimate();
 		CostEstimate rightCE = rightResultSet.getFinalCostEstimate();
 
-		finalCostEstimate = getNewCostEstimate();
-		finalCostEstimate.setCost(
+		setCandidateFinalCostEstimate( getNewCostEstimate() );
+		getCandidateFinalCostEstimate().setCost(
 			leftCE.getEstimatedCost() + rightCE.getEstimatedCost(),
 			rightCE.rowCount(),
 			rightCE.rowCount());
 
-		return finalCostEstimate;
+		return getCandidateFinalCostEstimate();
 	}
 
     void oneRowRightSide(ActivationClassBuilder acb, MethodBuilder mb)
@@ -1997,9 +1999,9 @@ class JoinNode extends TableOperatorNode
 	{
 		super.acceptChildren(v);
 
-		if (resultColumns != null)
+		if (getResultColumns() != null)
 		{
-			resultColumns = (ResultColumnList)resultColumns.accept(v);
+			setResultColumns( (ResultColumnList)getResultColumns().accept(v) );
 		}
 
 		if (joinClause != null)

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MatchingClauseNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MatchingClauseNode.java?rev=1568436&r1=1568435&r2=1568436&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MatchingClauseNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MatchingClauseNode.java Fri Feb 14 18:28:21 2014
@@ -317,7 +317,7 @@ public class MatchingClauseNode extends 
         //
         ResultColumnList    beforeColumns = new ResultColumnList( getContextManager() );
         ResultColumnList    afterColumns = new ResultColumnList( getContextManager() );
-        ResultColumnList    fullUpdateRow = getBoundSelectUnderUpdate().resultColumns;
+        ResultColumnList    fullUpdateRow = getBoundSelectUnderUpdate().getResultColumns();
         
         // the full row is the before image, the after image, and a row location
         int     rowSize = fullUpdateRow.size() / 2;
@@ -714,7 +714,7 @@ public class MatchingClauseNode extends 
     private void    buildThenColumnsForDelete()
         throws StandardException
     {
-        ResultColumnList    dmlSignature = _dml.resultSet.resultColumns;
+        ResultColumnList    dmlSignature = _dml.resultSet.getResultColumns();
         for ( int i = 0; i < dmlSignature.size(); i++ )
         {
             ResultColumn    origRC = dmlSignature.elementAt( i );
@@ -816,7 +816,7 @@ public class MatchingClauseNode extends 
 
         _dml.bindStatement();
 
-        buildThenColumnsForInsert( fullFromList, targetTable, _dml.resultSet.resultColumns, _insertColumns, _insertValues );
+        buildThenColumnsForInsert( fullFromList, targetTable, _dml.resultSet.getResultColumns(), _insertColumns, _insertValues );
     }
 
     /**  Bind the values in the INSERT list */
@@ -1409,7 +1409,7 @@ public class MatchingClauseNode extends 
          )
         throws StandardException
     {
-        ResultColumnList    leftJoinResult = generatedScan.resultColumns;
+        ResultColumnList    leftJoinResult = generatedScan.getResultColumns();
         CollectNodesVisitor<ColumnReference> getCRs =
             new CollectNodesVisitor<ColumnReference>( ColumnReference.class );
         _thenColumns.accept( getCRs );

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MaterializeResultSetNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MaterializeResultSetNode.java?rev=1568436&r1=1568435&r2=1568436&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MaterializeResultSetNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MaterializeResultSetNode.java Fri Feb 14 18:28:21 2014
@@ -51,7 +51,7 @@ class MaterializeResultSetNode extends S
                              Properties tableProperties,
                              ContextManager cm) {
         super(childResult, tableProperties, cm);
-        resultColumns = rcl;
+        setResultColumns( rcl );
 	}
 
 	/**
@@ -79,7 +79,7 @@ class MaterializeResultSetNode extends S
 							throws StandardException
 	{
 		if (SanityManager.DEBUG)
-        SanityManager.ASSERT(resultColumns != null, "Tree structure bad");
+            SanityManager.ASSERT(getResultColumns() != null, "Tree structure bad");
 
 		/* Get the next ResultSet #, so that we can number this ResultSetNode, its
 		 * ResultColumnList and ResultSet.
@@ -87,7 +87,7 @@ class MaterializeResultSetNode extends S
 		assignResultSetNumber();
 
 		// Get the cost estimate from the child if we don't have one yet
-		costEstimate = childResult.getFinalCostEstimate();
+		setCostEstimate( childResult.getFinalCostEstimate() );
 
 		// build up the tree.
 
@@ -95,9 +95,9 @@ class MaterializeResultSetNode extends S
 		acb.pushGetResultSetFactoryExpression(mb);
 
 		childResult.generate(acb, mb);
-		mb.push(resultSetNumber);
-		mb.push(costEstimate.rowCount());
-		mb.push(costEstimate.getEstimatedCost());
+		mb.push(getResultSetNumber());
+		mb.push(getCostEstimate().rowCount());
+		mb.push(getCostEstimate().getEstimatedCost());
 
 		mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null, "getMaterializedResultSet",
 						ClassName.NoPutResultSet, 4);

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MergeNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MergeNode.java?rev=1568436&r1=1568435&r2=1568436&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MergeNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MergeNode.java Fri Feb 14 18:28:21 2014
@@ -293,7 +293,7 @@ public final class MergeNode extends DML
      */
     private void    forbidDerivedColumnLists() throws StandardException
     {
-        if ( (_sourceTable.resultColumns != null) || (_targetTable.resultColumns != null) )
+        if ( (_sourceTable.getResultColumns() != null) || (_targetTable.getResultColumns() != null) )
         {
             throw StandardException.newException( SQLState.LANG_NO_DCL_IN_MERGE );
         }
@@ -527,7 +527,7 @@ public final class MergeNode extends DML
                 (
                  source.methodCall,
                  source.correlationName,
-                 source.resultColumns,
+                 source.getResultColumns(),
                  null,
                  source.exposedName,
                  getContextManager()

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NormalizeResultSetNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NormalizeResultSetNode.java?rev=1568436&r1=1568435&r2=1568436&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NormalizeResultSetNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NormalizeResultSetNode.java Fri Feb 14 18:28:21 2014
@@ -592,7 +592,7 @@ class NormalizeResultSetNode extends Sin
 		 */
         prRCList.genVirtualColumnNodes(chldRes, chldRes.getResultColumns());
         
-		this.resultColumns = prRCList;
+		setResultColumns( prRCList );
 		// Propagate the referenced table map if it's already been created
         if (chldRes.getReferencedTableMap() != null)
 		    {
@@ -601,10 +601,10 @@ class NormalizeResultSetNode extends Sin
         
         
 		if (targetResultColumnList != null) {
-		    int size = Math.min(targetRCL.size(), resultColumns.size());
+		    int size = Math.min(targetRCL.size(), getResultColumns().size());
 
             for (int index = 0; index < size; index++) {
-                ResultColumn sourceRC = resultColumns.elementAt(index);
+                ResultColumn sourceRC = getResultColumns().elementAt(index);
                 ResultColumn resultColumn = targetRCL.elementAt(index);
                 sourceRC.setType(resultColumn.getTypeServices());
 		    }
@@ -624,7 +624,7 @@ class NormalizeResultSetNode extends Sin
 		int				erdNumber;
 
 		if (SanityManager.DEBUG)
-        SanityManager.ASSERT(resultColumns != null, "Tree structure bad");
+            SanityManager.ASSERT(getResultColumns() != null, "Tree structure bad");
 
 		/* Get the next ResultSet #, so that we can number this ResultSetNode, its
 		 * ResultColumnList and ResultSet.
@@ -636,16 +636,16 @@ class NormalizeResultSetNode extends Sin
 		// Generate the child ResultSet
 
 		// Get the cost estimate for the child
-		costEstimate = childResult.getFinalCostEstimate();
+		setCostEstimate( childResult.getFinalCostEstimate() );
 
 		erdNumber = acb.addItem(makeResultDescription());
 
 		acb.pushGetResultSetFactoryExpression(mb);
 		childResult.generate(acb, mb);
-		mb.push(resultSetNumber);
+		mb.push(getResultSetNumber());
 		mb.push(erdNumber);
-		mb.push(costEstimate.rowCount());
-		mb.push(costEstimate.getEstimatedCost());
+		mb.push(getCostEstimate().rowCount());
+		mb.push(getCostEstimate().getEstimatedCost());
 		mb.push(forUpdate);
 
 		mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null, "getNormalizeResultSet",

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrderByNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrderByNode.java?rev=1568436&r1=1568435&r2=1568436&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrderByNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrderByNode.java Fri Feb 14 18:28:21 2014
@@ -68,14 +68,14 @@ class OrderByNode extends SingleChildRes
         // (Copy maintains ResultColumn.expression for now.)
         final ResultColumnList prRCList =
             childRes.getResultColumns().copyListAndObjects();
-        this.resultColumns = childRes.getResultColumns();
+        setResultColumns( childRes.getResultColumns() );
         childRes.setResultColumns(prRCList);
 
 		/* Replace ResultColumn.expression with new VirtualColumnNodes
 		 * in the DistinctNode's RCL.  (VirtualColumnNodes include
 		 * pointers to source ResultSetNode, this, and source ResultColumn.)
 		 */
-        this.resultColumns.genVirtualColumnNodes(this, prRCList);
+        getResultColumns().genVirtualColumnNodes(this, prRCList);
 	}
 
 
@@ -117,9 +117,9 @@ class OrderByNode extends SingleChildRes
 							throws StandardException
 	{
 		// Get the cost estimate for the child
-		if (costEstimate == null)
+		if (getCostEstimate() == null)
 		{
-			costEstimate = childResult.getFinalCostEstimate();
+			setCostEstimate( childResult.getFinalCostEstimate() );
 		}
 
 	    orderByList.generate(acb, mb, childResult);
@@ -135,7 +135,7 @@ class OrderByNode extends SingleChildRes
 		// code generation for the PRN above us will fail when calling
 		// resultColumns.generateCore -> VCN.generateExpression, cf. the Sanity
 		// assert in VCN.generateExpression on sourceResultSetNumber >= 0.
-		resultSetNumber = orderByList.getResultSetNumber();
-		resultColumns.setResultSetNumber(resultSetNumber);
+		setResultSetNumber( orderByList.getResultSetNumber() );
+		getResultColumns().setResultSetNumber(getResultSetNumber());
 	}
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java?rev=1568436&r1=1568435&r2=1568436&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java Fri Feb 14 18:28:21 2014
@@ -1533,7 +1533,7 @@ class PredicateList extends QueryTreeNod
                 AndNode newAnd =
                         new AndNode(leftOperand, trueNode, getContextManager());
 				newAnd.postBindFixup();
-				JBitSet tableMap = new JBitSet(select.referencedTableMap.size());
+				JBitSet tableMap = new JBitSet(select.getReferencedTableMap().size());
 
 				// Use newly constructed predicate
                 predicate =