db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r1506827 [3/4] - in /db/derby/code/trunk/java/engine/org/apache/derby: iapi/services/context/ impl/sql/compile/
Date Thu, 25 Jul 2013 07:12:49 GMT
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NextSequenceNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NextSequenceNode.java?rev=1506827&r1=1506826&r2=1506827&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NextSequenceNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NextSequenceNode.java Thu Jul 25 07:12:46 2013
@@ -29,7 +29,6 @@ import org.apache.derby.iapi.services.cl
 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.CompilerContext;
 import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;
 import org.apache.derby.iapi.sql.dictionary.SequenceDescriptor;
@@ -51,7 +50,6 @@ class NextSequenceNode extends ValueNode
     NextSequenceNode(TableName sequenceName,
                      ContextManager cm) {
         super(cm);
-        setNodeType(C_NodeTypes.NEXT_SEQUENCE_NODE);
         this.sequenceName = sequenceName;
     }
 
@@ -187,7 +185,7 @@ class NextSequenceNode extends ValueNode
         }
     }
 
-    protected boolean isEquivalent(ValueNode other) throws StandardException {
+    boolean isEquivalent(ValueNode other) throws StandardException {
         return false;
     }
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NonStaticMethodCallNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NonStaticMethodCallNode.java?rev=1506827&r1=1506826&r2=1506827&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NonStaticMethodCallNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NonStaticMethodCallNode.java Thu Jul 25 07:12:46 2013
@@ -30,7 +30,6 @@ import org.apache.derby.iapi.services.co
 import org.apache.derby.iapi.services.context.ContextManager;
 import org.apache.derby.iapi.services.loader.ClassInspector;
 import org.apache.derby.iapi.services.sanity.SanityManager;
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.sql.compile.Visitor;
 import org.apache.derby.iapi.store.access.Qualifier;
 import org.apache.derby.iapi.util.JBitSet;
@@ -64,7 +63,6 @@ class NonStaticMethodCallNode extends Me
 			throws StandardException
 	{
         super(methodName, cm);
-        setNodeType(C_NodeTypes.NON_STATIC_METHOD_CALL_NODE);
 		/*
 		** If the receiver is a Java value that has been converted to a
 		** SQL value, get rid of the conversion and just use the Java value

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=1506827&r1=1506826&r2=1506827&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 Thu Jul 25 07:12:46 2013
@@ -28,7 +28,6 @@ import org.apache.derby.iapi.services.cl
 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.util.JBitSet;
 
 /**
@@ -566,7 +565,6 @@ class NormalizeResultSetNode extends Sin
                            ContextManager cm) throws StandardException
 	{
         super(chldRes, tableProperties, cm);
-        setNodeType(C_NodeTypes.NORMALIZE_RESULT_SET_NODE);
         this.forUpdate = forUpdate;
 
         ResultColumnList rcl = chldRes.getResultColumns();

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NotNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NotNode.java?rev=1506827&r1=1506826&r2=1506827&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NotNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NotNode.java Thu Jul 25 07:12:46 2013
@@ -28,7 +28,6 @@ import org.apache.derby.iapi.services.cl
 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.sql.compile.C_NodeTypes;
 
 /**
  * A NotNode represents a NOT operator. Preprocessing will eliminate the 
@@ -47,7 +46,6 @@ public final class NotNode extends Unary
     NotNode(ValueNode operand, ContextManager cm)
             throws StandardException {
         super(operand, "not", cm);
-        setNodeType(C_NodeTypes.NOT_NODE);
     }
 
     /**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NumericConstantNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NumericConstantNode.java?rev=1506827&r1=1506826&r2=1506827&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NumericConstantNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NumericConstantNode.java Thu Jul 25 07:12:46 2013
@@ -26,7 +26,6 @@ import org.apache.derby.iapi.error.Stand
 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.types.DataTypeUtilities;
 import org.apache.derby.iapi.types.NumberDataValue;
 import org.apache.derby.iapi.types.SQLDouble;
@@ -39,6 +38,23 @@ import org.apache.derby.iapi.types.TypeI
 
 public final class NumericConstantNode extends ConstantNode
 {
+
+    // Allowed kinds
+    final static int K_TINYINT = 0;
+    final static int K_SMALLINT = 1;
+    final static int K_INT = 2;
+    final static int K_BIGINT = 3;
+    final static int K_DECIMAL = 4;
+    final static int K_DOUBLE = 5;
+    final static int K_REAL = 6;
+
+    /**
+     * This class is used to hold logically different objects for
+     * space efficiency. {@code kind} represents the logical object
+     * type. See also {@link ValueNode#isSameNodeKind}.
+     */
+    final int kind;
+
     /**
      * Constructor for a typed null node
      * @param t type
@@ -53,7 +69,7 @@ public final class NumericConstantNode e
                 getScale(t, null),
                 true,
                 getMaxWidth(t, null));
-        setNodeType(getNodeType(t));
+        kind = getKind(t);
     }
 
     /**
@@ -64,7 +80,7 @@ public final class NumericConstantNode e
     NumericConstantNode(TypeId t, Object value, ContextManager cm)
             throws StandardException {
         super(cm);
-        setNodeType(getNodeType(t));
+        kind = getKind(t);
         setType(t,
                 getPrecision(t, value),
                 getScale(t, value),
@@ -74,64 +90,64 @@ public final class NumericConstantNode e
     }
 
     private int getPrecision(TypeId t, Object val) throws StandardException {
-        int foo = t.getJDBCTypeId();
-       //switch (t.getJDBCTypeId()) {
-        switch (foo) {
-       case Types.TINYINT:
-           return TypeId.SMALLINT_PRECISION; // FIXME
-       case Types.INTEGER:
-           return TypeId.INT_PRECISION;
-       case Types.SMALLINT:
-           return TypeId.SMALLINT_PRECISION;
-       case Types.BIGINT:
-           return TypeId.LONGINT_PRECISION;
-       case Types.DECIMAL:
+
+        switch (t.getJDBCTypeId()) {
+
+        case Types.TINYINT:
+            return TypeId.SMALLINT_PRECISION; // FIXME
+        case Types.INTEGER:
+            return TypeId.INT_PRECISION;
+        case Types.SMALLINT:
+            return TypeId.SMALLINT_PRECISION;
+        case Types.BIGINT:
+            return TypeId.LONGINT_PRECISION;
+        case Types.DECIMAL:
             if (val != null) {
-               NumberDataValue constantDecimal =
+                NumberDataValue constantDecimal =
                     getDataValueFactory().getDecimalDataValue((String)val);
-               return constantDecimal.getDecimalValuePrecision();
+                return constantDecimal.getDecimalValuePrecision();
             } else {
                 return TypeId.DECIMAL_PRECISION;
             }
-       case Types.DOUBLE:
-           return TypeId.DOUBLE_PRECISION;
-       case Types.REAL:
-           return TypeId.REAL_PRECISION;
-       default:
-           if (SanityManager.DEBUG) {
+        case Types.DOUBLE:
+            return TypeId.DOUBLE_PRECISION;
+        case Types.REAL:
+            return TypeId.REAL_PRECISION;
+        default:
+            if (SanityManager.DEBUG) {
                 SanityManager.NOTREACHED();
-           }
-           return 0;
+            }
+            return 0;
 		}
     }
 
     private int getScale(TypeId t, Object val) throws StandardException {
-       switch (t.getJDBCTypeId()) {
-       case Types.TINYINT:
-           return TypeId.SMALLINT_SCALE; // FIXME
-       case Types.INTEGER:
-           return TypeId.INT_SCALE;
-       case Types.SMALLINT:
-           return TypeId.SMALLINT_SCALE;
-       case Types.BIGINT:
-           return TypeId.LONGINT_SCALE;
-       case Types.DECIMAL:
+        switch (t.getJDBCTypeId()) {
+        case Types.TINYINT:
+            return TypeId.SMALLINT_SCALE; // FIXME
+        case Types.INTEGER:
+            return TypeId.INT_SCALE;
+        case Types.SMALLINT:
+            return TypeId.SMALLINT_SCALE;
+        case Types.BIGINT:
+            return TypeId.LONGINT_SCALE;
+        case Types.DECIMAL:
             if (val != null) {
-               NumberDataValue constantDecimal =
-                        getDataValueFactory().getDecimalDataValue((String)val);
-               return constantDecimal.getDecimalValueScale();
+                NumberDataValue constantDecimal =
+                    getDataValueFactory().getDecimalDataValue((String)val);
+                return constantDecimal.getDecimalValueScale();
             } else {
                 return TypeId.DECIMAL_SCALE;
             }
-       case Types.DOUBLE:
+        case Types.DOUBLE:
             return TypeId.DOUBLE_SCALE;
-       case Types.REAL:
-           return TypeId.REAL_SCALE;
-       default:
-           if (SanityManager.DEBUG) {
+        case Types.REAL:
+            return TypeId.REAL_SCALE;
+        default:
+            if (SanityManager.DEBUG) {
                 SanityManager.NOTREACHED();
-           }
-           return 0;
+            }
+            return 0;
         }
     }
 
@@ -170,27 +186,27 @@ public final class NumericConstantNode e
        }
     }
 
-    private int getNodeType(TypeId t) {
+    private int getKind(TypeId t) {
        switch (t.getJDBCTypeId()) {
        case Types.TINYINT:
-           return C_NodeTypes.TINYINT_CONSTANT_NODE;
+           return K_TINYINT;
        case Types.INTEGER:
-           return C_NodeTypes.INT_CONSTANT_NODE;
+           return K_INT;
        case Types.SMALLINT:
-           return C_NodeTypes.SMALLINT_CONSTANT_NODE;
+           return K_SMALLINT;
        case Types.BIGINT:
-           return C_NodeTypes.BIGINT_CONSTANT_NODE;
+           return K_BIGINT;
        case Types.DECIMAL:
-            return C_NodeTypes.DECIMAL_CONSTANT_NODE;
+            return K_DECIMAL;
        case Types.DOUBLE:
-           return C_NodeTypes.DOUBLE_CONSTANT_NODE;
+           return K_DOUBLE;
        case Types.REAL:
-           return C_NodeTypes.REAL_CONSTANT_NODE;
+           return K_REAL;
        default:
            if (SanityManager.DEBUG) {
                 SanityManager.NOTREACHED();
            }
-           return 0;
+           return -1;
        }
     }
 
@@ -257,29 +273,29 @@ public final class NumericConstantNode e
 	void generateConstant(ExpressionClassBuilder acb, MethodBuilder mb)
 		throws StandardException
 	{
-		switch (getNodeType())
+        switch (kind)
 		{
-		case C_NodeTypes.INT_CONSTANT_NODE:
+        case K_INT:
 			mb.push(value.getInt());
 			break;
-		case C_NodeTypes.TINYINT_CONSTANT_NODE:
+        case K_TINYINT:
 			mb.push(value.getByte());
 			break;
-		case C_NodeTypes.SMALLINT_CONSTANT_NODE:
+        case K_SMALLINT:
 			mb.push(value.getShort());
 			break;
-		case C_NodeTypes.DECIMAL_CONSTANT_NODE:
+        case K_DECIMAL:
             mb.pushNewStart("java.math.BigDecimal");
 			mb.push(value.getString());
             mb.pushNewComplete(1);
 			break;
-		case C_NodeTypes.DOUBLE_CONSTANT_NODE:
+        case K_DOUBLE:
 			mb.push(value.getDouble());
 			break;
-        case C_NodeTypes.REAL_CONSTANT_NODE:
+        case K_REAL:
 			mb.push(value.getFloat());
 			break;
-        case C_NodeTypes.BIGINT_CONSTANT_NODE:
+        case K_BIGINT:
 			mb.push(value.getLong());
 			break;
 		default:
@@ -288,8 +304,12 @@ public final class NumericConstantNode e
 				// we should never really come here-- when the class is created
 				// it should have the correct nodeType set.
 				SanityManager.THROWASSERT(
-						  "Unexpected nodeType = " + getNodeType());
+                          "Unexpected numeric type = " + kind);
 			}
 		}	
 	}
-}		
+
+    @Override
+    boolean isSameNodeKind(ValueNode o) {
+        return super.isSameNodeKind(o) && ((NumericConstantNode)o).kind == kind;
+    }}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrNode.java?rev=1506827&r1=1506826&r2=1506827&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrNode.java Thu Jul 25 07:12:46 2013
@@ -25,7 +25,6 @@ import java.util.List;
 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;
 
 class OrNode extends BinaryLogicalOperatorNode
 {
@@ -44,7 +43,6 @@ class OrNode extends BinaryLogicalOperat
 	{
         super(leftOperand, rightOperand, "or", cm);
 		this.shortCircuitValue = true;
-        setNodeType(C_NodeTypes.OR_NODE);
 	}
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrderByColumn.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrderByColumn.java?rev=1506827&r1=1506826&r2=1506827&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrderByColumn.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrderByColumn.java Thu Jul 25 07:12:46 2013
@@ -25,7 +25,6 @@ import org.apache.derby.iapi.error.Stand
 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.Visitor;
 
 /**
@@ -60,7 +59,6 @@ class OrderByColumn extends OrderedColum
     OrderByColumn(ValueNode expression, ContextManager cm)
 	{
         super(cm);
-        setNodeType(C_NodeTypes.ORDER_BY_COLUMN);
         this.expression = expression;
 	}
 	

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrderByList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrderByList.java?rev=1506827&r1=1506826&r2=1506827&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrderByList.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrderByList.java Thu Jul 25 07:12:46 2013
@@ -29,7 +29,6 @@ import org.apache.derby.iapi.services.cl
 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.CompilerContext;
 import org.apache.derby.iapi.sql.compile.CostEstimate;
 import org.apache.derby.iapi.sql.compile.Optimizable;
@@ -78,7 +77,6 @@ class OrderByList extends OrderedColumnL
     */
    OrderByList(ResultSetNode rs, ContextManager cm) {
        super(OrderByColumn.class, cm);
-       setNodeType(C_NodeTypes.ORDER_BY_LIST);
        this.isTableValueCtorOrdering =
                 (rs instanceof UnionNode &&
                 ((UnionNode)rs).tableConstructor()) ||

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=1506827&r1=1506826&r2=1506827&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 Thu Jul 25 07:12:46 2013
@@ -27,7 +27,6 @@ import org.apache.derby.iapi.services.co
 import org.apache.derby.iapi.services.context.ContextManager;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.sql.ResultColumnDescriptor;
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 
 /**
  * An OrderByNode represents a result set for a sort operation
@@ -56,7 +55,6 @@ class OrderByNode extends SingleChildRes
                 Properties tableProperties,
                 ContextManager cm) throws StandardException {
         super(childRes, tableProperties, cm);
-        setNodeType(C_NodeTypes.ORDER_BY_NODE);
 
         this.orderByList = orderByList;
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ParameterNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ParameterNode.java?rev=1506827&r1=1506826&r2=1506827&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ParameterNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ParameterNode.java Thu Jul 25 07:12:46 2013
@@ -29,7 +29,6 @@ import org.apache.derby.iapi.reference.S
 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.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.sql.compile.CompilerContext;
 import org.apache.derby.iapi.store.access.Qualifier;
 import org.apache.derby.iapi.types.DataTypeDescriptor;
@@ -117,7 +116,6 @@ public class ParameterNode extends Value
                   DataValueDescriptor defaultValue,
                   ContextManager cm) {
         super(cm);
-        setNodeType(C_NodeTypes.PARAMETER_NODE);
         this.parameterNumber = parameterNumber;
         this.defaultValue = defaultValue;
 	}
@@ -506,7 +504,7 @@ public class ParameterNode extends Value
     /**
      * @inheritDoc
      */
-    protected boolean isEquivalent(ValueNode o)
+    boolean isEquivalent(ValueNode o)
     {
     	return false;
     }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/Predicate.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/Predicate.java?rev=1506827&r1=1506826&r2=1506827&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/Predicate.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/Predicate.java Thu Jul 25 07:12:46 2013
@@ -27,7 +27,6 @@ import org.apache.derby.iapi.error.Stand
 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.Optimizable;
 import org.apache.derby.iapi.sql.compile.OptimizablePredicate;
 import org.apache.derby.iapi.sql.compile.Visitor;
@@ -78,7 +77,6 @@ public final class Predicate extends Que
     Predicate(AndNode andNode, JBitSet referencedSet, ContextManager cm)
 	{
         super(cm);
-        setNodeType(C_NodeTypes.PREDICATE);
         this.andNode = andNode;
 		pushable = false;
         this.referencedSet = referencedSet;
@@ -750,16 +748,18 @@ public final class Predicate extends Que
 		if (opNode.getLeftOperand() instanceof ColumnReference)
 		{
 			sBuf.append(
-				((ColumnReference)opNode.getLeftOperand()).getTableName() +
-				"." +
-				((ColumnReference)opNode.getLeftOperand()).getColumnName()
-			);
+                    ((ColumnReference)opNode.getLeftOperand()).getTableName());
+            sBuf.append('.');
+            sBuf.append(
+                    ((ColumnReference)opNode.getLeftOperand()).getColumnName());
 		}
 		else
 			sBuf.append(DUMMY_VAL);
 
 		// Get the operator type.
-		sBuf.append(" " + opNode.operator + " ");
+        sBuf.append(' ');
+        sBuf.append(opNode.operator);
+        sBuf.append(' ');
 
 		// Get right operand's name.
 		if (opNode.getRightOperand() instanceof ColumnReference) {
@@ -977,7 +977,7 @@ public final class Predicate extends Que
 		// to the received result set's columns as appropriate.
 		BinaryRelationalOperatorNode newOpNode = 
             new BinaryRelationalOperatorNode(
-				opNode.getNodeType(),
+                opNode.kind,
 				opNode.getScopedOperand(
 					BinaryRelationalOperatorNode.LEFT,
 					parentRSNsTables,

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=1506827&r1=1506826&r2=1506827&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 Thu Jul 25 07:12:46 2013
@@ -32,7 +32,6 @@ import org.apache.derby.iapi.services.co
 import org.apache.derby.iapi.services.context.ContextManager;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.sql.compile.AccessPath;
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.sql.compile.CompilerContext;
 import org.apache.derby.iapi.sql.compile.ExpressionClassBuilderInterface;
 import org.apache.derby.iapi.sql.compile.Optimizable;
@@ -65,7 +64,6 @@ class PredicateList extends QueryTreeNod
     PredicateList(ContextManager cm)
 	{
         super(Predicate.class, cm);
-        setNodeType(C_NodeTypes.PREDICATE_LIST);
 	}
 
 
@@ -1505,7 +1503,7 @@ class PredicateList extends QueryTreeNod
 
                     BinaryRelationalOperatorNode newRelop =
                             new BinaryRelationalOperatorNode(
-										opNode.getNodeType(),
+                                        opNode.kind,
 										newCRNode,
 										opNode.getRightOperand(),
 										inNode,
@@ -2073,12 +2071,12 @@ class PredicateList extends QueryTreeNod
 					// No match, add new equijoin
 					// Build a new predicate
                     BinaryRelationalOperatorNode newEquals =
-                            new BinaryRelationalOperatorNode(
-										C_NodeTypes.BINARY_EQUALS_OPERATOR_NODE,
-										outerCR.getClone(),
-										innerCR.getClone(),
-                                        false,
-										getContextManager());
+                        new BinaryRelationalOperatorNode(
+                            BinaryRelationalOperatorNode.K_EQUALS,
+                            outerCR.getClone(),
+                            innerCR.getClone(),
+                            false,
+                            getContextManager());
 					newEquals.bindComparisonOperator();
 
                    // Create new predicate into CNF:

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java?rev=1506827&r1=1506826&r2=1506827&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java Thu Jul 25 07:12:46 2013
@@ -30,7 +30,6 @@ import org.apache.derby.iapi.error.Stand
 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.depend.Provider;
 import org.apache.derby.iapi.sql.dictionary.AliasDescriptor;
 import org.apache.derby.iapi.sql.dictionary.PrivilegedSQLObject;
@@ -80,7 +79,6 @@ class PrivilegeNode extends QueryTreeNod
                   TablePrivilegesNode specificPrivileges,
                   ContextManager      cm) throws StandardException {
         super(cm);
-        setNodeType(C_NodeTypes.PRIVILEGE_NODE);
         this.objectType = objectType;
 
         if ( SanityManager.DEBUG)
@@ -133,7 +131,6 @@ class PrivilegeNode extends QueryTreeNod
                   ContextManager cm)
     {
         super(cm);
-        setNodeType(C_NodeTypes.PRIVILEGE_NODE);
         this.objectType = objectType;
         this.objectName = objectName;
         this.privilege = privilege;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ProjectRestrictNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ProjectRestrictNode.java?rev=1506827&r1=1506826&r2=1506827&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ProjectRestrictNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ProjectRestrictNode.java Thu Jul 25 07:12:46 2013
@@ -32,7 +32,6 @@ import org.apache.derby.iapi.services.co
 import org.apache.derby.iapi.services.context.ContextManager;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.sql.compile.AccessPath;
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.sql.compile.CostEstimate;
 import org.apache.derby.iapi.sql.compile.Optimizable;
 import org.apache.derby.iapi.sql.compile.OptimizablePredicate;
@@ -114,7 +113,6 @@ class ProjectRestrictNode extends Single
                         ContextManager   cm)
 	{
         super(childResult, tableProperties, cm);
-        setNodeType(C_NodeTypes.PROJECT_RESTRICT_NODE);
         resultColumns = projection;
         this.restriction = restriction;
         this.restrictionList = restrictionList;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/QueryTreeNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/QueryTreeNode.java?rev=1506827&r1=1506826&r2=1506827&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/QueryTreeNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/QueryTreeNode.java Thu Jul 25 07:12:46 2013
@@ -40,7 +40,6 @@ import org.apache.derby.iapi.services.lo
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.sql.StatementType;
 import org.apache.derby.iapi.sql.StatementUtil;
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.sql.compile.CompilerContext;
 import org.apache.derby.iapi.sql.compile.OptimizerFactory;
 import org.apache.derby.iapi.sql.compile.Parser;
@@ -81,7 +80,6 @@ public abstract class QueryTreeNode impl
 	                                // which this query node encodes.
 	private int		endOffset = -1;
 
-	private int nodeType;
 	private ContextManager cm;
 	private LanguageConnectionContext lcc;
 	private GenericConstantActionFactory	constantActionFactory;
@@ -616,35 +614,6 @@ public abstract class QueryTreeNode impl
 		return	null;
 	}
 
-    /**
-	 * Set the node type for this node.
-	 *
-	 * @param nodeType The node type.
-	 */
-    void setNodeType(int nodeType)
-	{
-		this.nodeType = nodeType;
-	}
-
-	protected int getNodeType()
-	{
-		return nodeType;
-	}
-
-	/**
-	 * For final nodes, return whether or not
-	 * the node represents the specified nodeType.
-	 *
-	 * @param nodeType	The nodeType of interest.
-	 *
-	 * @return Whether or not
-	 * the node represents the specified nodeType.
-	 */
-	protected boolean isInstanceOf(int nodeType)
-	{
-		return (this.nodeType == nodeType);
-	}
-
 	/**
 	 * Get the DataDictionary
 	 *
@@ -809,7 +778,7 @@ public abstract class QueryTreeNode impl
         {
           case Types.VARCHAR: {
               CharConstantNode ccn = new CharConstantNode(
-                      C_NodeTypes.VARCHAR_CONSTANT_NODE,
+                      CharConstantNode.K_VARCHAR,
                       type.getTypeId(),
                       cm);
               ccn.setType(type.getNullabilityType(true));
@@ -861,13 +830,13 @@ public abstract class QueryTreeNode impl
           }
           case Types.LONGVARCHAR: {
               CharConstantNode ccn = new CharConstantNode(
-                  C_NodeTypes.LONGVARCHAR_CONSTANT_NODE, type.getTypeId(), cm);
+                  CharConstantNode.K_LONGVARCHAR, type.getTypeId(), cm);
               ccn.setType(type.getNullabilityType(true));
               return ccn;
           }
           case Types.CLOB: {
               CharConstantNode ccn = new CharConstantNode(
-                  C_NodeTypes.CLOB_CONSTANT_NODE, type.getTypeId(), cm);
+                  CharConstantNode.K_CLOB, type.getTypeId(), cm);
               ccn.setType(type.getNullabilityType(true));
               return ccn;
           }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RenameNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RenameNode.java?rev=1506827&r1=1506826&r2=1506827&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RenameNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RenameNode.java Thu Jul 25 07:12:46 2013
@@ -26,7 +26,6 @@ import org.apache.derby.iapi.reference.S
 import org.apache.derby.iapi.services.context.ContextManager;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.sql.StatementType;
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.sql.compile.CompilerContext;
 import org.apache.derby.iapi.sql.dictionary.ColumnDescriptor;
 import org.apache.derby.iapi.sql.dictionary.ColumnDescriptorList;
@@ -100,7 +99,6 @@ class RenameNode extends DDLStatementNod
                ContextManager cm) throws StandardException
 	{
         super(cm);
-        setNodeType(C_NodeTypes.RENAME_NODE);
         this.usedAlterTable = usedAlterTable;
         this.renamingWhat = renamingWhat;
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumn.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumn.java?rev=1506827&r1=1506826&r2=1506827&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumn.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumn.java Thu Jul 25 07:12:46 2013
@@ -29,7 +29,6 @@ import org.apache.derby.iapi.services.co
 import org.apache.derby.iapi.services.io.StoredFormatIds;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.sql.ResultColumnDescriptor;
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.sql.compile.Visitor;
 import org.apache.derby.iapi.sql.dictionary.ColumnDescriptor;
 import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
@@ -201,11 +200,10 @@ class ResultColumn extends ValueNode
     }
 
     private void setTypeExpressionAndDefault(ValueNode expression) {
-        setNodeType(C_NodeTypes.RESULT_COLUMN);
         setExpression(expression);
 
         if (expression != null &&
-           expression.isInstanceOf(C_NodeTypes.DEFAULT_NODE)) {
+                expression instanceof DefaultNode) {
             // This result column represents a <default> keyword in an insert or
             // update statement
             defaultColumn = true;
@@ -1860,13 +1858,13 @@ class ResultColumn extends ValueNode
 	
     boolean isEquivalent(ValueNode o) throws StandardException
 	{
-        if (o.getNodeType() == getNodeType()) 
-        {                
+        if (isSameNodeKind(o)) {
         	ResultColumn other = (ResultColumn)o;
         	if (expression != null) {
         		return expression.isEquivalent(other.expression);
         	}
         }
+
         return false;
 	}
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java?rev=1506827&r1=1506826&r2=1506827&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java Thu Jul 25 07:12:46 2013
@@ -39,7 +39,6 @@ import org.apache.derby.iapi.services.io
 import org.apache.derby.iapi.services.loader.ClassFactory;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.sql.ResultColumnDescriptor;
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
 import org.apache.derby.iapi.sql.dictionary.ColumnDescriptor;
 import org.apache.derby.iapi.sql.dictionary.ColumnDescriptorList;
@@ -108,7 +107,6 @@ class ResultColumnList extends QueryTree
 
     ResultColumnList(ContextManager cm) {
         super(ResultColumn.class, cm);
-        setNodeType(C_NodeTypes.RESULT_COLUMN_LIST);
 	}
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RevokeNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RevokeNode.java?rev=1506827&r1=1506826&r2=1506827&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RevokeNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RevokeNode.java Thu Jul 25 07:12:46 2013
@@ -26,7 +26,6 @@ import java.util.List;
 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.depend.Provider;
 import org.apache.derby.iapi.sql.execute.ConstantAction;
 
@@ -50,7 +49,6 @@ class RevokeNode extends DDLStatementNod
                           ContextManager cm)
     {
         super(cm);
-        setNodeType(C_NodeTypes.REVOKE_NODE);
         this.privileges = privileges;
         this.grantees = grantees;
     }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RevokeRoleNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RevokeRoleNode.java?rev=1506827&r1=1506826&r2=1506827&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RevokeRoleNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RevokeRoleNode.java Thu Jul 25 07:12:46 2013
@@ -26,7 +26,6 @@ import java.util.List;
 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;
 
 /**
@@ -49,7 +48,6 @@ class RevokeRoleNode extends DDLStatemen
                     ContextManager cm) throws StandardException
 	{
         super(cm);
-        setNodeType(C_NodeTypes.REVOKE_ROLE_NODE);
         this.roles = roles;
         this.grantees = grantees;
 	}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RowCountNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RowCountNode.java?rev=1506827&r1=1506826&r2=1506827&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RowCountNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RowCountNode.java Thu Jul 25 07:12:46 2013
@@ -27,7 +27,6 @@ import org.apache.derby.iapi.services.sa
 import org.apache.derby.iapi.services.classfile.VMOpcode;
 import org.apache.derby.iapi.reference.ClassName;
 import org.apache.derby.iapi.services.context.ContextManager;
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 
 /**
  * The result set generated by this node (RowCountResultSet) implements the
@@ -79,7 +78,6 @@ public final class RowCountNode extends 
         throws StandardException {
 
         super(childResult, null, cm);
-        setNodeType(C_NodeTypes.ROW_COUNT_NODE);
         resultColumns = rcl;
 
         this.offset = offset;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RowNumberFunctionNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RowNumberFunctionNode.java?rev=1506827&r1=1506826&r2=1506827&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RowNumberFunctionNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RowNumberFunctionNode.java Thu Jul 25 07:12:46 2013
@@ -24,7 +24,6 @@ import java.sql.Types;
 import java.util.List;
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.services.context.ContextManager;
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.types.TypeId;
 
 /**
@@ -40,7 +39,6 @@ public final class RowNumberFunctionNode
     RowNumberFunctionNode(ValueNode op, WindowNode w, ContextManager cm)
             throws StandardException {
         super(op, "ROW_NUMBER", w, cm);
-        setNodeType(C_NodeTypes.ROW_NUMBER_FUNCTION_NODE);
         setType( TypeId.getBuiltInTypeId( Types.BIGINT ),
                  TypeId.LONGINT_PRECISION,
                  TypeId.LONGINT_SCALE,

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=1506827&r1=1506826&r2=1506827&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 Thu Jul 25 07:12:46 2013
@@ -31,7 +31,6 @@ import org.apache.derby.iapi.services.cl
 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.Optimizable;
 import org.apache.derby.iapi.sql.compile.OptimizablePredicateList;
@@ -71,7 +70,6 @@ class RowResultSetNode extends FromTable
                      Properties tableProperties,
                      ContextManager cm) {
         super(null /* correlationName */, tableProperties, cm);
-        setNodeType(C_NodeTypes.ROW_RESULT_SET_NODE);
         resultColumns = valuesClause;
 
         if (resultColumns != null) {

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=1506827&r1=1506826&r2=1506827&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 Thu Jul 25 07:12:46 2013
@@ -30,7 +30,6 @@ import org.apache.derby.iapi.services.co
 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.Visitor;
 import org.apache.derby.iapi.types.DataTypeDescriptor;
 import org.apache.derby.iapi.types.JSQLType;
@@ -66,7 +65,6 @@ class SQLToJavaValueNode extends JavaVal
 	 */
     SQLToJavaValueNode(ValueNode value, ContextManager cm) {
         super(cm);
-        setNodeType(C_NodeTypes.SQL_TO_JAVA_VALUE_NODE);
         this.value = value;
     }
 

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=1506827&r1=1506826&r2=1506827&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 Thu Jul 25 07:12:46 2013
@@ -24,7 +24,6 @@ package	org.apache.derby.impl.sql.compil
 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;
 
 /**
@@ -55,7 +54,6 @@ class SavepointNode extends DDLStatement
 		throws StandardException
 	{
         super(cm);
-        setNodeType(C_NodeTypes.SAVEPOINT_NODE);
         this.savepointName = objectName;
         this.savepointStatementType = savepointStatementType;
 

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=1506827&r1=1506826&r2=1506827&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 Thu Jul 25 07:12:46 2013
@@ -28,7 +28,6 @@ import org.apache.derby.iapi.services.cl
 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
@@ -53,7 +52,6 @@ class ScrollInsensitiveResultSetNode  ex
                             Properties tableProperties,
                             ContextManager cm) {
         super(childResult, tableProperties, cm);
-        setNodeType(C_NodeTypes.SCROLL_INSENSITIVE_RESULT_SET_NODE);
         resultColumns = rcl;
 	}
 

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=1506827&r1=1506826&r2=1506827&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 Thu Jul 25 07:12:46 2013
@@ -30,7 +30,6 @@ import org.apache.derby.iapi.reference.L
 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;
@@ -149,7 +148,6 @@ class SelectNode extends ResultSetNode
               OptimizerPlan overridingPlan,
               ContextManager cm) throws StandardException {
         super(cm);
-        setNodeType(C_NodeTypes.SELECT_NODE);
         /* RESOLVE -
 		 * Consider adding selectAggregates and whereAggregates 
 		 */

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=1506827&r1=1506826&r2=1506827&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 Thu Jul 25 07:12:46 2013
@@ -29,7 +29,6 @@ import org.apache.derby.iapi.services.co
 import org.apache.derby.iapi.services.context.ContextManager;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.sql.StatementType;
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.sql.execute.ConstantAction;
 
 /**
@@ -56,7 +55,6 @@ class SetRoleNode extends MiscellaneousS
         super(cm);
         this.name = roleName;
         this.type = type;
-        setNodeType(C_NodeTypes.SET_ROLE_NODE);
     }
 
     /**

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=1506827&r1=1506826&r2=1506827&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 Thu Jul 25 07:12:46 2013
@@ -29,7 +29,6 @@ import org.apache.derby.iapi.services.co
 import org.apache.derby.iapi.services.context.ContextManager;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.sql.StatementType;
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.sql.execute.ConstantAction;
 
 /**
@@ -61,7 +60,6 @@ class SetSchemaNode extends Miscellaneou
         super(cm);
         this.name = schemaName;
         this.type = type;
-        setNodeType(C_NodeTypes.SET_SCHEMA_NODE);
 	}
 
     /**

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=1506827&r1=1506826&r2=1506827&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 Thu Jul 25 07:12:46 2013
@@ -27,7 +27,6 @@ import org.apache.derby.iapi.services.cl
 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;
 
 /**
@@ -49,7 +48,6 @@ class SetTransactionIsolationNode extend
     SetTransactionIsolationNode(int isolationLevel, ContextManager cm)
 	{
         super(cm);
-        setNodeType(C_NodeTypes.SET_TRANSACTION_ISOLATION_NODE);
         this.isolationLevel = 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=1506827&r1=1506826&r2=1506827&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 Thu Jul 25 07:12:46 2013
@@ -27,7 +27,6 @@ import org.apache.derby.iapi.error.Stand
 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;
 
@@ -43,7 +42,6 @@ class SimpleStringOperatorNode extends U
             String methodName,
             ContextManager cm) throws StandardException {
         super(operand, methodName, methodName, cm);
-        setNodeType(C_NodeTypes.SIMPLE_STRING_OPERATOR_NODE);
     }
 
     /**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SpecialFunctionNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SpecialFunctionNode.java?rev=1506827&r1=1506826&r2=1506827&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SpecialFunctionNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SpecialFunctionNode.java Thu Jul 25 07:12:46 2013
@@ -31,7 +31,6 @@ import org.apache.derby.iapi.services.co
 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.CompilerContext;
 import org.apache.derby.iapi.sql.dictionary.DataDictionary;
 import org.apache.derby.iapi.store.access.Qualifier;
@@ -76,6 +75,23 @@ class SpecialFunctionNode extends ValueN
 	*/
 	String sqlName;
 
+    // Allowed kinds
+    final static int K_IDENTITY_VAL = 0;
+    final static int K_CURRENT_ISOLATION = 1;
+    final static int K_CURRENT_SCHEMA = 2;
+    final static int K_USER = 3;
+    final static int K_CURRENT_USER = 4;
+    final static int K_SESSION_USER = 5;
+    final static int K_SYSTEM_USER = 6; // currently not in use
+    final static int K_CURRENT_ROLE = 7;
+
+    /**
+     * This class is used to hold logically different objects for
+     * space efficiency. {@code kind} represents the logical object
+     * type. See also {@link ValueNode#isSameNodeKind}.
+     */
+    final int kind;
+
 	/**
 		Java method name
 	*/
@@ -86,12 +102,16 @@ class SpecialFunctionNode extends ValueN
 	*/
 	private String methodType;
 
-    SpecialFunctionNode(int nodeType, ContextManager cm) {
+    SpecialFunctionNode(int kind, ContextManager cm) {
         super(cm);
-        setNodeType(nodeType); // valid nodeType checked below in bindExpression
-    }
-
+        this.kind = kind;
 
+        if (SanityManager.DEBUG) {
+            if (kind == K_SYSTEM_USER) {
+                SanityManager.THROWASSERT("SYSTEM_USER not expected");
+            }
+        }
+    }
 	/**
 	 * Binding this special function means setting the result DataTypeServices.
 	 * In this case, the result type is based on the operation requested.
@@ -114,37 +134,41 @@ class SpecialFunctionNode extends ValueN
             throws StandardException
     {
         DataTypeDescriptor dtd;
-		int nodeType = getNodeType();
-		switch (nodeType)
-		{
-		case C_NodeTypes.USER_NODE:
-		case C_NodeTypes.CURRENT_USER_NODE:
-		case C_NodeTypes.SYSTEM_USER_NODE:
-			switch (nodeType)
-			{
-				case C_NodeTypes.USER_NODE: sqlName = "USER"; break;
-				case C_NodeTypes.CURRENT_USER_NODE: sqlName = "CURRENT_USER"; break;
-				case C_NodeTypes.SYSTEM_USER_NODE: sqlName = "SYSTEM_USER"; break;
+
+        switch (kind) {
+        case K_USER:
+        case K_CURRENT_USER:
+        case K_SYSTEM_USER:
+            switch (kind) {
+                case K_USER:
+                    sqlName = "USER";
+                    break;
+                case K_CURRENT_USER:
+                    sqlName = "CURRENT_USER";
+                    break;
+                case K_SYSTEM_USER:
+                    sqlName = "SYSTEM_USER";
+                    break;
 			}
             methodName = "getCurrentUserId";
 			methodType = "java.lang.String";
             
-			//SQL spec Section 6.4 Syntax Rule 4 says that the collation type 
-			//of these functions will be the collation of character set 
-			//SQL_IDENTIFIER. In Derby's case, that will mean, the collation of
-			//these functions will be UCS_BASIC. The collation derivation will 
+            // SQL spec Section 6.4 Syntax Rule 4 says that the collation type
+            // of these functions will be the collation of character set
+            // SQL_IDENTIFIER. In Derby's case, that will mean, the collation of
+            // these functions will be UCS_BASIC. The collation derivation will
 			//be implicit. 
             dtd = DataDictionary.TYPE_SYSTEM_IDENTIFIER;
 			break;
 
-        case C_NodeTypes.SESSION_USER_NODE:
+        case K_SESSION_USER:
             methodName = "getSessionUserId";
             methodType = "java.lang.String";
             sqlName = "SESSION_USER";
             dtd = DataDictionary.TYPE_SYSTEM_IDENTIFIER;
             break;
 
-		case C_NodeTypes.CURRENT_SCHEMA_NODE:
+        case K_CURRENT_SCHEMA:
 			sqlName = "CURRENT SCHEMA";
 			methodName = "getCurrentSchemaName";
 			methodType = "java.lang.String";
@@ -156,7 +180,7 @@ class SpecialFunctionNode extends ValueN
             dtd = DataDictionary.TYPE_SYSTEM_IDENTIFIER;
 			break;
 
-		case C_NodeTypes.CURRENT_ROLE_NODE:
+        case K_CURRENT_ROLE:
 			sqlName = "CURRENT_ROLE";
 			methodName = "getCurrentRoleIdDelimited";
 			methodType = "java.lang.String";
@@ -171,14 +195,14 @@ class SpecialFunctionNode extends ValueN
 			//be implicit. (set by default)
 			break;
 
-		case C_NodeTypes.IDENTITY_VAL_NODE:
+        case K_IDENTITY_VAL:
 			sqlName = "IDENTITY_VAL_LOCAL";
 			methodName = "getIdentityValue";
 			methodType = "java.lang.Long";
 			dtd = DataTypeDescriptor.getSQLDataTypeDescriptor("java.math.BigDecimal", 31, 0, true, 31);
 			break;
 
-		case C_NodeTypes.CURRENT_ISOLATION_NODE:
+        case K_CURRENT_ISOLATION:
 			sqlName = "CURRENT ISOLATION";
 			methodName = "getCurrentIsolationLevelStr";
 			methodType = "java.lang.String";
@@ -189,13 +213,13 @@ class SpecialFunctionNode extends ValueN
 			//derivation will be implicit. (set by default).
 			break;
 		default:
-			if (SanityManager.DEBUG)
-			{
-				SanityManager.THROWASSERT("Invalid type for SpecialFunctionNode " + nodeType);
-			}
+            if (SanityManager.DEBUG) {
+                SanityManager.THROWASSERT(
+                        "Invalid type for SpecialFunctionNode " + kind);
+            }
 			dtd = null;
 			break;
-		}
+        }
 
 		checkReliability(sqlName, CompilerContext.USER_ILLEGAL );
 		setType(dtd);
@@ -268,14 +292,20 @@ class SpecialFunctionNode extends ValueN
 			return "";
 		}
 	}
+
+    @Override
+    boolean isSameNodeKind(ValueNode o) {
+        return super.isSameNodeKind(o) &&
+                ((SpecialFunctionNode)o).kind == this.kind;
+    }
         
-	protected boolean isEquivalent(ValueNode o)
+    boolean isEquivalent(ValueNode o)
 	{
-		if (isSameNodeType(o))
-		{
+        if (isSameNodeKind(o)) {
 			SpecialFunctionNode other = (SpecialFunctionNode)o;
 			return methodName.equals(other.methodName);
 		}
+
 		return false;
 	}
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/StaticClassFieldReferenceNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/StaticClassFieldReferenceNode.java?rev=1506827&r1=1506826&r2=1506827&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/StaticClassFieldReferenceNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/StaticClassFieldReferenceNode.java Thu Jul 25 07:12:46 2013
@@ -30,7 +30,6 @@ import org.apache.derby.iapi.services.co
 import org.apache.derby.iapi.services.context.ContextManager;
 import org.apache.derby.iapi.services.loader.ClassInspector;
 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.store.access.Qualifier;
 import org.apache.derby.iapi.util.JBitSet;
@@ -72,7 +71,6 @@ public final class StaticClassFieldRefer
             ContextManager cm)
 	{
         super(cm);
-        setNodeType(C_NodeTypes.STATIC_CLASS_FIELD_REFERENCE_NODE);
         this.fieldName = fieldName;
         this.javaClassName = javaClassName;
         this.classNameDelimitedIdentifier = classNameDelimitedIdentifier;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java?rev=1506827&r1=1506826&r2=1506827&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java Thu Jul 25 07:12:46 2013
@@ -36,7 +36,6 @@ import org.apache.derby.iapi.services.co
 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.CompilerContext;
 import org.apache.derby.iapi.sql.conn.Authorizer;
 import org.apache.derby.iapi.sql.dictionary.AliasDescriptor;
@@ -142,7 +141,6 @@ class StaticMethodCallNode extends Metho
             String javaClassName,
             ContextManager cm) {
         super(methodName, cm);
-        setNodeType(C_NodeTypes.STATIC_METHOD_CALL_NODE);
         this.javaClassName = javaClassName;
     }
 
@@ -160,7 +158,6 @@ class StaticMethodCallNode extends Metho
             ContextManager cm) {
         super(methodName.getTableName(), cm);
         procedureName = methodName;
-        setNodeType(C_NodeTypes.STATIC_METHOD_CALL_NODE);
         this.javaClassName = javaClassName;
     }
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SubqueryList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SubqueryList.java?rev=1506827&r1=1506826&r2=1506827&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SubqueryList.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SubqueryList.java Thu Jul 25 07:12:46 2013
@@ -23,7 +23,6 @@ package	org.apache.derby.impl.sql.compil
 
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.services.context.ContextManager;
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.sql.dictionary.DataDictionary;
 
 /**
@@ -36,7 +35,6 @@ class SubqueryList extends QueryTreeNode
 {
     SubqueryList(ContextManager cm) {
         super(SubqueryNode.class, cm);
-        setNodeType(C_NodeTypes.SUBQUERY_LIST);
     }
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SubqueryNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SubqueryNode.java?rev=1506827&r1=1506826&r2=1506827&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SubqueryNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SubqueryNode.java Thu Jul 25 07:12:46 2013
@@ -31,7 +31,6 @@ import org.apache.derby.iapi.services.co
 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.CompilerContext;
 import org.apache.derby.iapi.sql.compile.CostEstimate;
 import org.apache.derby.iapi.sql.compile.Visitor;
@@ -211,7 +210,6 @@ class SubqueryNode extends ValueNode
                  ContextManager cm)
 	{
         super(cm);
-        setNodeType(C_NodeTypes.SUBQUERY_NODE);
         this.resultSet = resultSet;
         this.subqueryType = subqueryType;
         this.orderByList = orderCols;
@@ -1395,7 +1393,7 @@ class SubqueryNode extends ValueNode
 				{
                     UnaryComparisonOperatorNode leftIsNull = new IsNullNode(
                            leftOperand,
-                           IsNullNode.Sign.IS_NULL,
+                           false,
                            cm);
 					leftIsNull.bindComparisonOperator();
                     newOr = new OrNode(leftIsNull, andLeft, cm);
@@ -1406,7 +1404,7 @@ class SubqueryNode extends ValueNode
 				{
                     UnaryComparisonOperatorNode rightIsNull = new IsNullNode(
                            rightOperand,
-                           IsNullNode.Sign.IS_NULL,
+                           false,
                            cm);
 					rightIsNull.bindComparisonOperator();
                     newOr = new OrNode(rightIsNull, andLeft, cm);
@@ -1445,7 +1443,7 @@ class SubqueryNode extends ValueNode
 			case LT_ANY_SUBQUERY:
 			case GE_ANY_SUBQUERY:
 			case GT_ANY_SUBQUERY:
-                ucoNode = new IsNullNode(this, IsNullNode.Sign.IS_NOT_NULL, cm);
+                ucoNode = new IsNullNode(this, true, cm);
 				break;
 
 			case NOT_IN_SUBQUERY:
@@ -1455,7 +1453,7 @@ class SubqueryNode extends ValueNode
 			case LT_ALL_SUBQUERY:
 			case GE_ALL_SUBQUERY:
 			case GT_ALL_SUBQUERY:
-                ucoNode = new IsNullNode(this, IsNullNode.Sign.IS_NULL, cm);
+                ucoNode = new IsNullNode(this, false, cm);
 				break;
             default:
                 if (SanityManager.DEBUG) {
@@ -1531,7 +1529,7 @@ class SubqueryNode extends ValueNode
 		}
 
 		int bcoType = 0;
-		int nodeType = 0;
+        int kind = -1;
 
 		/* Build the <BinaryComparisonOperator> */
 		switch (operatorType)
@@ -1540,32 +1538,32 @@ class SubqueryNode extends ValueNode
 			case EQ_ANY_SUBQUERY:
 			case NOT_IN_SUBQUERY:
 			case NE_ALL_SUBQUERY:
-				nodeType = C_NodeTypes.BINARY_EQUALS_OPERATOR_NODE;
+                kind = BinaryRelationalOperatorNode.K_EQUALS;
 				break;
 
 			case NE_ANY_SUBQUERY:
 			case EQ_ALL_SUBQUERY:
-				nodeType = C_NodeTypes.BINARY_NOT_EQUALS_OPERATOR_NODE;
+                kind = BinaryRelationalOperatorNode.K_NOT_EQUALS;
 				break;
 
 			case LE_ANY_SUBQUERY:
 			case GT_ALL_SUBQUERY:
-				nodeType = C_NodeTypes.BINARY_LESS_EQUALS_OPERATOR_NODE;
+                kind = BinaryRelationalOperatorNode.K_LESS_EQUALS;
 				break;
 
 			case LT_ANY_SUBQUERY:
 			case GE_ALL_SUBQUERY:
-				nodeType = C_NodeTypes.BINARY_LESS_THAN_OPERATOR_NODE;
+                kind = BinaryRelationalOperatorNode.K_LESS_THAN;
 				break;
 
 			case GE_ANY_SUBQUERY:
 			case LT_ALL_SUBQUERY:
-				nodeType = C_NodeTypes.BINARY_GREATER_EQUALS_OPERATOR_NODE;
+                kind = BinaryRelationalOperatorNode.K_GREATER_EQUALS;
 				break;
 
 			case GT_ANY_SUBQUERY:
 			case LE_ALL_SUBQUERY:
-				nodeType = C_NodeTypes.BINARY_GREATER_THAN_OPERATOR_NODE;
+                kind = BinaryRelationalOperatorNode.K_GREATER_THAN;
 				break;
 
 			default:
@@ -1575,7 +1573,7 @@ class SubqueryNode extends ValueNode
 		}
 
         BinaryComparisonOperatorNode bcoNode = new BinaryRelationalOperatorNode(
-                nodeType,
+                kind,
                 leftOperand,
                 rightOperand,
                 false,
@@ -2335,33 +2333,33 @@ class SubqueryNode extends ValueNode
 	private void changeToCorrespondingExpressionType()
 		throws StandardException
 	{
-        int nodeType = 0;
+        int nodeType = -1;
 
         switch (subqueryType)
   		{
   			case EQ_ANY_SUBQUERY:
   			case IN_SUBQUERY:
-                nodeType = C_NodeTypes.BINARY_EQUALS_OPERATOR_NODE;
+                nodeType = BinaryRelationalOperatorNode.K_EQUALS;
   				break;
 
   			case NE_ANY_SUBQUERY:
-                nodeType = C_NodeTypes.BINARY_NOT_EQUALS_OPERATOR_NODE;
+                nodeType = BinaryRelationalOperatorNode.K_NOT_EQUALS;
   				break;
 
   			case LE_ANY_SUBQUERY:
-                nodeType = C_NodeTypes.BINARY_LESS_EQUALS_OPERATOR_NODE;
+                nodeType = BinaryRelationalOperatorNode.K_LESS_EQUALS;
   				break;
 
   			case LT_ANY_SUBQUERY:
-                nodeType = C_NodeTypes.BINARY_LESS_THAN_OPERATOR_NODE;
+                nodeType = BinaryRelationalOperatorNode.K_LESS_THAN;
   				break;
 
   			case GE_ANY_SUBQUERY:
-                nodeType = C_NodeTypes.BINARY_GREATER_EQUALS_OPERATOR_NODE;
+                nodeType = BinaryRelationalOperatorNode.K_GREATER_EQUALS;
   				break;
 
   			case GT_ANY_SUBQUERY:
-                nodeType = C_NodeTypes.BINARY_GREATER_THAN_OPERATOR_NODE;
+                nodeType = BinaryRelationalOperatorNode.K_GREATER_THAN;
   				break;
             default:
                 if (SanityManager.DEBUG) {
@@ -2410,7 +2408,7 @@ class SubqueryNode extends ValueNode
     /**
      * {@inheritDoc}
      */    
-    protected boolean isEquivalent(ValueNode o)
+    boolean isEquivalent(ValueNode o)
     {
     	return false;
     }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java?rev=1506827&r1=1506826&r2=1506827&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java Thu Jul 25 07:12:46 2013
@@ -36,7 +36,6 @@ import org.apache.derby.iapi.services.io
 import org.apache.derby.iapi.services.property.PropertyUtil;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.sql.StatementType;
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.sql.compile.CompilerContext;
 import org.apache.derby.iapi.sql.depend.DependencyManager;
 import org.apache.derby.iapi.sql.depend.ProviderInfo;
@@ -68,7 +67,6 @@ class TableElementList extends QueryTree
 
     public TableElementList(ContextManager cm) {
         super(TableElementNode.class, cm);
-        setNodeType(C_NodeTypes.TABLE_ELEMENT_LIST);
     }
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementNode.java?rev=1506827&r1=1506826&r2=1506827&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementNode.java Thu Jul 25 07:12:46 2013
@@ -23,7 +23,6 @@ package	org.apache.derby.impl.sql.compil
 
 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 TableElementNode is an item in a TableElementList, and represents
@@ -77,7 +76,6 @@ class TableElementNode extends QueryTree
     TableElementNode(String name, ContextManager cm)
 	{
         super(cm);
-        setNodeType(C_NodeTypes.TABLE_ELEMENT_NODE);
         this.name = name;
 	}
 
@@ -176,8 +174,12 @@ class TableElementNode extends QueryTree
 		else if ( this instanceof ConstraintDefinitionNode ) { return AT_DROP_CONSTRAINT; }
 		else if ( this instanceof ModifyColumnNode )
         {
-            if ( getNodeType() == C_NodeTypes.DROP_COLUMN_NODE ) { return AT_DROP_COLUMN; }
-            else { return AT_MODIFY_COLUMN; }
+            if (((ModifyColumnNode)this).kind == ModifyColumnNode.K_DROP_COLUMN)
+            {
+                return AT_DROP_COLUMN;
+            } else {
+                return AT_MODIFY_COLUMN;
+            }
         }
 		else { return elementType; }
 	}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableName.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableName.java?rev=1506827&r1=1506826&r2=1506827&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableName.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableName.java Thu Jul 25 07:12:46 2013
@@ -26,7 +26,6 @@ import org.apache.derby.iapi.reference.P
 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.dictionary.DataDictionary;
 import org.apache.derby.iapi.util.IdUtil;
 
@@ -58,7 +57,6 @@ public class TableName extends QueryTree
     TableName(String schemaName, String tableName, ContextManager cm)
 	{
         super(cm);
-        setNodeType(C_NodeTypes.TABLE_NAME);
 		hasSchema = schemaName != null;
         this.schemaName = schemaName;
         this.tableName = tableName;
@@ -84,7 +82,6 @@ public class TableName extends QueryTree
         ContextManager cm)
 	{
         super(cm);
-        setNodeType(C_NodeTypes.TABLE_NAME);
         hasSchema = schemaName != null;
         this.schemaName = schemaName;
         this.tableName = tableName;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TablePrivilegesNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TablePrivilegesNode.java?rev=1506827&r1=1506826&r2=1506827&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TablePrivilegesNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TablePrivilegesNode.java Thu Jul 25 07:12:46 2013
@@ -27,7 +27,6 @@ import org.apache.derby.iapi.error.Stand
 import org.apache.derby.iapi.reference.SQLState;
 import org.apache.derby.iapi.services.context.ContextManager;
 import org.apache.derby.iapi.services.io.FormatableBitSet;
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
 import org.apache.derby.iapi.sql.depend.DependencyManager;
 import org.apache.derby.iapi.sql.depend.Provider;
@@ -52,7 +51,6 @@ class TablePrivilegesNode extends QueryT
 
     TablePrivilegesNode(ContextManager cm) {
         super(cm);
-        setNodeType(C_NodeTypes.TABLE_PRIVILEGES_NODE);
     }
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TernaryOperatorNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TernaryOperatorNode.java?rev=1506827&r1=1506826&r2=1506827&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TernaryOperatorNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TernaryOperatorNode.java Thu Jul 25 07:12:46 2013
@@ -50,9 +50,25 @@ import org.apache.derby.iapi.util.ReuseF
 
 class TernaryOperatorNode extends OperatorNode
 {
+
+    // Allowed kinds
+    final static int K_TRIM = 0;
+    final static int K_LOCATE = 1;
+    final static int K_SUBSTRING = 2;
+    final static int K_LIKE = 3;
+    final static int K_TIMESTAMPADD = 4;
+    final static int K_TIMESTAMPDIFF = 5;
+
+    /**
+     * This class is used to hold logically different objects for
+     * space efficiency. {@code kind} represents the logical object
+     * type. See also {@link ValueNode#isSameNodeKind}.
+     */
+    final int kind;
+
+
 	String		operator;
 	String		methodName;
-	int			operatorType;
 	ValueNode	receiver; 
 
 	ValueNode	leftOperand;
@@ -64,12 +80,6 @@ class TernaryOperatorNode extends Operat
 	String		rightInterfaceType;
 	int			trimType;
 
-    static final int TRIM = 0;
-    static final int LOCATE = 1;
-    static final int SUBSTRING = 2;
-    static final int LIKE = 3;
-    static final int TIMESTAMPADD = 4;
-    static final int TIMESTAMPDIFF = 5;
 	static final String[] TernaryOperators = {"trim", "LOCATE", "substring", "like", "TIMESTAMPADD", "TIMESTAMPDIFF"};
 	static final String[] TernaryMethodNames = {"ansiTrim", "locate", "substring", "like", "timestampAdd", "timestampDiff"};
 	static final String[] TernaryResultType = {ClassName.StringDataValue, 
@@ -94,62 +104,59 @@ class TernaryOperatorNode extends Operat
      *                      {@code substr()})
 	 * @param leftOperand	The left operand of the node
 	 * @param rightOperand	The right operand of the node
-	 * @param operatorType	The type of the operand
+     * @param kind          The kind of the operand
      * @param cm            The context manager
      */
     TernaryOperatorNode(
                     ValueNode receiver,
                     ValueNode leftOperand,
                     ValueNode rightOperand,
-                    int operatorType,
-                    int trimType,
+                    int kind,
                     ContextManager cm)
     {
         super(cm);
+        this.kind = kind;
         constructorMinion(
-                receiver, leftOperand, rightOperand, operatorType, trimType);
+                receiver, leftOperand, rightOperand, -1);
     }
 
     /**
      * Constructor for a TernaryOperatorNode
      *
-     * @param nodeType      The node type
      * @param receiver      The receiver (e.g., string being operated on in
      *                      {@code substr()})
      * @param leftOperand   The left operand of the node
      * @param rightOperand  The right operand of the node
-     * @param operatorType  The type of the operand
+     * @param kind          The kind of the operand
+     * @param trimType      The trim type
      * @param cm            The context manager
      */
-    TernaryOperatorNode(int nodeType,
-                        ValueNode receiver,
+    TernaryOperatorNode(ValueNode receiver,
                         ValueNode leftOperand,
                         ValueNode rightOperand,
-                        int operatorType,
+                        int kind,
                         int trimType,
                         ContextManager cm)
     {
         super(cm);
-        setNodeType(nodeType);
+        this.kind = kind;
         constructorMinion(
-                receiver, leftOperand, rightOperand, operatorType, trimType);
+                receiver, leftOperand, rightOperand, trimType);
     }
 
     private void constructorMinion(ValueNode receiver,
                                    ValueNode leftOperand,
                                    ValueNode rightOperand,
-                                   int operatorType,
                                    int trimType) {
         this.receiver = receiver;
         this.leftOperand = leftOperand;
         this.rightOperand = rightOperand;
-        this.operatorType = operatorType;
-        this.operator = TernaryOperators[this.operatorType];
-        this.methodName = TernaryMethodNames[this.operatorType];
-        this.resultInterfaceType = TernaryResultType[this.operatorType];
-        this.receiverInterfaceType = TernaryArgType[this.operatorType][0];
-        this.leftInterfaceType = TernaryArgType[this.operatorType][1];
-        this.rightInterfaceType = TernaryArgType[this.operatorType][2];
+        this.operator = TernaryOperators[this.kind];
+        this.methodName = TernaryMethodNames[this.kind];
+        this.resultInterfaceType = TernaryResultType[this.kind];
+        this.receiverInterfaceType = TernaryArgType[this.kind][0];
+        this.leftInterfaceType = TernaryArgType[this.kind][1];
+        this.rightInterfaceType = TernaryArgType[this.kind][2];
 
         if (trimType != -1) {
             this.trimType = trimType;
@@ -243,16 +250,18 @@ class TernaryOperatorNode extends Operat
 			rightOperand = rightOperand.bindExpression(fromList, subqueryList, 
                 aggregates);
 		}
-		if (operatorType == TRIM)
+
+        if (kind == K_TRIM) {
 			trimBind();
-		else if (operatorType == LOCATE)
+        } else if (kind == K_LOCATE) {
 			locateBind();
-		else if (operatorType == SUBSTRING)
+        } else if (kind == K_SUBSTRING) {
 			substrBind();
-		else if (operatorType == TIMESTAMPADD)
+        } else if (kind == K_TIMESTAMPADD) {
             timestampAddBind();
-		else if (operatorType == TIMESTAMPDIFF)
+        } else if (kind == K_TIMESTAMPDIFF) {
             timestampDiffBind();
+        }
 
 		return this;
 	}
@@ -314,7 +323,7 @@ class TernaryOperatorNode extends Operat
 		LocalField field = acb.newFieldDeclaration(Modifier.PRIVATE, resultInterfaceType);
 
 		receiver.generateExpression(acb, mb);
-		if (operatorType == TRIM)
+        if (kind == K_TRIM)
 		{
 			mb.push(trimType);
 			leftOperand.generateExpression(acb, mb);
@@ -324,7 +333,7 @@ class TernaryOperatorNode extends Operat
 			nargs = 3;
 			receiverType = receiverInterfaceType;
 		}
-		else if (operatorType == LOCATE)
+        else if (kind == K_LOCATE)
 		{
 			leftOperand.generateExpression(acb, mb); 
 			mb.upCast(leftInterfaceType);
@@ -334,7 +343,7 @@ class TernaryOperatorNode extends Operat
 			nargs = 3;
 		
 		}
-		else if (operatorType == SUBSTRING)
+        else if (kind == K_SUBSTRING)
 		{
 			leftOperand.generateExpression(acb, mb); 
 			mb.upCast(leftInterfaceType);
@@ -353,7 +362,7 @@ class TernaryOperatorNode extends Operat
 			nargs = 4;
 			receiverType = receiverInterfaceType;
 		}
-		else if (operatorType == TIMESTAMPADD || operatorType == TIMESTAMPDIFF)
+        else if (kind == K_TIMESTAMPADD || kind == K_TIMESTAMPDIFF)
         {
             Object intervalType = leftOperand.getConstantValueAsObject();
             if( SanityManager.DEBUG)
@@ -361,7 +370,7 @@ class TernaryOperatorNode extends Operat
                                       "Invalid interval type used for " + operator);
             mb.push( ((Integer) intervalType).intValue());
             rightOperand.generateExpression( acb, mb);
-            mb.upCast( TernaryArgType[ operatorType][2]);
+            mb.upCast(TernaryArgType[kind][2]);
             acb.getCurrentDateExpression( mb);
 			mb.getField(field);
 			nargs = 4;
@@ -995,11 +1004,16 @@ class TernaryOperatorNode extends Operat
 		return new DataTypeDescriptor(TypeId.getBuiltInTypeId(Types.VARCHAR), true);
 	}
         
-    protected boolean isEquivalent(ValueNode o) throws StandardException
+    boolean isSameNodeKind(ValueNode o) {
+        return super.isSameNodeKind(o) &&
+                ((TernaryOperatorNode)o).kind == this.kind;
+    }
+
+
+    boolean isEquivalent(ValueNode o) throws StandardException
     {
-    	if (isSameNodeType(o)) 
-	{
-		TernaryOperatorNode other = (TernaryOperatorNode)o;
+        if (isSameNodeKind(o)) {
+            TernaryOperatorNode other = (TernaryOperatorNode)o;
 		
 			/*
 			 * SUBSTR function can either have 2 or 3 arguments.  In the 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TestConstraintNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TestConstraintNode.java?rev=1506827&r1=1506826&r2=1506827&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TestConstraintNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TestConstraintNode.java Thu Jul 25 07:12:46 2013
@@ -27,7 +27,6 @@ import org.apache.derby.iapi.reference.C
 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.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.types.DataTypeDescriptor;
 import org.apache.derby.iapi.types.TypeId;
 
@@ -59,10 +58,9 @@ class TestConstraintNode extends UnaryLo
             String constraintName,
             ContextManager cm) throws StandardException {
         super(booleanValue, "throwExceptionIfFalse", cm);
-        setNodeType(C_NodeTypes.TEST_CONSTRAINT_NODE);
         this.sqlState = sqlState;
-       this.tableName = tableName;
-       this.constraintName = constraintName;
+        this.tableName = tableName;
+        this.constraintName = constraintName;
     }
 
     /**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TimestampOperatorNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TimestampOperatorNode.java?rev=1506827&r1=1506826&r2=1506827&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TimestampOperatorNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TimestampOperatorNode.java Thu Jul 25 07:12:46 2013
@@ -29,7 +29,6 @@ import org.apache.derby.iapi.reference.S
 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.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.types.DataTypeDescriptor;
 import org.apache.derby.iapi.types.TypeId;
 
@@ -53,7 +52,6 @@ class TimestampOperatorNode extends Bina
                           ContextManager cm)
     {
         super(cm);
-        setNodeType(C_NodeTypes.TIMESTAMP_OPERATOR_NODE);
         leftOperand = date;
         rightOperand = time;
         operator = "timestamp";



Mime
View raw message