db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r1495305 [15/21] - in /db/derby/code/trunk: java/engine/org/apache/derby/ java/engine/org/apache/derby/catalog/types/ java/engine/org/apache/derby/iapi/services/io/ java/engine/org/apache/derby/iapi/sql/ java/engine/org/apache/derby/iapi/sq...
Date Fri, 21 Jun 2013 07:47:52 GMT
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RowResultSetNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RowResultSetNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RowResultSetNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RowResultSetNode.java Fri Jun 21 07:47:47 2013
@@ -23,41 +23,35 @@ package	org.apache.derby.impl.sql.compil
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Properties;
+import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.reference.ClassName;
+import org.apache.derby.iapi.reference.SQLState;
+import org.apache.derby.iapi.services.classfile.VMOpcode;
+import org.apache.derby.iapi.services.compiler.MethodBuilder;
+import org.apache.derby.iapi.services.context.ContextManager;
+import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.sql.compile.CostEstimate;
-import org.apache.derby.iapi.sql.compile.Optimizer;
 import org.apache.derby.iapi.sql.compile.Optimizable;
 import org.apache.derby.iapi.sql.compile.OptimizablePredicateList;
+import org.apache.derby.iapi.sql.compile.Optimizer;
 import org.apache.derby.iapi.sql.compile.RequiredRowOrdering;
 import org.apache.derby.iapi.sql.compile.RowOrdering;
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
-
-import org.apache.derby.iapi.sql.dictionary.DataDictionary;
 import org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor;
+import org.apache.derby.iapi.sql.dictionary.DataDictionary;
 import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
-
-import org.apache.derby.iapi.error.StandardException;
-
-import org.apache.derby.iapi.services.compiler.MethodBuilder;
-
 import org.apache.derby.iapi.store.access.Qualifier;
-
-import org.apache.derby.iapi.services.sanity.SanityManager;
-
 import org.apache.derby.iapi.types.DataTypeDescriptor;
 import org.apache.derby.iapi.types.TypeId;
-
 import org.apache.derby.iapi.util.JBitSet;
-import org.apache.derby.iapi.reference.SQLState;
-import org.apache.derby.iapi.reference.ClassName;
-import org.apache.derby.iapi.services.classfile.VMOpcode;
-
 
 /**
  * A RowResultSetNode represents the result set for a VALUES clause.
  *
  */
 
-public class RowResultSetNode extends FromTable
+class RowResultSetNode extends FromTable
 {
 	SubqueryList subquerys;
     private List<AggregateNode> aggregates;
@@ -67,17 +61,22 @@ public class RowResultSetNode extends Fr
     boolean   hasJDBClimitClause; //  were OFFSET/FETCH FIRST specified by a JDBC LIMIT clause?
 
 	/**
-	 * Initializer for a RowResultSetNode.
+     * Constructor for a RowResultSetNode.
 	 *
 	 * @param valuesClause	The result column list for the VALUES clause.
 	 * @param tableProperties	Properties list associated with the table
+     * @param cm            The context manager
 	 */
-	public void init(Object valuesClause, Object tableProperties)
-	{
-		super.init(null, tableProperties);
-		resultColumns = (ResultColumnList) valuesClause;
-		if (resultColumns != null)
+    RowResultSetNode(ResultColumnList valuesClause,
+                     Properties tableProperties,
+                     ContextManager cm) {
+        super(null /* correlationName */, tableProperties, cm);
+        setNodeType(C_NodeTypes.ROW_RESULT_SET_NODE);
+        resultColumns = valuesClause;
+
+        if (resultColumns != null) {
 			resultColumns.markInitialSize();
+        }
 	}
 
 	/**
@@ -86,7 +85,7 @@ public class RowResultSetNode extends Fr
 	 *
 	 * @return	This object as a String
 	 */
-
+    @Override
 	public String toString()
 	{
 		if (SanityManager.DEBUG)
@@ -101,7 +100,7 @@ public class RowResultSetNode extends Fr
 		}
 	}
 
-	public String statementToString()
+    String statementToString()
 	{
 		return "VALUES";
 	}
@@ -112,8 +111,8 @@ public class RowResultSetNode extends Fr
 	 *
 	 * @param depth		The depth of this node in the tree
 	 */
-
-	public void printSubNodes(int depth)
+    @Override
+    void printSubNodes(int depth)
 	{
 		if (SanityManager.DEBUG)
 		{
@@ -146,6 +145,7 @@ public class RowResultSetNode extends Fr
 	/**
 	 * Modify the RCL of this node to match the target of the insert.
 	 */
+    @Override
 	ResultSetNode enhanceRCLForInsert(
 			InsertNode target, boolean inOrder, int[] colMap)
 		throws StandardException
@@ -165,6 +165,7 @@ public class RowResultSetNode extends Fr
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
 	public CostEstimate estimateCost(OptimizablePredicateList predList,
 										ConglomerateDescriptor cd,
 										CostEstimate outerCost,
@@ -201,8 +202,8 @@ public class RowResultSetNode extends Fr
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
-	public ResultSetNode bindNonVTITables(DataDictionary dataDictionary, 
+    @Override
+    ResultSetNode bindNonVTITables(DataDictionary dataDictionary,
 							FromList fromListParam) 
 					throws StandardException
 	{
@@ -221,15 +222,13 @@ public class RowResultSetNode extends Fr
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
-	public void bindExpressions(FromList fromListParam)
+    @Override
+    void bindExpressions(FromList fromListParam)
 					throws StandardException
 	{
 		int nestingLevel;
 
-		subquerys = (SubqueryList) getNodeFactory().getNode(
-										C_NodeTypes.SUBQUERY_LIST,
-										getContextManager());
+        subquerys = new SubqueryList(getContextManager());
 
         aggregates = new ArrayList<AggregateNode>();
 
@@ -288,11 +287,11 @@ public class RowResultSetNode extends Fr
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public void bindExpressionsWithTables(FromList fromListParam)
+    @Override
+    void bindExpressionsWithTables(FromList fromListParam)
 					throws StandardException
 	{
 		/* We don't have any tables, so just return */
-		return;
 	}
 
 	/**
@@ -304,8 +303,8 @@ public class RowResultSetNode extends Fr
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
-	public void bindTargetExpressions(FromList fromListParam)
+    @Override
+    void bindTargetExpressions(FromList fromListParam)
 					throws StandardException
 	{
 		bindExpressions(fromListParam);
@@ -318,7 +317,8 @@ public class RowResultSetNode extends Fr
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public void bindUntypedNullsToResultColumns(ResultColumnList bindingRCL)
+    @Override
+    void bindUntypedNullsToResultColumns(ResultColumnList bindingRCL)
 				throws StandardException
 	{
 		/*
@@ -349,8 +349,8 @@ public class RowResultSetNode extends Fr
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
-	public ResultColumn getMatchingColumn(
+    @Override
+    ResultColumn getMatchingColumn(
 						ColumnReference columnReference)
 						throws StandardException
 	{
@@ -365,7 +365,8 @@ public class RowResultSetNode extends Fr
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public String getExposedName() throws StandardException
+    @Override
+    String getExposedName() throws StandardException
 	{
 		return null;
 	}
@@ -378,10 +379,10 @@ public class RowResultSetNode extends Fr
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public void verifySelectStarSubquery(FromList outerFromList, int subqueryType) 
+    @Override
+    void verifySelectStarSubquery(FromList outerFromList, int subqueryType)
 					throws StandardException
 	{
-		return; 
 	}
 
 	/**
@@ -392,6 +393,7 @@ public class RowResultSetNode extends Fr
 	 *
 	 * @param orderByList	The order by list
 	 */
+    @Override
 	void pushOrderByList(OrderByList orderByList)
 	{
 		this.orderByList = orderByList;
@@ -404,6 +406,7 @@ public class RowResultSetNode extends Fr
      * @param fetchFirst the OFFSET FIRST, if any
      * @param hasJDBClimitClause true if the clauses were added by (and have the semantics of) a JDBC limit clause
      */
+    @Override
     void pushOffsetFetchFirst( ValueNode offset, ValueNode fetchFirst, boolean hasJDBClimitClause )
     {
         this.offset = offset;
@@ -436,8 +439,8 @@ public class RowResultSetNode extends Fr
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
-	public ResultSetNode preprocess(int numTables,
+    @Override
+    ResultSetNode preprocess(int numTables,
 									GroupByList gbl,
 									FromList fromList)
 								throws StandardException
@@ -446,17 +449,12 @@ public class RowResultSetNode extends Fr
 		if (subquerys.size() > 0)
 		{
 			subquerys.preprocess(
-								numTables,
-								(FromList) getNodeFactory().getNode(
-									C_NodeTypes.FROM_LIST,
-									getNodeFactory().doJoinOrderOptimization(),
-									getContextManager()),
-								(SubqueryList) getNodeFactory().getNode(
-													C_NodeTypes.SUBQUERY_LIST,
-													getContextManager()),
-								(PredicateList) getNodeFactory().getNode(
-													C_NodeTypes.PREDICATE_LIST,
-													getContextManager()));
+                numTables,
+                new FromList(
+                    getOptimizerFactory().doJoinOrderOptimization(),
+                    getContextManager()),
+                new SubqueryList(getContextManager()),
+                new PredicateList(getContextManager()));
 		}
 
 		/* Allocate a dummy referenced table map */ 
@@ -483,7 +481,8 @@ public class RowResultSetNode extends Fr
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public ResultSetNode ensurePredicateList(int numTables) 
+    @Override
+    ResultSetNode ensurePredicateList(int numTables)
 		throws StandardException
 	{
 		return genProjectRestrict(numTables);
@@ -500,7 +499,8 @@ public class RowResultSetNode extends Fr
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public ResultSetNode addNewPredicate(Predicate predicate)
+    @Override
+    ResultSetNode addNewPredicate(Predicate predicate)
 			throws StandardException
 	{
 		PredicateList		predList;
@@ -525,14 +525,10 @@ public class RowResultSetNode extends Fr
 		prRCList.genVirtualColumnNodes(this, resultColumns);
 
 		/* Put the new predicate in a list */
-		predList = (PredicateList) getNodeFactory().getNode(
-										C_NodeTypes.PREDICATE_LIST,
-										getContextManager());
+        predList = new PredicateList(getContextManager());
 		predList.addPredicate(predicate);
 
-		/* Finally, we create the new ProjectRestrictNode */
-		return (ResultSetNode) getNodeFactory().getNode(
-								C_NodeTypes.PROJECT_RESTRICT_NODE,
+        return new ProjectRestrictNode(
 								this,
 								prRCList,
 								null,	/* Restriction */
@@ -558,7 +554,8 @@ public class RowResultSetNode extends Fr
 	 *
 	 * @return boolean	Whether or not the FromSubquery is flattenable.
 	 */
-	public boolean flattenableInFromSubquery(FromList fromList)
+    @Override
+    boolean flattenableInFromSubquery(FromList fromList)
 	{
 		if ((subquerys != null) &&
 			(subquerys.size() > 0))
@@ -617,7 +614,8 @@ public class RowResultSetNode extends Fr
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public ResultSetNode optimize(DataDictionary dataDictionary,
+    @Override
+    ResultSetNode optimize(DataDictionary dataDictionary,
 								  PredicateList	predicateList,
 								  double outerRows) 
 			throws StandardException
@@ -627,16 +625,14 @@ public class RowResultSetNode extends Fr
 		** CostEstimate object, so we can represent the cost of this node.
 		** This seems like overkill, but it's just an object allocation...
 		*/
-		Optimizer optimizer =
-					getOptimizer(
-								(FromList) getNodeFactory().getNode(
-									C_NodeTypes.FROM_LIST,
-									getNodeFactory().doJoinOrderOptimization(),
-									getContextManager()),
-								predicateList,
-								dataDictionary,
-								(RequiredRowOrdering) null);
-		costEstimate = optimizer.newCostEstimate();
+        Optimizer opt = getOptimizer(
+                new FromList(getOptimizerFactory().doJoinOrderOptimization(),
+                             getContextManager()),
+                predicateList,
+                dataDictionary,
+                (RequiredRowOrdering) null);
+
+        costEstimate = opt.newCostEstimate();
 
 		// RESOLVE: THE COST SHOULD TAKE SUBQUERIES INTO ACCOUNT
 		costEstimate.setCost(0.0d, outerRows, outerRows);
@@ -650,6 +646,7 @@ public class RowResultSetNode extends Fr
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
 	public Optimizable modifyAccessPath(JBitSet outerTables) throws StandardException
 	{
 		/* For most types of Optimizable, do nothing */
@@ -661,7 +658,8 @@ public class RowResultSetNode extends Fr
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public ResultSetNode modifyAccessPaths() throws StandardException
+    @Override
+    ResultSetNode modifyAccessPaths() throws StandardException
 	{
 		ResultSetNode treeTop = this;
 
@@ -672,12 +670,10 @@ public class RowResultSetNode extends Fr
 		 */
 		if (orderByList != null)
 		{
-			treeTop = (ResultSetNode) getNodeFactory().getNode(
-											C_NodeTypes.ORDER_BY_NODE,
-											treeTop,
-											orderByList,
-											tableProperties,
-											getContextManager());
+            treeTop = new OrderByNode(treeTop,
+                                      orderByList,
+                                      tableProperties,
+                                      getContextManager());
 		}
 
         if (offset != null || fetchFirst != null) {
@@ -685,13 +681,12 @@ public class RowResultSetNode extends Fr
                 treeTop.getResultColumns().copyListAndObjects();
             newRcl.genVirtualColumnNodes(treeTop, treeTop.getResultColumns());
 
-            treeTop = (ResultSetNode)getNodeFactory().getNode(
-                C_NodeTypes.ROW_COUNT_NODE,
+            treeTop = new RowCountNode(
                 treeTop,
                 newRcl,
                 offset,
                 fetchFirst,
-                Boolean.valueOf( hasJDBClimitClause ),
+                hasJDBClimitClause,
                 getContextManager());
         }
 
@@ -706,6 +701,7 @@ public class RowResultSetNode extends Fr
 	 * @return Whether or not this ResultSet tree is guaranteed to return
 	 * at most 1 row based on heuristics.
 	 */
+    @Override
 	boolean returnsAtMostOneRow()
 	{
 		return true;
@@ -719,6 +715,7 @@ public class RowResultSetNode extends Fr
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
 	void setTableConstructorTypes(ResultColumnList typeColumns)
 			throws StandardException
 	{
@@ -869,6 +866,7 @@ public class RowResultSetNode extends Fr
 	 *
 	 * @exception StandardException		Thrown on error
      */
+    @Override
     void generate(ActivationClassBuilder acb, MethodBuilder mb)
 							throws StandardException
 	{
@@ -921,6 +919,7 @@ public class RowResultSetNode extends Fr
 	/**
      * {@inheritDoc}
 	 */
+    @Override
 	void replaceOrForbidDefaults(TableDescriptor ttd,
                                  ResultColumnList tcl,
                                  boolean allowDefaults)
@@ -936,6 +935,7 @@ public class RowResultSetNode extends Fr
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
 	void optimizeSubqueries(DataDictionary dd, double rowCount)
 		throws StandardException
 	{
@@ -945,6 +945,7 @@ public class RowResultSetNode extends Fr
 	/**
 	 * @see ResultSetNode#adjustForSortElimination
 	 */
+    @Override
 	void adjustForSortElimination()
 	{
 	}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SQLToJavaValueNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SQLToJavaValueNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SQLToJavaValueNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SQLToJavaValueNode.java Fri Jun 21 07:47:47 2013
@@ -21,32 +21,27 @@
 
 package	org.apache.derby.impl.sql.compile;
 
-import org.apache.derby.iapi.services.compiler.MethodBuilder;
+import java.lang.reflect.Modifier;
+import java.util.List;
+import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.reference.ClassName;
+import org.apache.derby.iapi.services.classfile.VMOpcode;
 import org.apache.derby.iapi.services.compiler.LocalField;
-
+import org.apache.derby.iapi.services.compiler.MethodBuilder;
+import org.apache.derby.iapi.services.context.ContextManager;
 import org.apache.derby.iapi.services.sanity.SanityManager;
-
-import org.apache.derby.iapi.types.JSQLType;
-
-import org.apache.derby.iapi.types.DataTypeDescriptor;
-import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.sql.compile.Visitor;
-
-import org.apache.derby.iapi.reference.ClassName;
-
+import org.apache.derby.iapi.types.DataTypeDescriptor;
+import org.apache.derby.iapi.types.JSQLType;
 import org.apache.derby.iapi.util.JBitSet;
-import org.apache.derby.iapi.services.classfile.VMOpcode;
-
-import java.lang.reflect.Modifier;
-
-import java.util.List;
 
 /**
  * This node type converts a value in the SQL domain to a value in the Java
  * domain.
  */
 
-public class SQLToJavaValueNode extends JavaValueNode
+class SQLToJavaValueNode extends JavaValueNode
 {
 	ValueNode	value;
 
@@ -67,21 +62,22 @@ public class SQLToJavaValueNode extends 
 	 *
 	 * @param value		A ValueNode representing a SQL value to convert to
 	 *					the Java domain.
+     * @param cm        The context manager
 	 */
+    SQLToJavaValueNode(ValueNode value, ContextManager cm) {
+        super(cm);
+        setNodeType(C_NodeTypes.SQL_TO_JAVA_VALUE_NODE);
+        this.value = value;
+    }
 
-	public void init(Object value)
-	{
-		this.value = (ValueNode) value;
-	}
-
-	/**
+    /**
 	 * Prints the sub-nodes of this object.  See QueryTreeNode.java for
 	 * how tree printing is supposed to work.
 	 *
 	 * @param depth		The depth of this node in the tree
 	 */
-
-	public void printSubNodes(int depth)
+    @Override
+    void printSubNodes(int depth)
 	{
 		if (SanityManager.DEBUG)
 		{
@@ -102,8 +98,9 @@ public class SQLToJavaValueNode extends 
 	  *	@return	name of java class type
 	  *
 	  */
+    @Override
     String getJavaTypeName()
-	throws StandardException
+            throws StandardException
 	{
 		JSQLType	myType = getJSQLType();
 
@@ -118,6 +115,7 @@ public class SQLToJavaValueNode extends 
 	  *
 	  * @exception StandardException		Thrown on error
 	  */
+    @Override
     String getPrimitiveTypeName()
 		throws StandardException
 	{
@@ -144,6 +142,7 @@ public class SQLToJavaValueNode extends 
 	  *	@return	the corresponding JSQLType
 	  *
 	  */
+    @Override
     JSQLType getJSQLType() throws StandardException
 	{
 		if ( jsqlType == null )
@@ -195,9 +194,7 @@ public class SQLToJavaValueNode extends 
 		return this;
 	}
 
-    /**
-     * Override behavior in superclass.
-     */
+    @Override
     DataTypeDescriptor getDataType() throws StandardException
     {
         return value.getTypeServices();
@@ -287,6 +284,7 @@ public class SQLToJavaValueNode extends 
 	 * @return	The variant type for the underlying expression.
 	 * @exception StandardException	thrown on error
 	 */
+    @Override
     int getOrderableVariantType() throws StandardException
 	{
 		return value.getOrderableVariantType();
@@ -483,6 +481,7 @@ public class SQLToJavaValueNode extends 
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
 	Object getConstantValueAsObject()
 		throws StandardException
 	{
@@ -496,6 +495,7 @@ public class SQLToJavaValueNode extends 
 	 *
 	 * @exception StandardException on error
 	 */
+    @Override
 	void acceptChildren(Visitor v)
 		throws StandardException
 	{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SavepointNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SavepointNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SavepointNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SavepointNode.java Fri Jun 21 07:47:47 2013
@@ -21,39 +21,43 @@
 
 package	org.apache.derby.impl.sql.compile;
 
+import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.services.context.ContextManager;
 import org.apache.derby.iapi.services.sanity.SanityManager;
-
+import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.sql.execute.ConstantAction;
 
-import org.apache.derby.iapi.error.StandardException;
-
 /**
  * A SavepointNode is the root of a QueryTree that represents a Savepoint (ROLLBACK savepoint, RELASE savepoint and SAVEPOINT)
  * statement.
  */
 
-public class SavepointNode extends DDLStatementNode
+class SavepointNode extends DDLStatementNode
 {
 	private String	savepointName; //name of the savepoint
 	private int	savepointStatementType; //Type of savepoint statement ie rollback, release or set savepoint
 
 	/**
-	 * Initializer for a SavepointNode
-	 *
-	 * @param objectName		The name of the savepoint
-	 * @param savepointStatementType		Type of savepoint statement ie rollback, release or set savepoint
+     * Constructor for a SavepointNode
 	 *
+     * @param objectName              The name of the savepoint
+     * @param savepointStatementType  Type of savepoint statement ie rollback,
+     *                                release or set savepoint
+     * @param cm                      The context manager
+     *
 	 * @exception StandardException		Thrown on error
 	 */
 
-	public void init(
-			Object objectName,
-			Object savepointStatementType)
+    SavepointNode(
+            String objectName,
+            int savepointStatementType,
+            ContextManager cm)
 		throws StandardException
 	{
-		initAndCheck(null);	
-		this.savepointName = (String) objectName;
-		this.savepointStatementType = ((Integer) savepointStatementType).intValue();
+        super(cm);
+        setNodeType(C_NodeTypes.SAVEPOINT_NODE);
+        this.savepointName = objectName;
+        this.savepointStatementType = savepointStatementType;
 
 		if (SanityManager.DEBUG)
 		{
@@ -71,7 +75,7 @@ public class SavepointNode extends DDLSt
 	 *
 	 * @return	This object as a String
 	 */
-
+    @Override
 	public String toString()
 	{
 		if (SanityManager.DEBUG)
@@ -86,7 +90,7 @@ public class SavepointNode extends DDLSt
 		}
 	}
 
-	public String statementToString()
+    String statementToString()
 	{
 		if (savepointStatementType == 1)
 			return "SAVEPOINT";
@@ -104,6 +108,7 @@ public class SavepointNode extends DDLSt
 	 *
 	 * @return boolean	Whether or not this Statement requires a set/clear savepoint
 	 */
+    @Override
 	public boolean needsSavepoint()
 	{
 		return false;
@@ -116,7 +121,8 @@ public class SavepointNode extends DDLSt
 	 *
 	 * @exception StandardException		Thrown on failure
 	 */
-	public ConstantAction	makeConstantAction() throws StandardException
+    @Override
+    public ConstantAction makeConstantAction() throws StandardException
 	{
 		return(
             getGenericConstantActionFactory().getSavepointConstantAction(

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ScrollInsensitiveResultSetNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ScrollInsensitiveResultSetNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ScrollInsensitiveResultSetNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ScrollInsensitiveResultSetNode.java Fri Jun 21 07:47:47 2013
@@ -21,14 +21,14 @@
 
 package	org.apache.derby.impl.sql.compile;
 
+import java.util.Properties;
 import org.apache.derby.iapi.error.StandardException;
-
-import org.apache.derby.iapi.services.compiler.MethodBuilder;
 import org.apache.derby.iapi.reference.ClassName;
-
-import org.apache.derby.iapi.services.sanity.SanityManager;
-
 import org.apache.derby.iapi.services.classfile.VMOpcode;
+import org.apache.derby.iapi.services.compiler.MethodBuilder;
+import org.apache.derby.iapi.services.context.ContextManager;
+import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 
 /**
  * A ScrollInsensitiveResultSetNode represents the insensitive scrolling cursor
@@ -37,23 +37,24 @@ import org.apache.derby.iapi.services.cl
  *
  */
 
-public class ScrollInsensitiveResultSetNode  extends SingleChildResultSetNode
+class ScrollInsensitiveResultSetNode  extends SingleChildResultSetNode
 {
 	/**
-	 * Initializer for a ScrollInsensitiveResultSetNode.
+     * Constructor for a ScrollInsensitiveResultSetNode.
 	 *
 	 * @param childResult	The child ResultSetNode
 	 * @param rcl			The RCL for the node
 	 * @param tableProperties	Properties list associated with the table
+     * @param cm            The context manager
 	 */
-
-	public void init(
-							Object childResult,
-							Object rcl,
-							Object tableProperties)
-	{
-		init(childResult, tableProperties);
-		resultColumns = (ResultColumnList) rcl;
+    ScrollInsensitiveResultSetNode(
+                            ResultSetNode childResult,
+                            ResultColumnList rcl,
+                            Properties tableProperties,
+                            ContextManager cm) {
+        super(childResult, tableProperties, cm);
+        setNodeType(C_NodeTypes.SCROLL_INSENSITIVE_RESULT_SET_NODE);
+        resultColumns = rcl;
 	}
 
     /**
@@ -61,6 +62,7 @@ public class ScrollInsensitiveResultSetN
 	 *
 	 * @exception StandardException		Thrown on error
      */
+    @Override
     void generate(ActivationClassBuilder acb, MethodBuilder mb)
 							throws StandardException
 	{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SelectNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SelectNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SelectNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SelectNode.java Fri Jun 21 07:47:47 2013
@@ -22,31 +22,24 @@
 
 package	org.apache.derby.impl.sql.compile;
 
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.reference.Limits;
+import org.apache.derby.iapi.reference.SQLState;
+import org.apache.derby.iapi.services.context.ContextManager;
+import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.iapi.sql.compile.C_NodeTypes;
+import org.apache.derby.iapi.sql.compile.CompilerContext;
 import org.apache.derby.iapi.sql.compile.CostEstimate;
 import org.apache.derby.iapi.sql.compile.Optimizer;
 import org.apache.derby.iapi.sql.compile.Visitor;
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
-
 import org.apache.derby.iapi.sql.conn.Authorizer;
-
-import org.apache.derby.iapi.sql.compile.CompilerContext;
 import org.apache.derby.iapi.sql.dictionary.DataDictionary;
 import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
-
-
-import org.apache.derby.iapi.reference.Limits;
-import org.apache.derby.iapi.reference.SQLState;
-import org.apache.derby.iapi.error.StandardException;
-
-
-import org.apache.derby.iapi.services.sanity.SanityManager;
-
 import org.apache.derby.iapi.util.JBitSet;
 
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-
 /**
  * A SelectNode represents the result set for any of the basic DML
  * operations: SELECT, INSERT, UPDATE, and DELETE.  (A RowResultSetNode
@@ -60,7 +53,7 @@ import java.util.List;
  *
  */
 
-public class SelectNode extends ResultSetNode
+class SelectNode extends ResultSetNode
 {
 	/**
 	 * List of tables in the FROM clause of this SELECT
@@ -142,25 +135,30 @@ public class SelectNode extends ResultSe
 	ValueNode havingClause;
 	
 	private int nestingLevel;
-	public void init(Object selectList,
-			  Object fromList,
-			  Object whereClause,
-			  Object groupByList,
-			  Object havingClause,
-			  Object windowDefinitionList)
-			throws StandardException
-	{
+
+    SelectNode(ResultColumnList selectList,
+              FromList fromList,
+              ValueNode whereClause,
+              GroupByList groupByList,
+              ValueNode havingClause,
+              WindowList windowDefinitionList,
+              ContextManager cm) throws StandardException {
+        super(cm);
+        setNodeType(C_NodeTypes.SELECT_NODE);
         /* RESOLVE -
 		 * Consider adding selectAggregates and whereAggregates 
 		 */
-		resultColumns = (ResultColumnList) selectList;
-		if (resultColumns != null)
+        resultColumns = selectList;
+
+        if (resultColumns != null) {
 			resultColumns.markInitialSize();
-		this.fromList = (FromList) fromList;
-		this.whereClause = (ValueNode) whereClause;
-		this.originalWhereClause = (ValueNode) whereClause;
-		this.groupByList = (GroupByList) groupByList;
-		this.havingClause = (ValueNode)havingClause;
+        }
+
+        this.fromList = fromList;
+        this.whereClause = whereClause;
+        this.originalWhereClause = whereClause;
+        this.groupByList = groupByList;
+        this.havingClause = havingClause;
 
 		// This initially represents an explicit <window definition list>, as
 		// opposed to <in-line window specifications>, see 2003, 6.10 and 6.11.
@@ -168,7 +166,7 @@ public class SelectNode extends ResultSe
 		// in-line window specifications used in window functions in the SELECT
 		// column list and in genProjectRestrict for such window specifications
 		// used in window functions in ORDER BY.
-		this.windows = (WindowList)windowDefinitionList;
+        this.windows = windowDefinitionList;
 
 		bindTargetListOnly = false;
 		
@@ -225,8 +223,7 @@ public class SelectNode extends ResultSe
 
 		if (wl == null) {
 			// This is the first window we see, so initialize list.
-			wl = new WindowList();
-			wl.setContextManager(getContextManager());
+            wl = new WindowList(getContextManager());
 		}
 
 		WindowDefinitionNode equiv = wdn.findEquivalentWindow(wl);
@@ -251,7 +248,7 @@ public class SelectNode extends ResultSe
 	 *
 	 * @return	This object as a String
 	 */
-
+    @Override
 	public String toString()
 	{
 		if (SanityManager.DEBUG)
@@ -265,17 +262,17 @@ public class SelectNode extends ResultSe
 		}
 	}
 
-	public String statementToString()
+    String statementToString()
 	{
 		return "SELECT";
 	}
 
-	public void makeDistinct()
+    void makeDistinct()
 	{
 		isDistinct = true;
 	}
 
-	public void clearDistinct()
+    void clearDistinct()
 	{
 		isDistinct = false;
 	}
@@ -292,7 +289,8 @@ public class SelectNode extends ResultSe
 	 * @param depth		The depth of this node in the tree
 	 */
 
-	public void printSubNodes(int depth)
+    @Override
+    void printSubNodes(int depth)
 	{
 		if (SanityManager.DEBUG)
 		{
@@ -380,7 +378,8 @@ public class SelectNode extends ResultSe
 	 *
 	 * @return FromList	The fromList for this SelectNode.
 	 */
-	public FromList getFromList()
+    @Override
+    FromList getFromList()
 	{
 		return fromList;
 	}
@@ -396,7 +395,7 @@ public class SelectNode extends ResultSe
 	 *
 	 * @return	ColumnReference	ColumnReference to the column, if found
 	 */
-	public ColumnReference findColumnReferenceInResult(String colName)
+    ColumnReference findColumnReferenceInResult(String colName)
 					throws StandardException
 	{
 		if (fromList.size() != 1)
@@ -431,7 +430,7 @@ public class SelectNode extends ResultSe
 	 *
 	 * @return ValueNode	The whereClause for this SelectNode.
 	 */
-	public ValueNode getWhereClause()
+    ValueNode getWhereClause()
 	{
 		return whereClause;
 	}
@@ -441,7 +440,7 @@ public class SelectNode extends ResultSe
 	 *
 	 * @return PredicateList	The wherePredicates for this SelectNode.
 	 */
-	public PredicateList getWherePredicates()
+    PredicateList getWherePredicates()
 	{
 		return wherePredicates;
 	}
@@ -451,7 +450,7 @@ public class SelectNode extends ResultSe
 	 *
 	 * @return SubqueryList	The selectSubquerys for this SelectNode.
 	 */
-	public SubqueryList getSelectSubquerys()
+    SubqueryList getSelectSubquerys()
 	{
 		return selectSubquerys;
 	}
@@ -461,7 +460,7 @@ public class SelectNode extends ResultSe
 	 *
 	 * @return SubqueryList	The whereSubquerys for this SelectNode.
 	 */
-	public SubqueryList getWhereSubquerys()
+    SubqueryList getWhereSubquerys()
 	{
 		return whereSubquerys;
 	}
@@ -479,21 +478,18 @@ public class SelectNode extends ResultSe
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
-	public ResultSetNode bindNonVTITables(DataDictionary dataDictionary,
+    @Override
+    ResultSetNode bindNonVTITables(DataDictionary dataDictionary,
 						   FromList fromListParam) 
 					throws StandardException
 	{
 		int fromListSize = fromList.size();
 		
 
-		wherePredicates = (PredicateList) getNodeFactory().getNode(
-											C_NodeTypes.PREDICATE_LIST,
-											getContextManager());
-		preJoinFL = (FromList) getNodeFactory().getNode(
-									C_NodeTypes.FROM_LIST,
-									getNodeFactory().doJoinOrderOptimization(),
-									getContextManager());
+        wherePredicates = new PredicateList(getContextManager());
+        preJoinFL =
+            new FromList(getOptimizerFactory().doJoinOrderOptimization(),
+                         getContextManager());
 
 		/* Set the nesting level in the fromList */
 		if (fromListParam.size() == 0)
@@ -534,7 +530,8 @@ public class SelectNode extends ResultSe
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public void bindExpressions(FromList fromListParam)
+    @Override
+    void bindExpressions(FromList fromListParam)
 					throws StandardException
 	{
 		int fromListParamSize = fromListParam.size();
@@ -559,9 +556,7 @@ public class SelectNode extends ResultSe
 			fromList.bindExpressions( fromListParam );
 		}
 
-		selectSubquerys = (SubqueryList) getNodeFactory().getNode(
-											C_NodeTypes.SUBQUERY_LIST,
-											getContextManager());
+        selectSubquerys = new SubqueryList(getContextManager());
 		selectAggregates = new ArrayList<AggregateNode>();
 
 		/* Splice our FromList on to the beginning of fromListParam, before binding
@@ -601,9 +596,7 @@ public class SelectNode extends ResultSe
 		}
 
 		whereAggregates = new ArrayList<AggregateNode>();
-		whereSubquerys = (SubqueryList) getNodeFactory().getNode(
-												C_NodeTypes.SUBQUERY_LIST,
-												getContextManager());
+        whereSubquerys = new SubqueryList(getContextManager());
         
         CompilerContext cc = getCompilerContext();
         
@@ -647,9 +640,7 @@ public class SelectNode extends ResultSe
             int previousReliability = orReliability( CompilerContext.HAVING_CLAUSE_RESTRICTION );
 
 			havingAggregates = new ArrayList<AggregateNode>();
-			havingSubquerys = (SubqueryList) getNodeFactory().getNode(
-					C_NodeTypes.SUBQUERY_LIST,
-					getContextManager());
+            havingSubquerys = new SubqueryList(getContextManager());
 			havingClause.bindExpression(
 					fromListParam, havingSubquerys, havingAggregates);
 			havingClause = havingClause.checkIsBoolean();
@@ -738,7 +729,8 @@ public class SelectNode extends ResultSe
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public void bindExpressionsWithTables(FromList fromListParam)
+    @Override
+    void bindExpressionsWithTables(FromList fromListParam)
 					throws StandardException
 	{
 		/* We have tables, so simply call bindExpressions() */
@@ -754,8 +746,8 @@ public class SelectNode extends ResultSe
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
-	public void bindTargetExpressions(FromList fromListParam)
+    @Override
+    void bindTargetExpressions(FromList fromListParam)
 					throws StandardException
 	{
 		/*
@@ -785,8 +777,8 @@ public class SelectNode extends ResultSe
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
-	public void bindResultColumns(FromList fromListParam)
+    @Override
+    void bindResultColumns(FromList fromListParam)
 				throws StandardException
 	{
 		/* We first bind the resultColumns for any FromTable which
@@ -837,7 +829,7 @@ public class SelectNode extends ResultSe
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
+    @Override
     void bindResultColumns(TableDescriptor targetTableDescriptor,
             FromVTI targetVTI, ResultColumnList targetColumnList,
             DMLStatementNode statement, FromList fromListParam)
@@ -882,7 +874,8 @@ public class SelectNode extends ResultSe
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public void verifySelectStarSubquery(FromList outerFromList, int subqueryType) 
+    @Override
+    void verifySelectStarSubquery(FromList outerFromList, int subqueryType)
 					throws StandardException
 	{
         for (int i = 0; i < resultColumns.size(); i++) {
@@ -939,6 +932,7 @@ public class SelectNode extends ResultSe
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
     FromTable getFromTableByName(String name, String schemaName, boolean exactMatch)
 		throws StandardException
 	{
@@ -952,8 +946,8 @@ public class SelectNode extends ResultSe
 	 * @exception StandardException		Thrown if a ? parameter found
 	 *									directly under a ResultColumn
 	 */
-
-	public void rejectParameters() throws StandardException
+    @Override
+    void rejectParameters() throws StandardException
 	{
 		super.rejectParameters();
 		fromList.rejectParameters();
@@ -967,6 +961,7 @@ public class SelectNode extends ResultSe
 	 *
 	 * @param orderByList	The order by list
 	 */
+    @Override
 	void pushOrderByList(OrderByList orderByList)
 	{
         if (orderByLists[0] != null) {
@@ -1008,6 +1003,7 @@ public class SelectNode extends ResultSe
      * @param fetchFirst the OFFSET FIRST, if any
      * @param hasJDBClimitClause true if the clauses were added by (and have the semantics of) a JDBC limit clause
      */
+    @Override
     void pushOffsetFetchFirst( ValueNode offset, ValueNode fetchFirst, boolean hasJDBClimitClause )
     {
         this.offset = offset;
@@ -1040,8 +1036,8 @@ public class SelectNode extends ResultSe
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
-	public ResultSetNode preprocess(int numTables,
+    @Override
+    ResultSetNode preprocess(int numTables,
 									GroupByList gbl,
 									FromList fl)
 								throws StandardException
@@ -1067,9 +1063,9 @@ public class SelectNode extends ResultSe
 		boolean anyChange = fromList.LOJ_reorderable(numTables);
 		if (anyChange)
 		{
-			FromList afromList = (FromList) getNodeFactory().getNode(C_NodeTypes.FROM_LIST,
-																	 getNodeFactory().doJoinOrderOptimization(),
-																	 getContextManager());
+            FromList afromList = new FromList(
+                    getOptimizerFactory().doJoinOrderOptimization(),
+                    getContextManager());
 			bindExpressions(afromList);
             fromList.bindResultColumns(afromList);
 		}
@@ -1433,7 +1429,8 @@ public class SelectNode extends ResultSe
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public ResultSetNode addNewPredicate(Predicate predicate)
+    @Override
+    ResultSetNode addNewPredicate(Predicate predicate)
 			throws StandardException
 	{
 		wherePredicates.addPredicate(predicate);
@@ -1455,7 +1452,8 @@ public class SelectNode extends ResultSe
 	 *
 	 * @return boolean	Whether or not the FromSubquery is flattenable.
 	 */
-	public boolean flattenableInFromSubquery(FromList fromList)
+    @Override
+    boolean flattenableInFromSubquery(FromList fromList)
 	{
 		if (isDistinct) 
 		{
@@ -1520,24 +1518,23 @@ public class SelectNode extends ResultSe
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
-	public ResultSetNode genProjectRestrict(int origFromListSize)
+    @Override
+    ResultSetNode genProjectRestrict(int origFromListSize)
 				throws StandardException
 	{
         boolean[] eliminateSort = new boolean[orderByLists.length];
 
 		ResultSetNode		prnRSN;
 
-		prnRSN = (ResultSetNode) getNodeFactory().getNode(
-								C_NodeTypes.PROJECT_RESTRICT_NODE,
-								fromList.elementAt(0),	/* Child ResultSet */
-								resultColumns,		/* Projection */
-								whereClause,			/* Restriction */
-								wherePredicates,/* Restriction as PredicateList */
-								selectSubquerys,/* Subquerys in Projection */
-								whereSubquerys,	/* Subquerys in Restriction */
-								null,
-								getContextManager()	 );
+        prnRSN = new ProjectRestrictNode(
+                (ResultSetNode)fromList.elementAt(0),   /* Child ResultSet */
+                resultColumns,      /* Projection */
+                whereClause,            /* Restriction */
+                wherePredicates,/* Restriction as PredicateList */
+                selectSubquerys,/* Subquerys in Projection */
+                whereSubquerys, /* Subquerys in Restriction */
+                null,
+                getContextManager());
 
 		/*
 		** If we have aggregates OR a select list we want
@@ -1555,16 +1552,13 @@ public class SelectNode extends ResultSe
 				havingAggregates.addAll(selectAggregates);
 				aggs = havingAggregates;
 			}
-			GroupByNode gbn = (GroupByNode) getNodeFactory().getNode(
-												C_NodeTypes.GROUP_BY_NODE,
-												prnRSN,
-												groupByList,
-												aggs,
-												havingClause,
-												havingSubquerys,
-												null,
-												new Integer(nestingLevel),
-												getContextManager());
+            GroupByNode gbn = new GroupByNode(prnRSN,
+                    groupByList,
+                    aggs,
+                    havingClause,
+                    havingSubquerys,
+                    nestingLevel,
+                    getContextManager());
 			gbn.considerPostOptimizeOptimizations(originalWhereClause != null);
 			gbn.assignCostEstimate(optimizer.getOptimizedCost());
 
@@ -1588,15 +1582,14 @@ public class SelectNode extends ResultSe
 					SQLState.LANG_WINDOW_LIMIT_EXCEEDED);
 			}
 
-			WindowNode wn = (WindowNode)windows.elementAt(0);
+            WindowDefinitionNode wn =
+                    (WindowDefinitionNode)windows.elementAt(0);
 
-			WindowResultSetNode wrsn =
-				(WindowResultSetNode)getNodeFactory().getNode(
-					C_NodeTypes.WINDOW_RESULTSET_NODE,
+            WindowResultSetNode wrsn = new WindowResultSetNode(
 					prnRSN,
 					wn,
 					windowFuncCalls,
-					new Integer(nestingLevel),
+                    nestingLevel,
 					getContextManager());
 
 			prnRSN = wrsn.getParent();
@@ -1659,12 +1652,8 @@ public class SelectNode extends ResultSe
 				 * duplicates without a sorter. 
 				 */
 				boolean inSortedOrder = isOrderedResult(resultColumns, prnRSN, !(orderByAndDistinctMerged));
-				prnRSN = (ResultSetNode) getNodeFactory().getNode(
-											C_NodeTypes.DISTINCT_NODE,
-											prnRSN,
-											new Boolean(inSortedOrder),
-											null,
-											getContextManager());
+                prnRSN = new DistinctNode(
+                        prnRSN, inSortedOrder, null, getContextManager());
 				prnRSN.costEstimate = costEstimate.cloneMe();
 
                 // Remember whether or not we can eliminate the sort.
@@ -1683,12 +1672,10 @@ public class SelectNode extends ResultSe
             {
                 if (orderByLists[i].getSortNeeded())
                 {
-                    prnRSN = (ResultSetNode) getNodeFactory().getNode(
-                            C_NodeTypes.ORDER_BY_NODE,
-                            prnRSN,
-                            orderByLists[i],
-                            null,
-                            getContextManager());
+                    prnRSN = new OrderByNode(prnRSN,
+                                             orderByLists[i],
+                                             null,
+                                             getContextManager());
                     prnRSN.costEstimate = costEstimate.cloneMe();
                 }
 
@@ -1712,8 +1699,7 @@ public class SelectNode extends ResultSe
 
                     topList.removeOrderByColumns();
                     topList.genVirtualColumnNodes(prnRSN, newSelectList);
-                    prnRSN = (ResultSetNode) getNodeFactory().getNode(
-                            C_NodeTypes.PROJECT_RESTRICT_NODE,
+                    prnRSN = new ProjectRestrictNode(
                             prnRSN,
                             topList,
                             null,
@@ -1734,13 +1720,12 @@ public class SelectNode extends ResultSe
                 ResultColumnList newSelectList = topList.copyListAndObjects();
                 prnRSN.setResultColumns(newSelectList);
                 topList.genVirtualColumnNodes(prnRSN, newSelectList);
-                prnRSN = (ResultSetNode)getNodeFactory().getNode(
-                        C_NodeTypes.ROW_COUNT_NODE,
+                prnRSN = new RowCountNode(
                         prnRSN,
                         topList,
                         offset,
                         fetchFirst,
-                        Boolean.valueOf( hasJDBClimitClause ),
+                        hasJDBClimitClause,
                         getContextManager());
             }
         }
@@ -1773,8 +1758,7 @@ public class SelectNode extends ResultSe
 
 			topList.removeGeneratedGroupingColumns();
 			topList.genVirtualColumnNodes(prnRSN, newSelectList);
-			prnRSN = (ResultSetNode) getNodeFactory().getNode(
-						C_NodeTypes.PROJECT_RESTRICT_NODE,
+            prnRSN = new ProjectRestrictNode(
 						prnRSN,
 						topList,
 						null,
@@ -1880,7 +1864,8 @@ public class SelectNode extends ResultSe
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public ResultSetNode ensurePredicateList(int numTables) 
+    @Override
+    ResultSetNode ensurePredicateList(int numTables)
 		throws StandardException
 	{
 		return this;
@@ -1898,13 +1883,13 @@ public class SelectNode extends ResultSe
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
-	public ResultSetNode optimize(DataDictionary dataDictionary,
+    @Override
+    ResultSetNode optimize(DataDictionary dataDictionary,
 								  PredicateList	predicateList,
 								  double outerRows) 
 				throws StandardException
 	{
-		Optimizer		 optimizer;
+        Optimizer        opt;
 
 		/* Optimize any subquerys before optimizing the underlying result set */
 
@@ -1973,19 +1958,17 @@ public class SelectNode extends ResultSe
 		if (predicateList != null)
 		{
 			if (wherePredicates == null) {
-				wherePredicates = (PredicateList) getNodeFactory().getNode(
-						C_NodeTypes.PREDICATE_LIST,
-						getContextManager());
+                wherePredicates = new PredicateList(getContextManager());
 			}
 
-			Predicate pred = null;
 			int sz = predicateList.size();
-			for (int i = sz - 1; i >= 0; i--)
+
+            for (int i = sz - 1; i >= 0; i--)
 			{
 				// We can tell if a predicate was pushed into this select
 				// node because it will have been "scoped" for this node
 				// or for some result set below this one.
-				pred = (Predicate)predicateList.getOptPredicate(i);
+                Predicate pred = (Predicate)predicateList.getOptPredicate(i);
 				if (pred.isScopedToSourceResultSet())
 				{
 					// If we're pushing the predicate down here, we have to
@@ -1998,18 +1981,18 @@ public class SelectNode extends ResultSe
 			}
 		}
 
-		optimizer = getOptimizer(fromList,
+        opt = getOptimizer(fromList,
 								wherePredicates,
 								dataDictionary,
                                 orderByLists[0]); // use first one
-		optimizer.setOuterRows(outerRows);
+        opt.setOuterRows(outerRows);
 
 		/* Optimize this SelectNode */
-		while (optimizer.getNextPermutation())
+        while (opt.getNextPermutation())
 		{
-			while (optimizer.getNextDecoratedPermutation())
+            while (opt.getNextDecoratedPermutation())
 			{
-				optimizer.costPermutation();
+                opt.costPermutation();
 			}
 		}
 
@@ -2021,10 +2004,9 @@ public class SelectNode extends ResultSe
 		 */
 		if (wherePredicates != null)
 		{
-			Predicate pred = null;
 			for (int i = wherePredicates.size() - 1; i >= 0; i--)
 			{
-				pred = (Predicate)wherePredicates.getOptPredicate(i);
+                Predicate pred = (Predicate)wherePredicates.getOptPredicate(i);
 				if (pred.isScopedForPush())
 				{
 					predicateList.addOptPredicate(pred);
@@ -2034,7 +2016,7 @@ public class SelectNode extends ResultSe
 		}
 
 		/* Get the cost */
-		costEstimate = optimizer.getOptimizedCost();
+        costEstimate = opt.getOptimizedCost();
 
 		/* Update row counts if this is a scalar aggregate */
 		if ((selectAggregates != null) && (selectAggregates.size() > 0)) 
@@ -2067,7 +2049,8 @@ public class SelectNode extends ResultSe
 	 * @return The modified query tree
 	 * @exception StandardException        Thrown on error
 	 */
-	public ResultSetNode modifyAccessPaths(PredicateList predList)
+    @Override
+    ResultSetNode modifyAccessPaths(PredicateList predList)
 		throws StandardException
 	{
 		// Take the received list of predicates and propagate them to the
@@ -2083,7 +2066,8 @@ public class SelectNode extends ResultSe
 				"modifying access paths.");
 		}
 
-		((OptimizerImpl)optimizer).addScopedPredicatesToList(predList);
+        ((OptimizerImpl)optimizer).
+                addScopedPredicatesToList(predList, getContextManager());
 		return modifyAccessPaths();
 	}
 
@@ -2094,7 +2078,8 @@ public class SelectNode extends ResultSe
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public ResultSetNode modifyAccessPaths() throws StandardException
+    @Override
+    ResultSetNode modifyAccessPaths() throws StandardException
 	{
 		int				 origFromListSize = fromList.size();
 		ResultColumnList leftRCList;
@@ -2125,10 +2110,10 @@ public class SelectNode extends ResultSe
 			// and thus removed from the list.
 			if (wherePredicates != null)
 			{
-				Predicate pred = null;
 				for (int i = wherePredicates.size() - 1; i >= 0; i--)
 				{
-					pred = (Predicate)wherePredicates.getOptPredicate(i);
+                    Predicate pred =
+                            (Predicate)wherePredicates.getOptPredicate(i);
 					if (pred.isScopedForPush())
 					{
 						SanityManager.THROWASSERT("Found scoped predicate " +
@@ -2198,20 +2183,16 @@ public class SelectNode extends ResultSe
 			 * replace the 1st 2 entries in the FromList.
 			 */
 			fromList.setElementAt(
-						 (JoinNode) getNodeFactory().getNode(
-												C_NodeTypes.JOIN_NODE,
-												leftResultSet,
-												rightResultSet,
-												null,
-												null,
-												leftRCList,
-												null,
-												//user supplied optimizer overrides
-												fromList.properties,
-												getContextManager()
-												),
-							0
-						);
+                new JoinNode(leftResultSet,
+                             rightResultSet,
+                             null,
+                             null,
+                             leftRCList,
+                             null,
+                             //user supplied optimizer overrides
+                             fromList.properties,
+                             getContextManager()),
+                0);
 
 			fromList.removeElementAt(1);
 		}
@@ -2226,7 +2207,8 @@ public class SelectNode extends ResultSe
 	 * 			the final cost estimate for the best join order of
 	 *          this SelectNode's optimizer.
 	 */
-	public CostEstimate getFinalCostEstimate()
+    @Override
+    CostEstimate getFinalCostEstimate()
 		throws StandardException
 	{
 		return optimizer.getFinalCost();
@@ -2235,6 +2217,7 @@ public class SelectNode extends ResultSe
 	/**
 		Determine if this select is updatable or not, for a cursor.
 	 */
+    @Override
 	boolean isUpdatableCursor(DataDictionary dd) throws StandardException
 	{
 		TableDescriptor	targetTableDescriptor;
@@ -2327,6 +2310,7 @@ public class SelectNode extends ResultSe
 		Assumes that isCursorUpdatable has been called, and that it
 		is only called for updatable cursors.
 	 */
+    @Override
 	FromTable getCursorTargetTable()
 	{
 		if (SanityManager.DEBUG)
@@ -2345,7 +2329,8 @@ public class SelectNode extends ResultSe
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public boolean referencesTarget(String name, boolean baseTable)
+    @Override
+    boolean referencesTarget(String name, boolean baseTable)
 		throws StandardException
 	{
 		if (fromList.referencesTarget(name, baseTable) ||
@@ -2369,6 +2354,7 @@ public class SelectNode extends ResultSe
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
 	boolean subqueryReferencesTarget(String name, boolean baseTable)
 		throws StandardException
 	{
@@ -2388,7 +2374,8 @@ public class SelectNode extends ResultSe
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public void bindUntypedNullsToResultColumns(ResultColumnList bindingRCL)
+    @Override
+    void bindUntypedNullsToResultColumns(ResultColumnList bindingRCL)
 				throws StandardException
 	{
 		fromList.bindUntypedNullsToResultColumns(bindingRCL);
@@ -2471,7 +2458,8 @@ public class SelectNode extends ResultSe
 	 *
 	 * @return	The lock mode
 	 */
-	public int updateTargetLockMode()
+    @Override
+    int updateTargetLockMode()
 	{
 		/* Do row locking if there is a restriction */
 		return fromList.updateTargetLockMode();
@@ -2485,9 +2473,12 @@ public class SelectNode extends ResultSe
 	 * @return Whether or not this ResultSet tree is guaranteed to return
 	 * at most 1 row based on heuristics.
 	 */
+    @Override
 	boolean returnsAtMostOneRow()
 	{
-		return (groupByList == null && selectAggregates != null && selectAggregates.size() != 0);
+        return (groupByList == null &&
+                selectAggregates != null &&
+                !selectAggregates.isEmpty());
 	}
 
 	/**
@@ -2497,6 +2488,7 @@ public class SelectNode extends ResultSe
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
 	public boolean referencesSessionSchema()
 		throws StandardException
 	{
@@ -2515,6 +2507,7 @@ public class SelectNode extends ResultSe
 	 *
 	 * @exception StandardException on error
 	 */
+    @Override
 	void acceptChildren(Visitor v)
 		throws StandardException
 	{
@@ -2591,7 +2584,7 @@ public class SelectNode extends ResultSe
 	/**
 	 * @return true if there are aggregates in the select list.
 	 */
-	public boolean hasAggregatesInSelectList() 
+    boolean hasAggregatesInSelectList()
 	{
 		return !selectAggregates.isEmpty();
 	}
@@ -2605,13 +2598,13 @@ public class SelectNode extends ResultSe
 	 *
 	 * @return true if this select node has any windows on it
 	 */
-	public boolean hasWindows()
+    boolean hasWindows()
 	{
 		return windows != null;
 	}
 
 
-	public static void checkNoWindowFunctions(QueryTreeNode clause,
+    static void checkNoWindowFunctions(QueryTreeNode clause,
 											   String clauseName)
 			throws StandardException {
 
@@ -2632,6 +2625,7 @@ public class SelectNode extends ResultSe
      *
      * A no-op for SelectNode.
      */
+    @Override
     void replaceOrForbidDefaults(TableDescriptor ttd,
                                  ResultColumnList tcl,
                                  boolean allowDefaults)

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetOperatorNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetOperatorNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetOperatorNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetOperatorNode.java Fri Jun 21 07:47:47 2013
@@ -21,25 +21,20 @@
 
 package	org.apache.derby.impl.sql.compile;
 
-import org.apache.derby.iapi.services.sanity.SanityManager;
-
+import java.util.HashMap;
+import java.util.Properties;
 import org.apache.derby.iapi.error.StandardException;
-
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
+import org.apache.derby.iapi.reference.SQLState;
+import org.apache.derby.iapi.services.context.ContextManager;
+import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.sql.compile.CostEstimate;
 import org.apache.derby.iapi.sql.compile.Optimizable;
 import org.apache.derby.iapi.sql.compile.OptimizablePredicate;
 import org.apache.derby.iapi.sql.compile.OptimizablePredicateList;
-
 import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
-
-import org.apache.derby.iapi.reference.SQLState;
 import org.apache.derby.iapi.types.DataTypeDescriptor;
-
 import org.apache.derby.iapi.util.JBitSet;
 
-import java.util.HashMap;
-
 /**
  * A SetOperatorNode represents a UNION, INTERSECT, or EXCEPT in a DML statement. Binding and optimization
  * preprocessing is the same for all of these operations, so they share bind methods in this abstract class.
@@ -82,26 +77,23 @@ abstract class SetOperatorNode extends T
 	private HashMap<Predicate,Predicate> rightScopedPreds;
 
 	/**
-	 * Initializer for a SetOperatorNode.
+     * Constructor for a SetOperatorNode.
 	 *
 	 * @param leftResult		The ResultSetNode on the left side of this union
 	 * @param rightResult		The ResultSetNode on the right side of this union
 	 * @param all				Whether or not this is an ALL.
 	 * @param tableProperties	Properties list associated with the table
+     * @param cm                The context manager
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
-	public void init(
-					Object leftResult,
-					Object rightResult,
-					Object all,
-					Object tableProperties)
-			throws StandardException
-	{
-		super.init(leftResult, rightResult, tableProperties);
-
-		this.all = ((Boolean) all).booleanValue();
+    SetOperatorNode(ResultSetNode leftResult,
+                    ResultSetNode rightResult,
+                    boolean all,
+                    Properties tableProperties,
+                    ContextManager cm) throws StandardException {
+        super(leftResult, rightResult, tableProperties, cm);
+        this.all = all;
 
 		/* resultColumns cannot be null, so we make a copy of the left RCL
 		 * for now.  At bind() time, we need to recopy the list because there
@@ -240,8 +232,7 @@ abstract class SetOperatorNode extends T
 			// _unscoped_ form, which means they are intended for _this_
 			// node instead of this node's children.  That's exactly what
 			// we want.
-			ResultSetNode prnRSN = (ResultSetNode) getNodeFactory().getNode(
-				C_NodeTypes.PROJECT_RESTRICT_NODE,
+            ResultSetNode prnRSN = new ProjectRestrictNode(
 				topNode,					// Child ResultSet
 				topNode.getResultColumns(),	// Projection
 				null,						// Restriction
@@ -308,6 +299,7 @@ abstract class SetOperatorNode extends T
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
 	public boolean pushOptPredicate(OptimizablePredicate optimizablePredicate)
 		throws StandardException
 	{
@@ -327,15 +319,14 @@ abstract class SetOperatorNode extends T
 		// Check to see if the child nodes reference any base tables; if either
 		// child does not reference at least one base table, then we don't try
 		// to push the predicate.
-		boolean canPush = false;
-
 		JBitSet tableNums = new JBitSet(getReferencedTableMap().size());
 		BaseTableNumbersVisitor btnVis =
 			new BaseTableNumbersVisitor(tableNums);
 
 		// Check the left child.
 		leftResultSet.accept(btnVis);
-		canPush = (tableNums.getFirstSetBit() != -1);
+
+        boolean canPush = (tableNums.getFirstSetBit() != -1);
 
 		/* If we can't push it to _both_ children, then we don't push at all.
 		 * RESOLVE: We can add the ability to push a predicate to one side
@@ -430,7 +421,7 @@ abstract class SetOperatorNode extends T
 		// cases where predicates are not pushed all the way down; see
 		// modifyAccessPaths() in this class for more.
 		if (pushedPredicates == null)
-			pushedPredicates = new PredicateList();
+            pushedPredicates = new PredicateList(getContextManager());
 
 		pushedPredicates.addOptPredicate(pred);
 		return true;
@@ -441,6 +432,7 @@ abstract class SetOperatorNode extends T
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
 	public void pullOptPredicates(
 		OptimizablePredicateList optimizablePredicates)
 		throws StandardException
@@ -476,11 +468,10 @@ abstract class SetOperatorNode extends T
 		 * which the scoped predicate was created because we can potentially
 		 * push that predicate elsewhere
 		 */
-		Predicate pred = null;
 		RemapCRsVisitor rcrv = new RemapCRsVisitor(false);
 		for (int i = 0; i < pushedPredicates.size(); i++)
 		{
-			pred = (Predicate)pushedPredicates.getOptPredicate(i);
+            Predicate pred = (Predicate)pushedPredicates.getOptPredicate(i);
 			if (pred.isScopedForPush())
 			{
 				/* We don't need to pull the predicate if it's scoped, but
@@ -529,7 +520,7 @@ abstract class SetOperatorNode extends T
 	 *
 	 * @return	This object as a String
 	 */
-
+    @Override
 	public String toString()
 	{
 		if (SanityManager.DEBUG)
@@ -549,8 +540,8 @@ abstract class SetOperatorNode extends T
 	 *
 	 * @param depth		The depth of this node in the tree
 	 */
-
-	public void printSubNodes(int depth)
+    @Override
+    void printSubNodes(int depth)
 	{
 		if (SanityManager.DEBUG)
 		{
@@ -584,7 +575,8 @@ abstract class SetOperatorNode extends T
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public void bindResultColumns(FromList fromListParam)
+    @Override
+    void bindResultColumns(FromList fromListParam)
 					throws StandardException
 	{
 		super.bindResultColumns(fromListParam);
@@ -619,7 +611,7 @@ abstract class SetOperatorNode extends T
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
+    @Override
     void bindResultColumns(TableDescriptor targetTableDescriptor,
             FromVTI targetVTI, ResultColumnList targetColumnList,
             DMLStatementNode statement, FromList fromListParam)
@@ -679,7 +671,8 @@ abstract class SetOperatorNode extends T
 	 *
 	 * @exception StandardException		Thrown on error.
 	 */
-	public void bindUntypedNullsToResultColumns(ResultColumnList rcl)
+    @Override
+    void bindUntypedNullsToResultColumns(ResultColumnList rcl)
 				throws StandardException
 	{
 		/*
@@ -706,6 +699,7 @@ abstract class SetOperatorNode extends T
     /**
      * {@inheritDoc}
      */
+    @Override
     void replaceOrForbidDefaults(TableDescriptor ttd,
                                  ResultColumnList tcl,
                                  boolean allowDefaults)
@@ -784,6 +778,7 @@ abstract class SetOperatorNode extends T
 		}
 	}
 
+    @Override
     public void bindExpressions(FromList fromList) throws StandardException {
         // Actions for UnionNode qua top node of a multi-valued table value
         // constructor
@@ -805,8 +800,8 @@ abstract class SetOperatorNode extends T
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
-	public void bindTargetExpressions(FromList fromListParam)
+    @Override
+    void bindTargetExpressions(FromList fromListParam)
 					throws StandardException
 	{
 		leftResultSet.bindTargetExpressions(fromListParam);
@@ -821,6 +816,7 @@ abstract class SetOperatorNode extends T
 	 *
 	 * @param orderByList	The order by list
 	 */
+    @Override
 	void pushOrderByList(OrderByList orderByList)
 	{
         if (this.orderByLists[0] != null) {
@@ -858,6 +854,7 @@ abstract class SetOperatorNode extends T
      * @param fetchFirst the OFFSET FIRST, if any
      * @param hasJDBClimitClause true if the clauses were added by (and have the semantics of) a JDBC limit clause
      */
+    @Override
     void pushOffsetFetchFirst( ValueNode offset, ValueNode fetchFirst, boolean hasJDBClimitClause )
     {
         this.offset = offset;
@@ -890,8 +887,8 @@ abstract class SetOperatorNode extends T
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
-	public ResultSetNode preprocess(int numTables,
+    @Override
+    ResultSetNode preprocess(int numTables,
 									GroupByList gbl,
 									FromList fromList)
 								throws StandardException
@@ -904,7 +901,7 @@ abstract class SetOperatorNode extends T
 
 		/* Build the referenced table map (left || right) */
 		referencedTableMap = (JBitSet) leftResultSet.getReferencedTableMap().clone();
-		referencedTableMap.or((JBitSet) rightResultSet.getReferencedTableMap());
+        referencedTableMap.or(rightResultSet.getReferencedTableMap());
 
 		/* If this is a UNION without an all and we have
 		 * an order by then we can consider eliminating the sort for the
@@ -965,7 +962,8 @@ abstract class SetOperatorNode extends T
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public ResultSetNode ensurePredicateList(int numTables) 
+    @Override
+    ResultSetNode ensurePredicateList(int numTables)
 		throws StandardException
 	{
 		return genProjectRestrict(numTables);
@@ -979,7 +977,8 @@ abstract class SetOperatorNode extends T
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public void verifySelectStarSubquery(FromList outerFromList, int subqueryType) 
+    @Override
+    void verifySelectStarSubquery(FromList outerFromList, int subqueryType)
 					throws StandardException
 	{
 		/* Check both sides - SELECT * is not valid on either side */
@@ -1000,6 +999,7 @@ abstract class SetOperatorNode extends T
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
+    @Override
     FromTable getFromTableByName(String name, String schemaName, boolean exactMatch)
 		throws StandardException
 	{
@@ -1064,15 +1064,15 @@ abstract class SetOperatorNode extends T
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public ResultSetNode setResultToBooleanTrueNode(boolean onlyConvertAlls)
+    @Override
+    ResultSetNode setResultToBooleanTrueNode(boolean onlyConvertAlls)
 		throws StandardException
 	{
 		// First create a FromList to hold this node (and only this node).
 
-		FromList fromList =
-			(FromList) getNodeFactory().getNode(
-				C_NodeTypes.FROM_LIST,
-				getContextManager());
+        FromList fromList = new FromList(
+                getOptimizerFactory().doJoinOrderOptimization(),
+                getContextManager());
 
 		fromList.addFromTable(this);
 
@@ -1094,25 +1094,17 @@ abstract class SetOperatorNode extends T
 
 		// Now create a ResultColumnList that simply holds the "*".
 
-		ResultColumnList rcl =
-			(ResultColumnList) getNodeFactory().getNode(
-				C_NodeTypes.RESULT_COLUMN_LIST,
-				getContextManager());
+        ResultColumnList rcl = new ResultColumnList(getContextManager());
 
-		ResultColumn allResultColumn =
-			(ResultColumn) getNodeFactory().getNode(
-				C_NodeTypes.ALL_RESULT_COLUMN,
-				null,
-				getContextManager());
+       ResultColumn allResultColumn =
+                new AllResultColumn(null, getContextManager());
 
 		rcl.addResultColumn(allResultColumn);
 
 		/* Create a new SELECT node of the form:
 		 *  SELECT * FROM <thisSetOperatorNode>
 		 */
-		ResultSetNode result =
-			(ResultSetNode) getNodeFactory().getNode(
-				C_NodeTypes.SELECT_NODE,
+        ResultSetNode result = new SelectNode(
 				rcl,      // ResultColumns
 				fromList, // FROM list
 				null,     // WHERE clause
@@ -1144,7 +1136,8 @@ abstract class SetOperatorNode extends T
 	 *
 	 * @return boolean	Whether or not the FromSubquery is flattenable.
 	 */
-	public boolean flattenableInFromSubquery(FromList fromList)
+    @Override
+    boolean flattenableInFromSubquery(FromList fromList)
 	{
 		/* Unions in FromSubquerys are not flattenable.	 */
 		return false;
@@ -1158,7 +1151,8 @@ abstract class SetOperatorNode extends T
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public boolean performMaterialization(JBitSet outerTables)
+    @Override
+    boolean performMaterialization(JBitSet outerTables)
 		throws StandardException
 	{
 		// RESOLVE - just say no to materialization right now - should be a cost based decision
@@ -1185,10 +1179,7 @@ abstract class SetOperatorNode extends T
 		throws StandardException
 	{
 		if (leftOptPredicates == null) {
-			leftOptPredicates =
-				(PredicateList) getNodeFactory().getNode(
-					C_NodeTypes.PREDICATE_LIST,
-					getContextManager());
+            leftOptPredicates = new PredicateList(getContextManager());
 		}
 
 		return leftOptPredicates;
@@ -1203,10 +1194,7 @@ abstract class SetOperatorNode extends T
 		throws StandardException
 	{
 		if (rightOptPredicates == null) {
-			rightOptPredicates =
-				(PredicateList) getNodeFactory().getNode(
-					C_NodeTypes.PREDICATE_LIST,
-					getContextManager());
+            rightOptPredicates = new PredicateList(getContextManager());
 		}
 
 		return rightOptPredicates;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetRoleNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetRoleNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetRoleNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetRoleNode.java Fri Jun 21 07:47:47 2013
@@ -22,39 +22,41 @@
 package     org.apache.derby.impl.sql.compile;
 
 import java.util.List;
-
+import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.reference.ClassName;
 import org.apache.derby.iapi.services.classfile.VMOpcode;
 import org.apache.derby.iapi.services.compiler.MethodBuilder;
+import org.apache.derby.iapi.services.context.ContextManager;
 import org.apache.derby.iapi.services.sanity.SanityManager;
-import org.apache.derby.iapi.error.StandardException;
-import org.apache.derby.iapi.sql.execute.ConstantAction;
 import org.apache.derby.iapi.sql.StatementType;
-
+import org.apache.derby.iapi.sql.compile.C_NodeTypes;
+import org.apache.derby.iapi.sql.execute.ConstantAction;
 
 /**
  * A SetRoleNode is the root of a QueryTree that represents a SET ROLE
  * statement.
  */
 
-public class SetRoleNode extends MiscellaneousStatementNode
+class SetRoleNode extends MiscellaneousStatementNode
 {
     private String      name;
     private int         type;
 
     /**
-     * Initializer for a SetRoleNode
      *
-     * @param roleName  The name of the new role, null if NONE specified
-     * @param type      Type of role name could be USER or dynamic parameter
-     *
-     */
-    public void init(Object roleName, Object type)
-    {
-        this.name = (String) roleName;
-        if (type != null) {
-            this.type = ((Integer)type).intValue();
-        }
+     * @param roleName The name of the new role, null if NONE specified
+     * @param type Type of role name could be USER or dynamic parameter
+     * @param cm Context manager
+     * @throws StandardException
+     */
+    SetRoleNode(
+            String roleName,
+            int type,
+            ContextManager cm) throws StandardException {
+        super(cm);
+        this.name = roleName;
+        this.type = type;
+        setNodeType(C_NodeTypes.SET_ROLE_NODE);
     }
 
     /**
@@ -63,7 +65,7 @@ public class SetRoleNode extends Miscell
      *
      * @return  This object as a String
      */
-
+    @Override
     public String toString()
     {
         if (SanityManager.DEBUG) {
@@ -87,6 +89,7 @@ public class SetRoleNode extends Miscell
      *
      * @exception StandardException         Thrown on failure
      */
+    @Override
     public ConstantAction   makeConstantAction() throws StandardException
     {
         return getGenericConstantActionFactory().
@@ -100,7 +103,7 @@ public class SetRoleNode extends Miscell
      *
      * @exception StandardException         Thrown on error
      */
-
+    @Override
     void generate(ActivationClassBuilder acb, MethodBuilder mb)
             throws StandardException
     {
@@ -132,7 +135,8 @@ public class SetRoleNode extends Miscell
     private void generateParameterValueSet(ActivationClassBuilder acb)
         throws StandardException
     {
-        List parameterList = getCompilerContext().getParameterList();
+        List<ParameterNode>
+            parameterList = getCompilerContext().getParameterList();
         // parameter list size should be 1
         if (SanityManager.DEBUG) {
             SanityManager.ASSERT(parameterList != null &&
@@ -149,6 +153,7 @@ public class SetRoleNode extends Miscell
      *          NEED_NOTHING_ACTIVATION depending on params
      *
      */
+    @Override
     int activationKind()
     {
         /*
@@ -169,6 +174,7 @@ public class SetRoleNode extends Miscell
 	 *
 	 * @return false
 	 */
+    @Override
 	public boolean isAtomic()
 	{
 		return false;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetSchemaNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetSchemaNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetSchemaNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetSchemaNode.java Fri Jun 21 07:47:47 2013
@@ -22,17 +22,15 @@
 package	org.apache.derby.impl.sql.compile;
 
 import java.util.List;
-
+import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.reference.ClassName;
 import org.apache.derby.iapi.services.classfile.VMOpcode;
-
 import org.apache.derby.iapi.services.compiler.MethodBuilder;
+import org.apache.derby.iapi.services.context.ContextManager;
 import org.apache.derby.iapi.services.sanity.SanityManager;
-
-import org.apache.derby.iapi.error.StandardException;
-import org.apache.derby.iapi.sql.execute.ConstantAction;
 import org.apache.derby.iapi.sql.StatementType;
-
+import org.apache.derby.iapi.sql.compile.C_NodeTypes;
+import org.apache.derby.iapi.sql.execute.ConstantAction;
 
 /**
  * A SetSchemaNode is the root of a QueryTree that 
@@ -43,32 +41,36 @@ import org.apache.derby.iapi.sql.Stateme
  *
  */
 
-public class SetSchemaNode extends MiscellaneousStatementNode
+class SetSchemaNode extends MiscellaneousStatementNode
 {
 	private String 	name;
 	private int 	type;
 	
 	/**
-	 * Initializer for a SetSchemaNode
+     * Constructor for a SetSchemaNode
 	 *
 	 * @param schemaName	The name of the new schema
 	 * @param type			Type of schema name could be USER or dynamic parameter
+     * @param cm            The context manager
 	 *
 	 */
-	public void init(Object schemaName, Object type)
-	{
-		this.name = (String) schemaName;
-		if (type != null)
-			this.type = ((Integer)type).intValue();
+    SetSchemaNode(
+            String schemaName,
+            int type,
+            ContextManager cm) {
+        super(cm);
+        this.name = schemaName;
+        this.type = type;
+        setNodeType(C_NodeTypes.SET_SCHEMA_NODE);
 	}
 
-	/**
+    /**
 	 * Convert this object to a String.  See comments in QueryTreeNode.java
 	 * for how this should be done for tree printing.
 	 *
 	 * @return	This object as a String
 	 */
-
+    @Override
 	public String toString()
 	{
 		if (SanityManager.DEBUG)
@@ -84,7 +86,7 @@ public class SetSchemaNode extends Misce
 		}
 	}
 
-	public String statementToString()
+    String statementToString()
 	{
 		return "SET SCHEMA";
 	}
@@ -94,7 +96,8 @@ public class SetSchemaNode extends Misce
 	 *
 	 * @exception StandardException		Thrown on failure
 	 */
-	public ConstantAction	makeConstantAction() throws StandardException
+    @Override
+    public ConstantAction makeConstantAction() throws StandardException
 	{
 		return	getGenericConstantActionFactory().getSetSchemaConstantAction(name, type);		
 	}
@@ -106,7 +109,7 @@ public class SetSchemaNode extends Misce
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
+    @Override
     void generate(ActivationClassBuilder acb, MethodBuilder mb)
 							throws StandardException
 	{
@@ -136,7 +139,8 @@ public class SetSchemaNode extends Misce
 	void generateParameterValueSet(ActivationClassBuilder acb)
 		throws StandardException
 	{
-		List parameterList = getCompilerContext().getParameterList();
+        List<ParameterNode>
+            parameterList = getCompilerContext().getParameterList();
 		// parameter list size should be 1
 		if (SanityManager.DEBUG)
 			SanityManager.ASSERT(parameterList != null && parameterList.size() == 1);
@@ -152,6 +156,7 @@ public class SetSchemaNode extends Misce
 	 *			NEED_NOTHING_ACTIVATION depending on params
 	 *
 	 */
+    @Override
 	int activationKind()
 	{
 		/*

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetTransactionIsolationNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetTransactionIsolationNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetTransactionIsolationNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetTransactionIsolationNode.java Fri Jun 21 07:47:47 2013
@@ -21,22 +21,14 @@
 
 package	org.apache.derby.impl.sql.compile;
 
-import org.apache.derby.iapi.services.context.ContextManager;
-
-import org.apache.derby.iapi.services.compiler.MethodBuilder;
-
 import org.apache.derby.iapi.error.StandardException;
-
-import org.apache.derby.iapi.sql.execute.ConstantAction;
-
-import org.apache.derby.iapi.sql.Activation;
-import org.apache.derby.iapi.sql.ResultSet;
-
-import org.apache.derby.impl.sql.compile.ActivationClassBuilder;
-
-import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.reference.ClassName;
 import org.apache.derby.iapi.services.classfile.VMOpcode;
+import org.apache.derby.iapi.services.compiler.MethodBuilder;
+import org.apache.derby.iapi.services.context.ContextManager;
+import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.iapi.sql.compile.C_NodeTypes;
+import org.apache.derby.iapi.sql.execute.ConstantAction;
 
 /**
  * A SetTransactionIsolationNode is the root of a QueryTree that represents a SET
@@ -44,18 +36,21 @@ import org.apache.derby.iapi.services.cl
  *
  */
 
-public class SetTransactionIsolationNode extends TransactionStatementNode
+class SetTransactionIsolationNode extends TransactionStatementNode
 {
 	private int		isolationLevel;
 
 	/**
-	 * Initializer for SetTransactionIsolationNode
+     * Constructor for SetTransactionIsolationNode
 	 *
 	 * @param isolationLevel		The new isolation level
-	 */
-	public void init(Object isolationLevel)
+     * @param cm                    The context manager
+     */
+    SetTransactionIsolationNode(int isolationLevel, ContextManager cm)
 	{
-		this.isolationLevel = ((Integer) isolationLevel).intValue();
+        super(cm);
+        setNodeType(C_NodeTypes.SET_TRANSACTION_ISOLATION_NODE);
+        this.isolationLevel = isolationLevel;
 	}
 
 	/**
@@ -64,7 +59,7 @@ public class SetTransactionIsolationNode
 	 *
 	 * @return	This object as a String
 	 */
-
+    @Override
 	public String toString()
 	{
 		if (SanityManager.DEBUG)
@@ -78,7 +73,7 @@ public class SetTransactionIsolationNode
 		}
 	}
 
-	public String statementToString()
+    String statementToString()
 	{
 		return "SET TRANSACTION ISOLATION";
 	}
@@ -90,6 +85,7 @@ public class SetTransactionIsolationNode
 	 * @param mb	The method for the method to be built
 	 * @exception StandardException thrown if generation fails
 	 */
+    @Override
     void generate(ActivationClassBuilder acb, MethodBuilder mb)
 							throws StandardException
 	{
@@ -106,7 +102,8 @@ public class SetTransactionIsolationNode
 	 *
 	 * @exception StandardException		Thrown on failure
 	 */
-	public ConstantAction	makeConstantAction() throws StandardException
+    @Override
+    public ConstantAction makeConstantAction() throws StandardException
 	{
 		return getGenericConstantActionFactory().getSetTransactionIsolationConstantAction(isolationLevel);
 	}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SimpleStringOperatorNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SimpleStringOperatorNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SimpleStringOperatorNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SimpleStringOperatorNode.java Fri Jun 21 07:47:47 2013
@@ -21,42 +21,32 @@
 
 package	org.apache.derby.impl.sql.compile;
 
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
-
-import org.apache.derby.iapi.error.StandardException;
-
-
-import org.apache.derby.iapi.types.TypeId;
-import org.apache.derby.iapi.types.DataTypeDescriptor;
-
-
-import org.apache.derby.iapi.reference.SQLState;
-import org.apache.derby.iapi.reference.ClassName;
-
 import java.sql.Types;
-
 import java.util.List;
+import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.reference.ClassName;
+import org.apache.derby.iapi.reference.SQLState;
+import org.apache.derby.iapi.services.context.ContextManager;
+import org.apache.derby.iapi.sql.compile.C_NodeTypes;
+import org.apache.derby.iapi.types.DataTypeDescriptor;
+import org.apache.derby.iapi.types.TypeId;
 
 /**
  * This node represents a unary upper or lower operator
  *
  */
 
-public class SimpleStringOperatorNode extends UnaryOperatorNode
+class SimpleStringOperatorNode extends UnaryOperatorNode
 {
-	/**
-	 * Initializer for a SimpleOperatorNode
-	 *
-	 * @param operand		The operand
-	 * @param methodName	The method name
-	 */
-
-	public void init(Object operand, Object methodName)
-	{
-		super.init(operand, methodName, methodName);
-	}
+    SimpleStringOperatorNode(
+            ValueNode operand,
+            String methodName,
+            ContextManager cm) throws StandardException {
+        super(operand, methodName, methodName, cm);
+        setNodeType(C_NodeTypes.SIMPLE_STRING_OPERATOR_NODE);
+    }
 
-	/**
+    /**
 	 * Bind this operator
 	 *
 	 * @param fromList			The query's FROM list
@@ -67,7 +57,7 @@ public class SimpleStringOperatorNode ex
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
+    @Override
     ValueNode bindExpression(
         FromList fromList, SubqueryList subqueryList, List<AggregateNode> aggregates)
 			throws StandardException
@@ -103,12 +93,7 @@ public class SimpleStringOperatorNode ex
 								getCastToCharWidth(
 									operand.getTypeServices()));
 			
-					operand =  (ValueNode)
-						getNodeFactory().getNode(
-							C_NodeTypes.CAST_NODE,
-							operand,
-							dtd,
-							getContextManager());
+                    operand = new CastNode(operand, dtd, getContextManager());
 					
 				// DERBY-2910 - Match current schema collation for implicit cast as we do for
 				// explicit casts per SQL Spec 6.12 (10)					
@@ -140,7 +125,7 @@ public class SimpleStringOperatorNode ex
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
+    @Override
 	void bindParameter()
 			throws StandardException
 	{
@@ -159,7 +144,8 @@ public class SimpleStringOperatorNode ex
 	 * This is a length operator node.  Overrides this method
 	 * in UnaryOperatorNode for code generation purposes.
 	 */
-	public String getReceiverInterfaceName() {
+    @Override
+    String getReceiverInterfaceName() {
 	    return ClassName.StringDataValue;
 	}
 }



Mime
View raw message