You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by da...@apache.org on 2013/06/21 09:47:52 UTC
svn commit: r1495305 [2/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/sql...
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AggregateNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AggregateNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AggregateNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AggregateNode.java Fri Jun 21 07:47:47 2013
@@ -21,38 +21,28 @@
package org.apache.derby.impl.sql.compile;
+import java.util.List;
+import org.apache.derby.catalog.AliasInfo;
+import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.reference.SQLState;
import org.apache.derby.iapi.services.compiler.MethodBuilder;
-
-import org.apache.derby.iapi.services.sanity.SanityManager;
-import org.apache.derby.iapi.services.loader.ClassInspector;
+import org.apache.derby.iapi.services.context.ContextManager;
import org.apache.derby.iapi.services.loader.ClassFactory;
-
-
+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.sql.dictionary.AliasDescriptor;
+import org.apache.derby.iapi.sql.dictionary.DataDictionary;
import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;
-
-import org.apache.derby.iapi.sql.compile.CompilerContext;
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
-
import org.apache.derby.iapi.types.DataTypeDescriptor;
-import org.apache.derby.iapi.sql.dictionary.DataDictionary;
-
-import org.apache.derby.iapi.error.StandardException;
-import org.apache.derby.iapi.reference.SQLState;
-
-
-import org.apache.derby.catalog.AliasInfo;
-
-import java.util.List;
-
/**
- * An Aggregate Node is a node that reprsents a set function/aggregate.
+ * An Aggregate Node is a node that represents a set function/aggregate.
* It used for all system aggregates as well as user defined aggregates.
- *
*/
-public class AggregateNode extends UnaryOperatorNode
+class AggregateNode extends UnaryOperatorNode
{
private boolean distinct;
@@ -74,55 +64,86 @@ public class AggregateNode extends Unary
private ResultColumn generatedRC;
private ColumnReference generatedRef;
- /**
- * Intializer. Used for user defined and internally defined aggregates.
- * Called when binding a StaticMethodNode that we realize is an aggregate.
- *
- * @param operand the value expression for the aggregate
- * @param uadClass the class name for user aggregate definition for the aggregate
- * or the Class for the internal aggregate type.
- * @param distinct boolean indicating whether this is distinct
+ /**
+ * Constructed when binding a StaticMethodNode that we realize is
+ * an aggregate.
+ *
+ * @param operand the value expression for the aggregate
+ * @param uadClass the class of the user aggregate definition
+ * @param distinct boolean indicating whether this is distinct
* or not.
- * @param aggregateName the name of the aggregate from the user's perspective,
- * e.g. MAX
- *
- * @exception StandardException on error
- */
- public void init
- (
- Object operand,
- Object uadClass,
- Object distinct,
- Object aggregateName
- ) throws StandardException
- {
- super.init(operand);
- this.aggregateName = (String) aggregateName;
+ * @param aggregateName the name of the aggregate from the user's
+ * perspective, e.g. MAX
+ * @param cm context manager
+ * @throws StandardException
+ */
+ AggregateNode(
+ ValueNode operand,
+ UserAggregateDefinition uadClass,
+ boolean distinct,
+ String aggregateName,
+ ContextManager cm) throws StandardException {
+ super(operand, cm);
+ setNodeType(C_NodeTypes.AGGREGATE_NODE);
+ this.aggregateName = aggregateName;
+ setUserDefinedAggregate(uadClass);
+ this.distinct = distinct;
+ }
- if ( uadClass instanceof UserAggregateDefinition )
- {
- setUserDefinedAggregate( (UserAggregateDefinition) uadClass );
- this.distinct = ((Boolean) distinct).booleanValue();
- }
- else if ( uadClass instanceof TableName )
- {
- this.userAggregateName = (TableName) uadClass;
- this.distinct = ((Boolean) distinct).booleanValue();
- }
- else
- {
- this.aggregateDefinitionClass = (Class) uadClass;
+ /**
+ * @param operand the value expression for the aggregate
+ * @param uadClass the class name for user aggregate definition
+ * for the aggregate
+ * @param distinct boolean indicating whether this is distinct
+ * or not.
+ * @param aggregateName the name of the aggregate from the user's
+ * perspective, e.g. MAX
+ * @param cm context manager
+ * @throws StandardException
+ */
+ AggregateNode(
+ ValueNode operand,
+ TableName uadClass,
+ boolean distinct,
+ String aggregateName,
+ ContextManager cm) throws StandardException {
+ super(operand, cm);
+ setNodeType(C_NodeTypes.AGGREGATE_NODE);
+ this.aggregateName = aggregateName;
+ this.userAggregateName = uadClass;
+ this.distinct = distinct;
+ }
+
+ /**
+ * @param operand the value expression for the aggregate
+ * @param uadClass Class for the internal aggregate type
+ * @param distinct boolean indicating whether this is distinct
+ * or not.
+ * @param aggregateName the name of the aggregate from the user's
+ * perspective, e.g. MAX
+ * @param cm context manager
+ * @throws StandardException
+ */
+ AggregateNode(
+ ValueNode operand,
+ Class uadClass,
+ boolean distinct,
+ String aggregateName,
+ ContextManager cm) throws StandardException {
+ super(operand, cm);
+ setNodeType(C_NodeTypes.AGGREGATE_NODE);
+ this.aggregateName = aggregateName;
+ this.aggregateDefinitionClass = uadClass;
+
+ // Distinct is meaningless for min and max
+ if (!aggregateDefinitionClass.equals(MaxMinAggregateDefinition.class)) {
+ this.distinct = distinct;
+ }
+
+ this.aggregateDefinitionClassName = aggregateDefinitionClass.getName();
+ }
- // Distinct is meaningless for min and max
- if (!aggregateDefinitionClass.equals(MaxMinAggregateDefinition.class))
- {
- this.distinct = ((Boolean) distinct).booleanValue();
- }
- this.aggregateDefinitionClassName = aggregateDefinitionClass.getName();
- }
-
- }
/** initialize fields for user defined aggregate */
private void setUserDefinedAggregate( UserAggregateDefinition userAgg )
{
@@ -148,8 +169,8 @@ public class AggregateNode extends Unary
*
* @exception StandardException Thrown on error
*/
- public ValueNode replaceAggregatesWithColumnReferences(ResultColumnList rcl, int tableNumber)
- throws StandardException
+ ValueNode replaceAggregatesWithColumnReferences(
+ ResultColumnList rcl, int tableNumber) throws StandardException
{
/*
@@ -162,21 +183,16 @@ public class AggregateNode extends Unary
String generatedColName;
CompilerContext cc = getCompilerContext();
generatedColName ="SQLCol" + cc.getNextColumnNumber();
- generatedRC = (ResultColumn) getNodeFactory().getNode(
- C_NodeTypes.RESULT_COLUMN,
- generatedColName,
- this,
- getContextManager());
+ generatedRC =
+ new ResultColumn(generatedColName, this, getContextManager());
generatedRC.markGenerated();
/*
** Parse time.
*/
- generatedRef = (ColumnReference) getNodeFactory().getNode(
- C_NodeTypes.COLUMN_REFERENCE,
- generatedRC.getName(),
- null,
- getContextManager());
+ generatedRef = new ColumnReference(generatedRC.getName(),
+ null,
+ getContextManager());
// RESOLVE - unknown nesting level, but not correlated, so nesting levels must be 0
generatedRef.setSource(generatedRC);
@@ -221,7 +237,7 @@ public class AggregateNode extends Unary
*
* @return the result column
*/
- public ResultColumn getGeneratedRC()
+ ResultColumn getGeneratedRC()
{
if (SanityManager.DEBUG)
{
@@ -241,7 +257,7 @@ public class AggregateNode extends Unary
*
* @return the column reference
*/
- public ColumnReference getGeneratedRef()
+ ColumnReference getGeneratedRef()
{
if (SanityManager.DEBUG)
{
@@ -265,6 +281,7 @@ public class AggregateNode extends Unary
*
* @exception StandardException Thrown on error
*/
+ @Override
ValueNode bindExpression(
FromList fromList, SubqueryList subqueryList, List<AggregateNode> aggregates)
throws StandardException
@@ -417,7 +434,7 @@ public class AggregateNode extends Unary
if ( isUserDefinedAggregate() )
{
ValueNode castNode = ((UserAggregateDefinition) uad).castInputValue
- ( operand, getNodeFactory(), getContextManager() );
+ ( operand, getContextManager() );
if ( castNode != null )
{
@@ -435,7 +452,7 @@ public class AggregateNode extends Unary
/**
* Resolve a user-defined aggregate.
*/
- public static AliasDescriptor resolveAggregate
+ static AliasDescriptor resolveAggregate
( DataDictionary dd, SchemaDescriptor sd, String rawName )
throws StandardException
{
@@ -443,10 +460,10 @@ public class AggregateNode extends Unary
// been created yet. in that case, it doesn't have any aggregates in it.
if ( sd.getUUID() == null ) { return null; }
- java.util.List list = dd.getRoutineList
+ java.util.List<AliasDescriptor> list = dd.getRoutineList
( sd.getUUID().toString(), rawName, AliasInfo.ALIAS_NAME_SPACE_AGGREGATE_AS_CHAR );
- if ( list.size() > 0 ) { return (AliasDescriptor) list.get( 0 ); }
+ if ( list.size() > 0 ) { return list.get( 0 ); }
return null;
}
@@ -539,7 +556,7 @@ public class AggregateNode extends Unary
*
* @return true/false
*/
- public boolean isDistinct()
+ boolean isDistinct()
{
return distinct;
}
@@ -550,7 +567,7 @@ public class AggregateNode extends Unary
*
* @return the class name
*/
- public String getAggregatorClassName()
+ String getAggregatorClassName()
{
return aggregatorClassName.toString();
}
@@ -561,7 +578,7 @@ public class AggregateNode extends Unary
*
* @return the class name
*/
- public String getAggregateName()
+ String getAggregateName()
{
return aggregateName;
}
@@ -576,7 +593,7 @@ public class AggregateNode extends Unary
*
* @exception StandardException on error
*/
- public ResultColumn getNewAggregatorResultColumn(DataDictionary dd)
+ ResultColumn getNewAggregatorResultColumn(DataDictionary dd)
throws StandardException
{
String className = aggregatorClassName.toString();
@@ -599,11 +616,7 @@ public class AggregateNode extends Unary
** Create a result column with this new node below
** it.
*/
- return (ResultColumn) getNodeFactory().getNode(
- C_NodeTypes.RESULT_COLUMN,
- aggregateName,
- nullNode,
- getContextManager());
+ return new ResultColumn(aggregateName, nullNode, getContextManager());
}
@@ -617,7 +630,7 @@ public class AggregateNode extends Unary
*
* @exception StandardException on error
*/
- public ResultColumn getNewExpressionResultColumn(DataDictionary dd)
+ ResultColumn getNewExpressionResultColumn(DataDictionary dd)
throws StandardException
{
ValueNode node;
@@ -631,12 +644,8 @@ public class AggregateNode extends Unary
this.getNewNullResultExpression() :
operand;
-
- return (ResultColumn) getNodeFactory().getNode(
- C_NodeTypes.RESULT_COLUMN,
- "##aggregate expression",
- node,
- getContextManager());
+ return new ResultColumn(
+ "##aggregate expression", node, getContextManager());
}
/**
@@ -647,7 +656,7 @@ public class AggregateNode extends Unary
*
* @exception StandardException on error
*/
- public ValueNode getNewNullResultExpression()
+ ValueNode getNewNullResultExpression()
throws StandardException
{
/*
@@ -667,6 +676,7 @@ public class AggregateNode extends Unary
*
* @exception StandardException Thrown on error
*/
+ @Override
void generateExpression(ExpressionClassBuilder acb, MethodBuilder mb)
throws StandardException
{
@@ -684,6 +694,7 @@ public class AggregateNode extends Unary
*
* @return a string representation of this node
*/
+ @Override
public String toString()
{
if (SanityManager.DEBUG)
@@ -698,12 +709,13 @@ public class AggregateNode extends Unary
}
}
- public boolean isConstant()
+ boolean isConstant()
{
return false;
}
- public boolean constantExpression(PredicateList where)
+ @Override
+ boolean constantExpression(PredicateList where)
{
return false;
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AggregateWindowFunctionNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AggregateWindowFunctionNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AggregateWindowFunctionNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AggregateWindowFunctionNode.java Fri Jun 21 07:47:47 2013
@@ -24,40 +24,37 @@ import java.util.List;
import org.apache.derby.iapi.error.StandardException;
import org.apache.derby.iapi.services.sanity.SanityManager;
import org.apache.derby.iapi.reference.SQLState;
+import org.apache.derby.iapi.services.context.ContextManager;
+import org.apache.derby.iapi.sql.compile.C_NodeTypes;
/**
* Represents aggregate function calls on a window
*/
-public final class AggregateWindowFunctionNode extends WindowFunctionNode
+final class AggregateWindowFunctionNode extends WindowFunctionNode
{
private AggregateNode aggregateFunction;
- /**
- * Initializer. QueryTreeNode override.
- *
- * @param arg1 The window definition or reference
- * @param arg2 aggregate function node
- *
- * @exception StandardException
- */
- public void init(Object arg1, Object arg2)
- throws StandardException
- {
- super.init(null, "?", arg1);
- aggregateFunction = (AggregateNode)arg2;
+ AggregateWindowFunctionNode(
+ WindowNode w,
+ AggregateNode agg,
+ ContextManager cm) throws StandardException {
+
+ super(null, "?", w, cm);
+ setNodeType(C_NodeTypes.AGGREGATE_WINDOW_FUNCTION_NODE);
+ aggregateFunction = agg;
throw StandardException.newException(
SQLState.NOT_IMPLEMENTED,
"WINDOW/" + aggregateFunction.getAggregateName());
}
-
/**
* ValueNode override.
* @see ValueNode#bindExpression
*/
+ @Override
ValueNode bindExpression(
FromList fromList, SubqueryList subqueryList, List<AggregateNode> aggregates)
throws StandardException
@@ -75,7 +72,7 @@ public final class AggregateWindowFuncti
*
* @param depth The depth of this node in the tree
*/
-
+ @Override
public void printSubNodes(int depth)
{
if (SanityManager.DEBUG)
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AllResultColumn.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AllResultColumn.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AllResultColumn.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AllResultColumn.java Fri Jun 21 07:47:47 2013
@@ -21,11 +21,10 @@
package org.apache.derby.impl.sql.compile;
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
-
-import org.apache.derby.iapi.services.sanity.SanityManager;
-
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;
/**
* An AllResultColumn represents a "*" result column in a SELECT
@@ -34,26 +33,21 @@ import org.apache.derby.iapi.error.Stand
*
*/
-public class AllResultColumn extends ResultColumn
+class AllResultColumn extends ResultColumn
{
private TableName tableName;
- /**
- * This initializer is for use in the parser for a "*".
- *
- * @param tableName Dot expression qualifying "*"
- */
- public void init(Object tableName)
- {
- this.tableName = (TableName) tableName;
- }
-
+ AllResultColumn(TableName tableName, ContextManager cm) {
+ super(cm);
+ setNodeType(C_NodeTypes.ALL_RESULT_COLUMN);
+ this.tableName = tableName;
+ }
/**
* Return the full table name qualification for this node
*
* @return Full table name qualification as a String
*/
- public String getFullTableName()
+ String getFullTableName()
{
if (tableName == null)
{
@@ -72,6 +66,7 @@ public class AllResultColumn extends Res
*
* @exception StandardException Thrown on error
*/
+ @Override
ResultColumn cloneMe() throws StandardException
{
if (SanityManager.DEBUG)
@@ -80,13 +75,11 @@ public class AllResultColumn extends Res
"columnDescriptor is expected to be non-null");
}
- return (ResultColumn) getNodeFactory().getNode(
- C_NodeTypes.ALL_RESULT_COLUMN,
- tableName,
- getContextManager());
+ return new AllResultColumn(tableName, getContextManager());
}
+ @Override
public TableName getTableNameObject() {
return tableName;
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AlterTableNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AlterTableNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AlterTableNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AlterTableNode.java Fri Jun 21 07:47:47 2013
@@ -21,27 +21,20 @@
package org.apache.derby.impl.sql.compile;
-import org.apache.derby.iapi.reference.SQLState;
+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.io.FormatableBitSet;
import org.apache.derby.iapi.services.sanity.SanityManager;
-
-import org.apache.derby.iapi.error.StandardException;
-
import org.apache.derby.iapi.sql.compile.C_NodeTypes;
-import org.apache.derby.iapi.sql.compile.Visitable;
import org.apache.derby.iapi.sql.compile.Visitor;
-
import org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor;
import org.apache.derby.iapi.sql.dictionary.ConstraintDescriptorList;
import org.apache.derby.iapi.sql.dictionary.DataDictionary;
import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;
import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
-
import org.apache.derby.iapi.sql.execute.ConstantAction;
-import org.apache.derby.iapi.types.StringDataValue;
-
import org.apache.derby.impl.sql.execute.ColumnInfo;
import org.apache.derby.impl.sql.execute.ConstraintConstantAction;
import org.apache.derby.impl.sql.execute.CreateConstraintConstantAction;
@@ -52,11 +45,11 @@ import org.apache.derby.impl.sql.execute
*
*/
-public class AlterTableNode extends DDLStatementNode
+class AlterTableNode extends DDLStatementNode
{
// The alter table action
public TableElementList tableElementList = null;
- public char lockGranularity;
+ char lockGranularity;
/**
* updateStatistics will indicate that we are here for updating the
@@ -113,149 +106,153 @@ public class AlterTableNode extends DDLS
/**
- * Initializer for a TRUNCATE TABLE
+ * Constructor for TRUNCATE TABLE
*
- * @param objectName The name of the table being truncated
- * @exception StandardException Thrown on error
- */
-
- public void init(Object objectName)
- throws StandardException
- {
- initAndCheck(objectName);
- /* For now, this init() only called for truncate table */
+ * @param tableName The name of the table being truncated
+ * @param cm Context manager
+ * @exception StandardException
+ */
+ AlterTableNode(TableName tableName,
+ ContextManager cm) throws StandardException {
+ super(tableName, cm);
truncateTable = true;
schemaDescriptor = getSchemaDescriptor();
+ setNodeType(C_NodeTypes.ALTER_TABLE_NODE);
}
/**
- * Initializer for a AlterTableNode for COMPRESS using temporary tables
- * rather than inplace compress
+ * Constructor for COMPRESS using temporary tables
+ * rather than in place compress
*
- * @param objectName The name of the table being altered
- * @param sequential Whether or not the COMPRESS is SEQUENTIAL
+ * @param tableName The name of the table being altered
+ * @param sequential Whether or not the COMPRESS is SEQUENTIAL
+ * @param cm Context manager
*
* @exception StandardException Thrown on error
*/
-
- public void init(Object objectName,
- Object sequential)
- throws StandardException
- {
- initAndCheck(objectName);
-
- this.sequential = ((Boolean) sequential).booleanValue();
- /* For now, this init() only called for compress table */
+ AlterTableNode(TableName tableName,
+ boolean sequential,
+ ContextManager cm) throws StandardException {
+ super(tableName, cm);
+ this.sequential = sequential;
compressTable = true;
-
schemaDescriptor = getSchemaDescriptor();
+ setNodeType(C_NodeTypes.ALTER_TABLE_NODE);
}
/**
- * Initializer for a AlterTableNode for INPLACE COMPRESS
+ * Constructor for INPLACE COMPRESS
*
- * @param objectName The name of the table being altered
- * @param purge PURGE during INPLACE COMPRESS?
- * @param defragment DEFRAGMENT during INPLACE COMPRESS?
- * @param truncateEndOfTable TRUNCATE END during INPLACE COMPRESS?
+ * @param tableName The name of the table being altered
+ * @param purge PURGE during INPLACE COMPRESS?
+ * @param defragment DEFRAGMENT during INPLACE COMPRESS?
+ * @param truncateEndOfTable TRUNCATE END during INPLACE COMPRESS?
+ * @param cm Context manager
*
* @exception StandardException Thrown on error
*/
-
- public void init(Object objectName,
- Object purge,
- Object defragment,
- Object truncateEndOfTable)
- throws StandardException
- {
- initAndCheck(objectName);
-
- this.purge = ((Boolean) purge).booleanValue();
- this.defragment = ((Boolean) defragment).booleanValue();
- this.truncateEndOfTable = ((Boolean) truncateEndOfTable).booleanValue();
+ AlterTableNode(TableName tableName,
+ boolean purge,
+ boolean defragment,
+ boolean truncateEndOfTable,
+ ContextManager cm) throws StandardException {
+ super(tableName, cm);
+ this.purge = purge;
+ this.defragment = defragment;
+ this.truncateEndOfTable = truncateEndOfTable;
compressTable = true;
schemaDescriptor = getSchemaDescriptor(true, false);
+ setNodeType(C_NodeTypes.ALTER_TABLE_NODE);
}
- /**
- * Initializer for a AlterTableNode. The parameter values have different
- * meanings based on what kind of ALTER TABLE is taking place.
- *
- * @param objectName The name of the table being altered
- * @param changeType ADD_TYPE or DROP_TYPE or UPDATE_STATISTICS or
- * or DROP_STATISTICS
- * @param param1 For ADD_TYPE or DROP_TYPE, param1 gives the
- * elements impacted by ALTER TABLE.
- * For UPDATE_STATISTICS or or DROP_STATISTICS,
- * param1 is boolean - true means update or drop
- * the statistics of all the indexes on the table.
- * False means, update or drop the statistics of
- * only the index name provided by next parameter.
- * @param param2 For ADD_TYPE or DROP_TYPE, param2 gives the
- * new lock granularity, if any
- * For UPDATE_STATISTICS or DROP_STATISTICS,
- * param2 can be the name of the specific index
- * whose statistics will be dropped/updated. This
- * param is used only if param1 is set to false
- * @param param3 For DROP_TYPE, param3 can indicate if the drop
- * column is CASCADE or RESTRICTED. This param is
- * ignored for all the other changeType.
- *
- * @exception StandardException Thrown on error
- */
- public void init(
- Object objectName,
- Object changeType,
- Object param1,
- Object param2,
- Object param3 )
- throws StandardException
- {
- initAndCheck(objectName);
+ /**
+ * Constructor for UPDATE_STATISTICS or DROP_STATISTICS
+ *
+ * @param tableName The name of the table being altered
+ * @param changeType update or drop statistics
+ * @param statsAll {@code true} means update or drop
+ * the statistics of all the indexes on the table.
+ * {@code false} means update or drop the statistics of
+ * only the index name provided by next parameter.
+ * @param indexName Name of the index for which statistics is to be updated
+ * or dropped
+ * @param cm Context manager
+ * @throws StandardException
+ */
+ AlterTableNode(
+ TableName tableName,
+ int changeType,
+ boolean statsAll,
+ String indexName,
+ ContextManager cm) throws StandardException {
+ super(tableName, cm);
+ this.changeType = changeType;
+ this.indexNameForStatistics = indexName;
+
+ switch (changeType) {
+ case UPDATE_STATISTICS:
+ this.updateStatisticsAll = statsAll;
+ updateStatistics = true;
+ break;
+ case DROP_STATISTICS:
+ this.dropStatisticsAll = statsAll;
+ dropStatistics = true;
+ break;
+ default:
+ if (SanityManager.DEBUG) {
+ SanityManager.NOTREACHED();
+ }
+ }
+
+ schemaDescriptor = getSchemaDescriptor();
+ setNodeType(C_NodeTypes.ALTER_TABLE_NODE);
+ }
+
+ /**
+ * Constructor for ADD_TYPE, DROP_TYPE, MODIFY_TYPE and LOCK_TYPE
+ * @param tableName The name of the table being altered
+ * @param changeType add, drop, modify or lock
+ * @param impactedElements list of table elements impacted
+ * @param lockGranularity lock granularity encoded in a single character
+ * @param behavior cascade or restrict (for DROP_TYPE)
+ * @param cm Context Manager
+ * @throws StandardException
+ */
+ AlterTableNode(
+ TableName tableName,
+ int changeType,
+ TableElementList impactedElements,
+ char lockGranularity,
+ int behavior,
+ ContextManager cm) throws StandardException {
+ super(tableName, cm);
+ this.changeType = changeType;
-
- int[] ct = (int[]) changeType;
- this.changeType = ct[0];
-
- switch ( this.changeType )
- {
- case ADD_TYPE:
+ switch (changeType) {
+ case ADD_TYPE:
case DROP_TYPE:
case MODIFY_TYPE:
case LOCKING_TYPE:
- this.tableElementList = (TableElementList) param1;
- this.lockGranularity = ((Character) param2).charValue();
- int[] bh = (int[]) param3;
- this.behavior = bh[0];
- break;
-
- case UPDATE_STATISTICS:
- this.updateStatisticsAll = ((Boolean) param1).booleanValue();
- this.indexNameForStatistics = (String)param2;
- updateStatistics = true;
+ this.tableElementList = impactedElements;
+ this.lockGranularity = lockGranularity;
+ this.behavior = behavior;
break;
-
- case DROP_STATISTICS:
- this.dropStatisticsAll = ((Boolean) param1).booleanValue();
- this.indexNameForStatistics = (String)param2;
- dropStatistics = true;
- break;
-
default:
+ if (SanityManager.DEBUG) {
+ SanityManager.NOTREACHED();
+ }
+ }
+ schemaDescriptor = getSchemaDescriptor();
+ setNodeType(C_NodeTypes.ALTER_TABLE_NODE);
+ }
- throw StandardException.newException(SQLState.NOT_IMPLEMENTED);
- }
-
- schemaDescriptor = getSchemaDescriptor();
- }
-
- /**
+ /**
* 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)
@@ -287,7 +284,8 @@ public class AlterTableNode extends DDLS
* how tree printing is supposed to work.
* @param depth The depth to indent the sub-nodes
*/
- public void printSubNodes(int depth) {
+ @Override
+ void printSubNodes(int depth) {
if (SanityManager.DEBUG) {
if (tableElementList != null) {
printLabel(depth, "tableElementList: ");
@@ -318,6 +316,7 @@ public String statementToString()
*
* @exception StandardException Thrown on error
*/
+ @Override
public void bindStatement() throws StandardException
{
DataDictionary dd = getDataDictionary();
@@ -481,6 +480,7 @@ public String statementToString()
*
* @exception StandardException Thrown on error
*/
+ @Override
public boolean referencesSessionSchema()
throws StandardException
{
@@ -493,7 +493,8 @@ public String statementToString()
*
* @exception StandardException Thrown on failure
*/
- public ConstantAction makeConstantAction() throws StandardException
+ @Override
+ public ConstantAction makeConstantAction() throws StandardException
{
prepConstantAction();
@@ -589,6 +590,7 @@ public String statementToString()
*
* @exception StandardException on error
*/
+ @Override
void acceptChildren(Visitor v)
throws StandardException
{
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AndNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AndNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AndNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AndNode.java Fri Jun 21 07:47:47 2013
@@ -22,29 +22,29 @@
package org.apache.derby.impl.sql.compile;
import java.util.List;
-import org.apache.derby.iapi.services.sanity.SanityManager;
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;
-
-public class AndNode extends BinaryLogicalOperatorNode
+class AndNode extends BinaryLogicalOperatorNode
{
+ /**
+ * @param leftOperand The left operand of the AND
+ * @param rightOperand The right operand of the AND
+ * @param cm context manager
+ * @throws StandardException
+ */
+ AndNode(
+ ValueNode leftOperand,
+ ValueNode rightOperand,
+ ContextManager cm) throws StandardException {
+ super(leftOperand, rightOperand, "and", cm);
+ setNodeType(C_NodeTypes.AND_NODE);
+ this.shortCircuitValue = false;
+ }
- /**
- * Initializer for an AndNode
- *
- * @param leftOperand The left operand of the AND
- * @param rightOperand The right operand of the AND
- */
-
- public void init(Object leftOperand, Object rightOperand)
- {
- super.init(leftOperand, rightOperand, "and");
- this.shortCircuitValue = false;
- }
-
- /**
+ /**
* Bind this logical operator. All that has to be done for binding
* a logical operator is to bind the operands, check that both operands
* are BooleanDataValue, and set the result type to BooleanDataValue.
@@ -57,7 +57,7 @@ public class AndNode extends BinaryLogic
*
* @exception StandardException Thrown on error
*/
-
+ @Override
ValueNode bindExpression(
FromList fromList, SubqueryList subqueryList, List<AggregateNode> aggregates)
throws StandardException
@@ -84,7 +84,8 @@ public class AndNode extends BinaryLogic
*
* @exception StandardException Thrown on error
*/
- public ValueNode preprocess(int numTables,
+ @Override
+ ValueNode preprocess(int numTables,
FromList outerFromList,
SubqueryList outerSubqueryList,
PredicateList outerPredicateList)
@@ -131,6 +132,7 @@ public class AndNode extends BinaryLogic
*
* @exception StandardException Thrown on error
*/
+ @Override
ValueNode eliminateNots(boolean underNotNode)
throws StandardException
{
@@ -144,11 +146,7 @@ public class AndNode extends BinaryLogic
/* Convert the AndNode to an OrNode */
ValueNode orNode;
- orNode = (ValueNode) getNodeFactory().getNode(
- C_NodeTypes.OR_NODE,
- leftOperand,
- rightOperand,
- getContextManager());
+ orNode = new OrNode(leftOperand, rightOperand, getContextManager());
orNode.setType(getTypeServices());
return orNode;
}
@@ -162,7 +160,8 @@ public class AndNode extends BinaryLogic
*
* @exception StandardException Thrown on error
*/
- public ValueNode putAndsOnTop()
+ @Override
+ ValueNode putAndsOnTop()
throws StandardException
{
if (SanityManager.DEBUG)
@@ -179,7 +178,8 @@ public class AndNode extends BinaryLogic
*
* @return Boolean which reflects validity of the tree.
*/
- public boolean verifyPutAndsOnTop()
+ @Override
+ boolean verifyPutAndsOnTop()
{
boolean isValid = true;
@@ -225,7 +225,8 @@ public class AndNode extends BinaryLogic
*
* @exception StandardException Thrown on error
*/
- public ValueNode changeToCNF(boolean underTopAndNode)
+ @Override
+ ValueNode changeToCNF(boolean underTopAndNode)
throws StandardException
{
AndNode curAnd = this;
@@ -240,19 +241,12 @@ public class AndNode extends BinaryLogic
if (!(rightOperand instanceof AndNode) &&
!(rightOperand.isBooleanTrue()))
{
- BooleanConstantNode trueNode;
-
- trueNode = (BooleanConstantNode) getNodeFactory().getNode(
- C_NodeTypes.BOOLEAN_CONSTANT_NODE,
- Boolean.TRUE,
- getContextManager());
- curAnd.setRightOperand(
- (ValueNode) getNodeFactory().getNode(
- C_NodeTypes.AND_NODE,
- curAnd.getRightOperand(),
- trueNode,
- getContextManager()));
- ((AndNode) curAnd.getRightOperand()).postBindFixup();
+ BooleanConstantNode trueNode =
+ new BooleanConstantNode(true, getContextManager());
+ AndNode newRightOperand = new AndNode(
+ curAnd.getRightOperand(), trueNode, getContextManager());
+ curAnd.setRightOperand(newRightOperand);
+ newRightOperand.postBindFixup();
}
/* If leftOperand is an AndNode, then we modify the tree from:
@@ -312,7 +306,8 @@ public class AndNode extends BinaryLogic
*
* @return Boolean which reflects validity of the tree.
*/
- public boolean verifyChangeToCNF()
+ @Override
+ boolean verifyChangeToCNF()
{
boolean isValid = true;
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseColumnNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseColumnNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseColumnNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseColumnNode.java Fri Jun 21 07:47:47 2013
@@ -21,20 +21,13 @@
package org.apache.derby.impl.sql.compile;
-import org.apache.derby.iapi.sql.dictionary.DataDictionary;
-
import org.apache.derby.iapi.error.StandardException;
import org.apache.derby.iapi.reference.SQLState;
-
-import org.apache.derby.iapi.types.DataTypeDescriptor;
-import org.apache.derby.iapi.sql.Row;
-
-import org.apache.derby.iapi.store.access.Qualifier;
-
-import org.apache.derby.impl.sql.compile.ExpressionClassBuilder;
-
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.store.access.Qualifier;
+import org.apache.derby.iapi.types.DataTypeDescriptor;
/**
* A BaseColumnNode represents a column in a base table. The parser generates a
@@ -46,7 +39,7 @@ import org.apache.derby.iapi.services.sa
*
*/
-public class BaseColumnNode extends ValueNode
+class BaseColumnNode extends ValueNode
{
private String columnName;
@@ -56,23 +49,24 @@ public class BaseColumnNode extends Valu
*/
private TableName tableName;
- /**
- * Initializer for when you only have the column name.
- *
- * @param columnName The name of the column being referenced
- * @param tableName The qualification for the column
- * @param dts DataTypeServices for the column
- */
-
- public void init(
- Object columnName,
- Object tableName,
- Object dts) throws StandardException
- {
- this.columnName = (String) columnName;
- this.tableName = (TableName) tableName;
- setType((DataTypeDescriptor) dts);
- }
+ /**
+ * Constructor for a referenced column name
+ * @param columnName The name of the column being referenced
+ * @param tableName The qualification for the column
+ * @param dtd Data type descriptor for the column
+ * @param cm Context manager
+ * @throws StandardException
+ */
+ BaseColumnNode(
+ String columnName,
+ TableName tableName,
+ DataTypeDescriptor dtd,
+ ContextManager cm) throws StandardException {
+ super(cm);
+ this.columnName = columnName;
+ this.tableName = tableName;
+ setType(dtd);
+ }
/**
* Convert this object to a String. See comments in QueryTreeNode.java
@@ -80,7 +74,7 @@ public class BaseColumnNode extends Valu
*
* @return This object as a String
*/
-
+ @Override
public String toString()
{
if (SanityManager.DEBUG)
@@ -103,8 +97,8 @@ public class BaseColumnNode extends Valu
*
* @return The name of this column
*/
-
- public String getColumnName()
+ @Override
+ String getColumnName()
{
return columnName;
}
@@ -118,8 +112,8 @@ public class BaseColumnNode extends Valu
* @return The user-supplied name of this column. Null if no user-
* supplied name.
*/
-
- public String getTableName()
+ @Override
+ String getTableName()
{
return ( ( tableName != null) ? tableName.getTableName() : null );
}
@@ -132,7 +126,8 @@ public class BaseColumnNode extends Valu
*
* @return The schema name for this column's table
*/
- public String getSchemaName() throws StandardException
+ @Override
+ String getSchemaName() throws StandardException
{
return ( ( tableName != null) ? tableName.getSchemaName() : null );
}
@@ -146,7 +141,7 @@ public class BaseColumnNode extends Valu
*
* @exception StandardException Thrown on error
*/
-
+ @Override
void generateExpression(ExpressionClassBuilder acb, MethodBuilder mb)
throws StandardException
{
@@ -166,6 +161,7 @@ public class BaseColumnNode extends Valu
*
* @return The variant type for the underlying expression.
*/
+ @Override
protected int getOrderableVariantType()
{
return Qualifier.SCAN_INVARIANT;
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseJoinStrategy.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseJoinStrategy.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseJoinStrategy.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseJoinStrategy.java Fri Jun 21 07:47:47 2013
@@ -21,33 +21,19 @@
package org.apache.derby.impl.sql.compile;
-import org.apache.derby.iapi.services.loader.GeneratedMethod;
-
+import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.reference.ClassName;
import org.apache.derby.iapi.services.compiler.MethodBuilder;
-
import org.apache.derby.iapi.sql.compile.ExpressionClassBuilderInterface;
import org.apache.derby.iapi.sql.compile.JoinStrategy;
import org.apache.derby.iapi.sql.compile.Optimizable;
import org.apache.derby.iapi.sql.compile.OptimizablePredicateList;
-
-import org.apache.derby.iapi.sql.Activation;
-
import org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor;
import org.apache.derby.iapi.sql.dictionary.ConstraintDescriptor;
import org.apache.derby.iapi.sql.dictionary.DataDictionary;
import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
-
-import org.apache.derby.iapi.store.access.Qualifier;
import org.apache.derby.iapi.store.access.StaticCompiledOpenConglomInfo;
import org.apache.derby.iapi.store.access.TransactionController;
-
-import org.apache.derby.impl.sql.compile.ExpressionClassBuilder;
-
-import org.apache.derby.iapi.error.StandardException;
-
-import org.apache.derby.iapi.services.sanity.SanityManager;
-import org.apache.derby.iapi.reference.ClassName;
-
import org.apache.derby.iapi.util.PropertyUtil;
abstract class BaseJoinStrategy implements JoinStrategy {
@@ -214,7 +200,7 @@ abstract class BaseJoinStrategy implemen
* outermost table of a join.
*
* @return Whether or not this join strategy
- * can be used on the outermose table of a join.
+ * can be used on the outermost table of a join.
*/
protected boolean validForOutermostTable()
{
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseTableNumbersVisitor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseTableNumbersVisitor.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseTableNumbersVisitor.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseTableNumbersVisitor.java Fri Jun 21 07:47:47 2013
@@ -21,13 +21,11 @@
package org.apache.derby.impl.sql.compile;
+import org.apache.derby.iapi.error.StandardException;
import org.apache.derby.iapi.sql.compile.Visitable;
import org.apache.derby.iapi.sql.compile.Visitor;
import org.apache.derby.iapi.util.JBitSet;
-import org.apache.derby.iapi.error.StandardException;
-import org.apache.derby.iapi.services.sanity.SanityManager;
-
/**
* Walk through a subtree and build a list of the assigned numbers for
* all tables that exist in that subtree. We do this by looking for any
@@ -36,7 +34,7 @@ import org.apache.derby.iapi.services.sa
* the bottom-most table number, which should correspond to a base
* table.
*/
-public class BaseTableNumbersVisitor implements Visitor
+class BaseTableNumbersVisitor implements Visitor
{
// JBitSet to hold the table numbers that we find.
private JBitSet tableMap;
@@ -56,7 +54,7 @@ public class BaseTableNumbersVisitor imp
*
* @param tableMap JBitSet into which we put the table numbers we find.
*/
- public BaseTableNumbersVisitor(JBitSet tableMap)
+ BaseTableNumbersVisitor(JBitSet tableMap)
{
this.tableMap = tableMap;
columnNumber = -1;
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseTypeCompiler.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseTypeCompiler.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseTypeCompiler.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseTypeCompiler.java Fri Jun 21 07:47:47 2013
@@ -260,7 +260,7 @@ abstract class BaseTypeCompiler implemen
* @param forDataTypeFunction was this called from a scalarFunction like
* CHAR() or DOUBLE()
*/
- public boolean numberConvertible(TypeId otherType,
+ boolean numberConvertible(TypeId otherType,
boolean forDataTypeFunction)
{
if ( otherType.getBaseTypeId().isAnsiUDT() ) { return false; }
@@ -298,7 +298,7 @@ abstract class BaseTypeCompiler implemen
* @param cf A ClassFactory
*/
- public boolean numberStorable(TypeId thisType,
+ boolean numberStorable(TypeId thisType,
TypeId otherType,
ClassFactory cf)
{
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BetweenOperatorNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BetweenOperatorNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BetweenOperatorNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BetweenOperatorNode.java Fri Jun 21 07:47:47 2013
@@ -22,21 +22,10 @@
package org.apache.derby.impl.sql.compile;
import org.apache.derby.iapi.error.StandardException;
-
-import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
-
-import org.apache.derby.iapi.sql.dictionary.DataDictionary;
-
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
-
import org.apache.derby.iapi.services.compiler.MethodBuilder;
-
-import org.apache.derby.iapi.services.sanity.SanityManager;
-
-import org.apache.derby.impl.sql.compile.ExpressionClassBuilder;
-import org.apache.derby.impl.sql.compile.ActivationClassBuilder;
-import org.apache.derby.iapi.sql.compile.NodeFactory;
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 BetweenOperatorNode represents a BETWEEN clause. The between values are
@@ -44,31 +33,35 @@ import org.apache.derby.iapi.services.co
*
*/
-public class BetweenOperatorNode extends BinaryListOperatorNode
+class BetweenOperatorNode extends BinaryListOperatorNode
{
- /**
- * Initializer for a BetweenOperatorNode
- *
- * @param leftOperand The left operand of the node
- * @param betweenValues The between values in list form
- */
+ /**
+ * @param leftOperand The left operand of the node
+ * @param betweenValues The between values in list form
+ * @param cm
+ * @throws StandardException
+ */
+ BetweenOperatorNode(ValueNode leftOperand,
+ ValueNodeList betweenValues,
+ ContextManager cm) throws StandardException {
+ super(leftOperand, vetValues(betweenValues), "BETWEEN", null, cm);
+ setNodeType(C_NodeTypes.BETWEEN_OPERATOR_NODE);
+ }
- public void init(Object leftOperand, Object betweenValues)
- {
- if (SanityManager.DEBUG)
+ private static ValueNodeList vetValues(ValueNodeList betweenValues) {
+ if (SanityManager.DEBUG)
{
- ValueNodeList betweenVals = (ValueNodeList) betweenValues;
+ ValueNodeList betweenVals = betweenValues;
SanityManager.ASSERT(betweenVals.size() == 2,
"betweenValues.size() (" +
betweenVals.size() +
") is expected to be 2");
}
+ return betweenValues;
+ }
- super.init(leftOperand, betweenValues, "BETWEEN", null);
- }
-
- /**
+ /**
* Eliminate NotNodes in the current query block. We traverse the tree,
* inverting ANDs and ORs and eliminating NOTs as we go. We stop at
* ComparisonOperators and boolean expressions. We invert
@@ -84,6 +77,7 @@ public class BetweenOperatorNode extends
*
* @exception StandardException Thrown on error
*/
+ @Override
ValueNode eliminateNots(boolean underNotNode)
throws StandardException
{
@@ -114,16 +108,14 @@ public class BetweenOperatorNode extends
* optimizable and there's no benefit for the optimizer to see NOT BETWEEN
*/
- NodeFactory nodeFactory = getNodeFactory();
ContextManager cm = getContextManager();
/* leftO < rightOList.elementAt(0) */
- leftBCO = (BinaryComparisonOperatorNode)
- nodeFactory.getNode(
+ leftBCO = new BinaryRelationalOperatorNode(
C_NodeTypes.BINARY_LESS_THAN_OPERATOR_NODE,
leftOperand,
- rightOperandList.elementAt(0),
- Boolean.FALSE,
+ (ValueNode)rightOperandList.elementAt(0),
+ false,
cm);
/* Set type info for the operator node */
leftBCO.bindComparisonOperator();
@@ -135,22 +127,17 @@ public class BetweenOperatorNode extends
leftOperand.getClone() : leftOperand;
/* leftO > rightOList.elementAt(1) */
- rightBCO = (BinaryComparisonOperatorNode)
- nodeFactory.getNode(
+ rightBCO = new BinaryRelationalOperatorNode(
C_NodeTypes.BINARY_GREATER_THAN_OPERATOR_NODE,
leftClone,
- rightOperandList.elementAt(1),
- Boolean.FALSE,
+ (ValueNode)rightOperandList.elementAt(1),
+ false,
cm);
/* Set type info for the operator node */
rightBCO.bindComparisonOperator();
/* Create and return the OR */
- newOr = (OrNode) nodeFactory.getNode(
- C_NodeTypes.OR_NODE,
- leftBCO,
- rightBCO,
- cm);
+ newOr = new OrNode(leftBCO, rightBCO, cm);
newOr.postBindFixup();
/* Tell optimizer to use the between selectivity instead of >= * <= selectivities */
@@ -175,7 +162,8 @@ public class BetweenOperatorNode extends
*
* @exception StandardException Thrown on error
*/
- public ValueNode preprocess(int numTables,
+ @Override
+ ValueNode preprocess(int numTables,
FromList outerFromList,
SubqueryList outerSubqueryList,
PredicateList outerPredicateList)
@@ -212,52 +200,40 @@ public class BetweenOperatorNode extends
* <= TRUE
*/
- NodeFactory nodeFactory = getNodeFactory();
ContextManager cm = getContextManager();
- QueryTreeNode trueNode = (QueryTreeNode) nodeFactory.getNode(
- C_NodeTypes.BOOLEAN_CONSTANT_NODE,
- Boolean.TRUE,
- cm);
+ BooleanConstantNode trueNode = new BooleanConstantNode(true, cm);
/* Create the AND <= */
BinaryComparisonOperatorNode lessEqual =
- (BinaryComparisonOperatorNode) nodeFactory.getNode(
+ new BinaryRelationalOperatorNode(
C_NodeTypes.BINARY_LESS_EQUALS_OPERATOR_NODE,
leftClone1,
- rightOperandList.elementAt(1),
- Boolean.FALSE,
+ (ValueNode)rightOperandList.elementAt(1),
+ false,
cm);
/* Set type info for the operator node */
lessEqual.bindComparisonOperator();
/* Create the AND */
- AndNode newAnd = (AndNode) nodeFactory.getNode(
- C_NodeTypes.AND_NODE,
- lessEqual,
- trueNode,
- cm);
+ AndNode newAnd = new AndNode(lessEqual, trueNode, cm);
newAnd.postBindFixup();
/* Create the AND >= */
BinaryComparisonOperatorNode greaterEqual =
- (BinaryComparisonOperatorNode) nodeFactory.getNode(
+ new BinaryRelationalOperatorNode(
C_NodeTypes.BINARY_GREATER_EQUALS_OPERATOR_NODE,
leftOperand,
- rightOperandList.elementAt(0),
- Boolean.FALSE,
+ (ValueNode)rightOperandList.elementAt(0),
+ false,
cm);
/* Set type info for the operator node */
greaterEqual.bindComparisonOperator();
/* Create the AND */
- newAnd = (AndNode) nodeFactory.getNode(
- C_NodeTypes.AND_NODE,
- greaterEqual,
- newAnd,
- cm);
+ newAnd = new AndNode(greaterEqual, newAnd, cm);
newAnd.postBindFixup();
/* Tell optimizer to use the between selectivity instead of >= * <= selectivities */
@@ -276,7 +252,7 @@ public class BetweenOperatorNode extends
*
* @exception StandardException Thrown on error
*/
-
+ @Override
void generateExpression(ExpressionClassBuilder acb, MethodBuilder mb)
throws StandardException
{
@@ -296,37 +272,30 @@ public class BetweenOperatorNode extends
* leftO >= rightOList.elementAt(0) and leftO <= rightOList.elementAt(1)
*/
- NodeFactory nodeFactory = getNodeFactory();
ContextManager cm = getContextManager();
/* leftO >= rightOList.elementAt(0) */
- leftBCO = (BinaryComparisonOperatorNode)
- nodeFactory.getNode(
+ leftBCO = new BinaryRelationalOperatorNode(
C_NodeTypes.BINARY_GREATER_EQUALS_OPERATOR_NODE,
leftOperand,
- rightOperandList.elementAt(0),
- Boolean.FALSE,
+ (ValueNode)rightOperandList.elementAt(0),
+ false,
cm);
/* Set type info for the operator node */
leftBCO.bindComparisonOperator();
/* leftO <= rightOList.elementAt(1) */
- rightBCO = (BinaryComparisonOperatorNode)
- nodeFactory.getNode(
+ rightBCO = new BinaryRelationalOperatorNode(
C_NodeTypes.BINARY_LESS_EQUALS_OPERATOR_NODE,
leftOperand,
- rightOperandList.elementAt(1),
- Boolean.FALSE,
+ (ValueNode)rightOperandList.elementAt(1),
+ false,
cm);
/* Set type info for the operator node */
rightBCO.bindComparisonOperator();
/* Create and return the AND */
- newAnd = (AndNode) nodeFactory.getNode(
- C_NodeTypes.AND_NODE,
- leftBCO,
- rightBCO,
- cm);
+ newAnd = new AndNode(leftBCO, rightBCO, cm);
newAnd.postBindFixup();
newAnd.generateExpression(acb, mb);
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryArithmeticOperatorNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryArithmeticOperatorNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryArithmeticOperatorNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryArithmeticOperatorNode.java Fri Jun 21 07:47:47 2013
@@ -22,21 +22,14 @@
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.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.TypeId;
-
-import org.apache.derby.iapi.types.DataTypeDescriptor;
-
import org.apache.derby.iapi.sql.compile.TypeCompiler;
-
-import org.apache.derby.iapi.error.StandardException;
-
-import org.apache.derby.iapi.reference.ClassName;
-
+import org.apache.derby.iapi.types.DataTypeDescriptor;
+import org.apache.derby.iapi.types.TypeId;
/**
* This node represents a binary arithmetic operator, like + or *.
@@ -46,50 +39,58 @@ import org.apache.derby.iapi.reference.C
public final class BinaryArithmeticOperatorNode extends BinaryOperatorNode
{
/**
- * Initializer for a BinaryArithmeticOperatorNode
+ * Constructor for a BinaryArithmeticOperatorNode
*
* @param leftOperand The left operand
* @param rightOperand The right operand
+ * @param cm The context manager
*/
- public void init(
- Object leftOperand,
- Object rightOperand)
+ BinaryArithmeticOperatorNode(
+ int nodeType,
+ ValueNode leftOperand,
+ ValueNode rightOperand,
+ ContextManager cm)
{
- super.init(leftOperand, rightOperand,
- ClassName.NumberDataValue, ClassName.NumberDataValue);
+ super(leftOperand,
+ rightOperand,
+ ClassName.NumberDataValue,
+ ClassName.NumberDataValue,
+ cm);
+ setNodeType(nodeType);
}
- public void setNodeType(int nodeType)
+ @Override
+ void setNodeType(int nodeType)
{
- String operator = null;
- String methodName = null;
+ String op = null;
+ String mNam = null;
switch (nodeType)
{
case C_NodeTypes.BINARY_DIVIDE_OPERATOR_NODE:
- operator = TypeCompiler.DIVIDE_OP;
- methodName = "divide";
+ op = TypeCompiler.DIVIDE_OP;
+ mNam = "divide";
break;
case C_NodeTypes.BINARY_MINUS_OPERATOR_NODE:
- operator = TypeCompiler.MINUS_OP;
- methodName = "minus";
+ op = TypeCompiler.MINUS_OP;
+ mNam = "minus";
break;
case C_NodeTypes.BINARY_PLUS_OPERATOR_NODE:
- operator = TypeCompiler.PLUS_OP;
- methodName = "plus";
+ op = TypeCompiler.PLUS_OP;
+ mNam = "plus";
break;
case C_NodeTypes.BINARY_TIMES_OPERATOR_NODE:
- operator = TypeCompiler.TIMES_OP;
- methodName = "times";
+ op = TypeCompiler.TIMES_OP;
+ mNam = "times";
break;
case C_NodeTypes.MOD_OPERATOR_NODE:
- operator = TypeCompiler.MOD_OP;
- methodName = "mod";
+ op = TypeCompiler.MOD_OP;
+ mNam = "mod";
break;
default:
@@ -99,8 +100,8 @@ public final class BinaryArithmeticOpera
"Unexpected nodeType = " + nodeType);
}
}
- setOperator(operator);
- setMethodName(methodName);
+ setOperator(op);
+ setMethodName(mNam);
super.setNodeType(nodeType);
}
@@ -115,7 +116,7 @@ public final class BinaryArithmeticOpera
*
* @exception StandardException Thrown on error
*/
-
+ @Override
ValueNode bindExpression(
FromList fromList, SubqueryList subqueryList, List<AggregateNode> aggregates)
throws StandardException
@@ -149,9 +150,7 @@ public final class BinaryArithmeticOpera
maxWidth = precision + 3;
}
- leftOperand = (ValueNode)
- getNodeFactory().getNode(
- C_NodeTypes.CAST_NODE,
+ leftOperand = new CastNode(
leftOperand,
new DataTypeDescriptor(rightType, precision,
scale, nullableResult,
@@ -180,9 +179,7 @@ public final class BinaryArithmeticOpera
maxWidth = precision + 3;
}
- rightOperand = (ValueNode)
- getNodeFactory().getNode(
- C_NodeTypes.CAST_NODE,
+ rightOperand = new CastNode(
rightOperand,
new DataTypeDescriptor(leftType, precision,
scale, nullableResult,
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryComparisonOperatorNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryComparisonOperatorNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryComparisonOperatorNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryComparisonOperatorNode.java Fri Jun 21 07:47:47 2013
@@ -22,16 +22,12 @@
package org.apache.derby.impl.sql.compile;
import java.util.List;
-import org.apache.derby.iapi.sql.compile.C_NodeTypes;
-
-import org.apache.derby.iapi.sql.compile.TypeCompiler;
-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 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.types.DataTypeDescriptor;
+import org.apache.derby.iapi.types.TypeId;
/**
* This node is the superclass for all binary comparison operators, such as =,
@@ -46,7 +42,7 @@ public abstract class BinaryComparisonOp
private boolean betweenSelectivity;
/**
- * Initializer for a BinaryComparisonOperatorNode
+ * Constructor for a BinaryComparisonOperatorNode
*
* @param leftOperand The left operand of the comparison
* @param rightOperand The right operand of the comparison
@@ -65,18 +61,25 @@ public abstract class BinaryComparisonOp
* originalNode.getForQueryRewrite(). Examples of
* this can be found in Predicate.Java and
* PredicateList.java
+ * @param cm The context manager
*/
- public void init(
- Object leftOperand,
- Object rightOperand,
- Object operator,
- Object methodName,
- Object forQueryRewrite)
- {
- this.forQueryRewrite = ((Boolean)forQueryRewrite).booleanValue();
- super.init(leftOperand, rightOperand, operator, methodName,
- ClassName.DataValueDescriptor, ClassName.DataValueDescriptor);
+ BinaryComparisonOperatorNode(
+ ValueNode leftOperand,
+ ValueNode rightOperand,
+ String operator,
+ String methodName,
+ boolean forQueryRewrite,
+ ContextManager cm) throws StandardException
+ {
+ super(leftOperand,
+ rightOperand,
+ operator,
+ methodName,
+ ClassName.DataValueDescriptor,
+ ClassName.DataValueDescriptor,
+ cm);
+ this.forQueryRewrite = forQueryRewrite;
}
/**
@@ -84,7 +87,7 @@ public abstract class BinaryComparisonOp
* normal comparability checks.
* @param val true if this was for a query rewrite
*/
- public void setForQueryRewrite(boolean val)
+ void setForQueryRewrite(boolean val)
{
forQueryRewrite=val;
}
@@ -94,7 +97,7 @@ public abstract class BinaryComparisonOp
*
* @return true if it was generated in a query rewrite.
*/
- public boolean getForQueryRewrite()
+ boolean getForQueryRewrite()
{
return forQueryRewrite;
}
@@ -131,15 +134,13 @@ public abstract class BinaryComparisonOp
*
* @exception StandardException Thrown on error
*/
-
+ @Override
ValueNode bindExpression(
FromList fromList, SubqueryList subqueryList, List<AggregateNode> aggregates)
throws StandardException
{
super.bindExpression(fromList, subqueryList, aggregates);
- TypeCompiler leftTC = leftOperand.getTypeCompiler();
- TypeCompiler rightTC = rightOperand.getTypeCompiler();
TypeId leftTypeId = leftOperand.getTypeId();
TypeId rightTypeId = rightOperand.getTypeId();
@@ -157,9 +158,7 @@ public abstract class BinaryComparisonOp
{
DataTypeDescriptor rightTypeServices = rightOperand.getTypeServices();
- rightOperand = (ValueNode)
- getNodeFactory().getNode(
- C_NodeTypes.CAST_NODE,
+ rightOperand = new CastNode(
rightOperand,
new DataTypeDescriptor(
rightTypeId,
@@ -172,9 +171,7 @@ public abstract class BinaryComparisonOp
{
DataTypeDescriptor leftTypeServices = leftOperand.getTypeServices();
- leftOperand = (ValueNode)
- getNodeFactory().getNode(
- C_NodeTypes.CAST_NODE,
+ leftOperand = new CastNode(
leftOperand,
new DataTypeDescriptor(
leftTypeId,
@@ -198,17 +195,11 @@ public abstract class BinaryComparisonOp
*
* @exception StandardException Thrown on error
*/
- public void bindComparisonOperator()
+ void bindComparisonOperator()
throws StandardException
{
- TypeId leftType;
- TypeId rightType;
boolean nullableResult;
- leftType = leftOperand.getTypeId();
- rightType = rightOperand.getTypeId();
-
-
/*
** Can the types be compared to each other? If not, throw an
** exception.
@@ -258,7 +249,8 @@ public abstract class BinaryComparisonOp
*
* @exception StandardException Thrown on error
*/
- public ValueNode preprocess(int numTables,
+ @Override
+ ValueNode preprocess(int numTables,
FromList outerFromList,
SubqueryList outerSubqueryList,
PredicateList outerPredicateList)
@@ -318,6 +310,7 @@ public abstract class BinaryComparisonOp
*
* @exception StandardException Thrown on error
*/
+ @Override
ValueNode eliminateNots(boolean underNotNode)
throws StandardException
{
@@ -391,7 +384,8 @@ public abstract class BinaryComparisonOp
*
* @exception StandardException Thrown on error
*/
- public ValueNode changeToCNF(boolean underTopAndNode)
+ @Override
+ ValueNode changeToCNF(boolean underTopAndNode)
throws StandardException
{
/* If our right child is a subquery and we are under a top and node
@@ -407,7 +401,8 @@ public abstract class BinaryComparisonOp
}
/** @see BinaryOperatorNode#genSQLJavaSQLTree */
- public ValueNode genSQLJavaSQLTree() throws StandardException
+ @Override
+ ValueNode genSQLJavaSQLTree() throws StandardException
{
TypeId leftTypeId = leftOperand.getTypeId();
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryListOperatorNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryListOperatorNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryListOperatorNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryListOperatorNode.java Fri Jun 21 07:47:47 2013
@@ -23,18 +23,14 @@ package org.apache.derby.impl.sql.compil
import java.util.List;
import org.apache.derby.iapi.error.StandardException;
-
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.Visitor;
import org.apache.derby.iapi.types.DataTypeDescriptor;
import org.apache.derby.iapi.types.TypeId;
-import org.apache.derby.iapi.sql.compile.Visitor;
-
-import org.apache.derby.iapi.services.sanity.SanityManager;
-
import org.apache.derby.iapi.util.JBitSet;
-
/**
* A BinaryListOperatorNode represents a built-in "binary" operator with a single
* operand on the left of the operator and a list of operands on the right.
@@ -48,29 +44,21 @@ public abstract class BinaryListOperator
/* operator used for error messages */
String operator;
- String leftInterfaceType;
- String rightInterfaceType;
-
- ValueNode receiver; // used in generation
ValueNode leftOperand;
ValueNodeList rightOperandList;
- /**
- * Initializer for a BinaryListOperatorNode
- *
- * @param leftOperand The left operand of the node
- * @param rightOperandList The right operand list of the node
- * @param operator String representation of operator
- */
-
- public void init(Object leftOperand, Object rightOperandList,
- Object operator, Object methodName)
- {
- this.leftOperand = (ValueNode) leftOperand;
- this.rightOperandList = (ValueNodeList) rightOperandList;
- this.operator = (String) operator;
- this.methodName = (String) methodName;
- }
+ BinaryListOperatorNode(
+ ValueNode leftOperand,
+ ValueNodeList rightOperandList,
+ String operator,
+ String methodName,
+ ContextManager cm) throws SecurityException {
+ super(cm);
+ this.leftOperand = leftOperand;
+ this.rightOperandList = rightOperandList;
+ this.operator = operator;
+ this.methodName = methodName;
+ }
/**
* Convert this object to a String. See comments in QueryTreeNode.java
@@ -78,7 +66,7 @@ public abstract class BinaryListOperator
*
* @return This object as a String
*/
-
+ @Override
public String toString()
{
if (SanityManager.DEBUG)
@@ -99,8 +87,8 @@ public abstract class BinaryListOperator
*
* @param depth The depth of this node in the tree
*/
-
- public void printSubNodes(int depth)
+ @Override
+ void printSubNodes(int depth)
{
if (SanityManager.DEBUG)
{
@@ -133,7 +121,7 @@ public abstract class BinaryListOperator
*
* @exception StandardException Thrown on error
*/
-
+ @Override
ValueNode bindExpression(
FromList fromList, SubqueryList subqueryList, List<AggregateNode> aggregates)
throws StandardException
@@ -190,7 +178,7 @@ public abstract class BinaryListOperator
*
* @exception StandardException Thrown on error
*/
- public void bindComparisonOperator()
+ void bindComparisonOperator()
throws StandardException
{
boolean nullableResult;
@@ -226,7 +214,8 @@ public abstract class BinaryListOperator
*
* @exception StandardException Thrown on error
*/
- public ValueNode preprocess(int numTables,
+ @Override
+ ValueNode preprocess(int numTables,
FromList outerFromList,
SubqueryList outerSubqueryList,
PredicateList outerPredicateList)
@@ -246,7 +235,7 @@ public abstract class BinaryListOperator
*
* @param newLeftOperand The new leftOperand
*/
- public void setLeftOperand(ValueNode newLeftOperand)
+ void setLeftOperand(ValueNode newLeftOperand)
{
leftOperand = newLeftOperand;
}
@@ -256,7 +245,7 @@ public abstract class BinaryListOperator
*
* @return The current leftOperand.
*/
- public ValueNode getLeftOperand()
+ ValueNode getLeftOperand()
{
return leftOperand;
}
@@ -267,7 +256,7 @@ public abstract class BinaryListOperator
* @param newRightOperandList The new rightOperandList
*
*/
- public void setRightOperandList(ValueNodeList newRightOperandList)
+ void setRightOperandList(ValueNodeList newRightOperandList)
{
rightOperandList = newRightOperandList;
}
@@ -277,7 +266,7 @@ public abstract class BinaryListOperator
*
* @return The current rightOperandList.
*/
- public ValueNodeList getRightOperandList()
+ ValueNodeList getRightOperandList()
{
return rightOperandList;
}
@@ -307,7 +296,8 @@ public abstract class BinaryListOperator
* or a VirtualColumnNode.
* @exception StandardException Thrown on error
*/
- public boolean categorize(JBitSet referencedTabs, boolean simplePredsOnly)
+ @Override
+ boolean categorize(JBitSet referencedTabs, boolean simplePredsOnly)
throws StandardException
{
boolean pushable;
@@ -324,7 +314,8 @@ public abstract class BinaryListOperator
*
* @exception StandardException Thrown on error
*/
- public ValueNode remapColumnReferencesToExpressions()
+ @Override
+ ValueNode remapColumnReferencesToExpressions()
throws StandardException
{
// we need to assign back because a new object may be returned, beetle 4983
@@ -338,14 +329,16 @@ public abstract class BinaryListOperator
*
* @return Whether or not this expression tree represents a constant expression.
*/
- public boolean isConstantExpression()
+ @Override
+ boolean isConstantExpression()
{
return (leftOperand.isConstantExpression() &&
rightOperandList.isConstantExpression());
}
/** @see ValueNode#constantExpression */
- public boolean constantExpression(PredicateList whereClause)
+ @Override
+ boolean constantExpression(PredicateList whereClause)
{
return (leftOperand.constantExpression(whereClause) &&
rightOperandList.constantExpression(whereClause));
@@ -364,6 +357,7 @@ public abstract class BinaryListOperator
* @return The variant type for the underlying expression.
* @exception StandardException thrown on error
*/
+ @Override
protected int getOrderableVariantType() throws StandardException
{
int leftType = leftOperand.getOrderableVariantType();
@@ -379,6 +373,7 @@ public abstract class BinaryListOperator
*
* @exception StandardException on error
*/
+ @Override
void acceptChildren(Visitor v)
throws StandardException
{
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryLogicalOperatorNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryLogicalOperatorNode.java?rev=1495305&r1=1495304&r2=1495305&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryLogicalOperatorNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryLogicalOperatorNode.java Fri Jun 21 07:47:47 2013
@@ -22,41 +22,27 @@
package org.apache.derby.impl.sql.compile;
import java.util.List;
-
import org.apache.derby.iapi.error.StandardException;
-import org.apache.derby.iapi.services.compiler.MethodBuilder;
-
-import org.apache.derby.iapi.services.sanity.SanityManager;
import org.apache.derby.iapi.reference.ClassName;
import org.apache.derby.iapi.reference.SQLState;
-import org.apache.derby.iapi.types.DataTypeDescriptor;
-
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.types.DataTypeDescriptor;
abstract class BinaryLogicalOperatorNode extends BinaryOperatorNode
{
boolean shortCircuitValue;
- /**
- * Initializer for a BinaryLogicalOperatorNode
- *
- * @param leftOperand The left operand of the comparison
- * @param rightOperand The right operand of the comparison
- * @param methodName The name of the method to call in the generated
- * class. In this case, it's actually an operator
- * name.
- */
-
- public void init(
- Object leftOperand,
- Object rightOperand,
- Object methodName)
- {
- /* For logical operators, the operator and method names are the same */
- super.init(leftOperand, rightOperand, methodName, methodName,
- ClassName.BooleanDataValue, ClassName.BooleanDataValue);
- }
+ BinaryLogicalOperatorNode(
+ ValueNode leftOperand,
+ ValueNode rightOperand,
+ String methodName,
+ ContextManager cm) {
+ super(leftOperand, rightOperand, methodName, methodName,
+ ClassName.BooleanDataValue, ClassName.BooleanDataValue, cm);
+ }
/**
* Bind this logical operator. All that has to be done for binding
@@ -71,7 +57,7 @@ abstract class BinaryLogicalOperatorNode
*
* @exception StandardException Thrown on error
*/
-
+ @Override
ValueNode bindExpression(
FromList fromList, SubqueryList subqueryList, List<AggregateNode> aggregates)
throws StandardException
@@ -92,6 +78,7 @@ abstract class BinaryLogicalOperatorNode
*
* @return Boolean which reflects validity of the tree.
*/
+ @Override
boolean verifyEliminateNots()
{
if (SanityManager.ASSERT)
@@ -116,7 +103,7 @@ abstract class BinaryLogicalOperatorNode
*
* @exception StandardException Thrown on error
*/
-
+ @Override
void generateExpression(ExpressionClassBuilder acb, MethodBuilder mb)
throws StandardException
{