db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r520885 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/
Date Wed, 21 Mar 2007 13:46:45 GMT
Author: kristwaa
Date: Wed Mar 21 06:46:43 2007
New Revision: 520885

URL: http://svn.apache.org/viewvc?view=rev&rev=520885
Log:
DERBY-2442: Remove code made redundant by DERBY 681.

Patch contributed by Manish Khettry.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryListOperatorNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryOperatorNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CastNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConditionalNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JavaToSQLValueNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumn.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SQLToJavaValueNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SelectNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SubqueryNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TernaryOperatorNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UnaryOperatorNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ValueNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ValueNodeList.java

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?view=diff&rev=520885&r1=520884&r2=520885
==============================================================================
--- 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
Wed Mar 21 06:46:43 2007
@@ -126,18 +126,6 @@
 	}
 
 	/**
-	 * Set the clause that this node appears in.
-	 *
-	 * @param clause	The clause that this node appears in.
-	 */
-	public void setClause(int clause)
-	{
-		super.setClause(clause);
-		leftOperand.setClause(clause);
-		rightOperandList.setClause(clause);
-	}
-
-	/**
 	 * Bind this expression.  This means binding the sub-expressions,
 	 * as well as figuring out what the return type is for this expression.
 	 *

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryOperatorNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryOperatorNode.java?view=diff&rev=520885&r1=520884&r2=520885
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryOperatorNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryOperatorNode.java
Wed Mar 21 06:46:43 2007
@@ -249,18 +249,6 @@
 	}
 
 	/**
-	 * Set the clause that this node appears in.
-	 *
-	 * @param clause	The clause that this node appears in.
-	 */
-	public void setClause(int clause)
-	{
-		super.setClause(clause);
-		leftOperand.setClause(clause);
-		rightOperand.setClause(clause);
-	}
-
-	/**
 	 * Prints the sub-nodes of this object.  See QueryTreeNode.java for
 	 * how tree printing is supposed to work.
 	 *

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CastNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CastNode.java?view=diff&rev=520885&r1=520884&r2=520885
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CastNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CastNode.java Wed Mar
21 06:46:43 2007
@@ -190,17 +190,6 @@
 	}
 
 	/**
-	 * Set the clause that this node appears in.
-	 *
-	 * @param clause	The clause that this node appears in.
-	 */
-	public void setClause(int clause)
-	{
-		super.setClause(clause);
-		castOperand.setClause(clause);
-	}
-
-	/**
 	 * Bind this expression.  This means binding the sub-expressions,
 	 * as well as figuring out what the return type is for this expression.
 	 *

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConditionalNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConditionalNode.java?view=diff&rev=520885&r1=520884&r2=520885
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConditionalNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConditionalNode.java
Wed Mar 21 06:46:43 2007
@@ -113,18 +113,6 @@
 		}
 	}
 
-	/**
-	 * Set the clause that this node appears in.
-	 *
-	 * @param clause	The clause that this node appears in.
-	 */
-	public void setClause(int clause)
-	{
-		super.setClause(clause);
-		testCondition.setClause(clause);
-		thenElseList.setClause(clause);
-	}
-
 	private boolean isCastNode(ValueNode node) {
 		if (node.getNodeType() == C_NodeTypes.CAST_NODE)
 			return true;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JavaToSQLValueNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JavaToSQLValueNode.java?view=diff&rev=520885&r1=520884&r2=520885
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JavaToSQLValueNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JavaToSQLValueNode.java
Wed Mar 21 06:46:43 2007
@@ -64,17 +64,6 @@
 	}
 
 	/**
-	 * Set the clause that this node appears in.
-	 *
-	 * @param clause	The clause that this node appears in.
-	 */
-	public void setClause(int clause)
-	{
-		super.setClause(clause);
-		javaNode.setClause(clause);
-	}
-
-	/**
 	 * Preprocess an expression tree.  We do a number of transformations
 	 * here (including subqueries, IN lists, LIKE and BETWEEN) plus
 	 * subquery flattening.

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?view=diff&rev=520885&r1=520884&r2=520885
==============================================================================
--- 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 Wed
Mar 21 06:46:43 2007
@@ -414,26 +414,6 @@
 		return resultSetNumber;
 	}
 
-	/**
-	 * Set the clause that this node appears in.
-	 *
-	 * @param clause	The clause that this node appears in.
-	 */
-	public void setClause(int clause)
-	{
-		super.setClause(clause);
-		/* expression will be null for AllResultColumn */
-		if (expression != null)
-		{
-			expression.setClause(clause);
-		}
-		else if (SanityManager.DEBUG)
-		{
-			SanityManager.ASSERT(this instanceof AllResultColumn,
-				"this expected to be instanceof AllResultColumn when expression is null");
-		}
-	}
-
 	/** 
 	 * Adjust the virtualColumnId for this ResultColumn	by the specified amount
 	 * 

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?view=diff&rev=520885&r1=520884&r2=520885
==============================================================================
--- 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
Wed Mar 21 06:46:43 2007
@@ -1582,11 +1582,6 @@
 				/* Make sure that every column has a name */
 				allExpansion.nameAllResultColumns();
 
-				/* Make sure that every RC and expression is marked as being in
-				 * the SELECT list.
-				 */
-				allExpansion.setClause(ValueNode.IN_SELECT_LIST);
-
 				/* Replace the AllResultColumn with the expanded list. 
 				 * We will update the VirtualColumnIds once below.
 				 */
@@ -2699,17 +2694,6 @@
 		}
 
 		return parentRC;
-	}
-
-	public void setClause(int clause)
-	{
-		int size = size();
-
-		for (int index = 0; index < size; index++)
-		{
-			ResultColumn	rc =  (ResultColumn) elementAt(index);
-			rc.setClause(clause);
-		}
 	}
 
 	/**

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?view=diff&rev=520885&r1=520884&r2=520885
==============================================================================
--- 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
Wed Mar 21 06:46:43 2007
@@ -179,17 +179,6 @@
 
 
 	/**
-	 * Set the clause that this node appears in.
-	 *
-	 * @param clause	The clause that this node appears in.
-	 */
-	public void setClause(int clause)
-	{
-		super.setClause(clause);
-		value.setClause(clause);
-	}
-
-	/**
 	 * Bind this expression.  This means binding the sub-expressions,
 	 * as well as figuring out what the return type is for this expression.
 	 *

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?view=diff&rev=520885&r1=520884&r2=520885
==============================================================================
--- 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 Wed
Mar 21 06:46:43 2007
@@ -319,36 +319,6 @@
 	}
 
 	/**
-	 * Return the specified aggregate vector for this SelectNode.
-	 *
-	 * @param clause	Which clause to get the aggregate list for
-	 *
-	 * @return aggregateVector	The specified aggregate vector for this SelectNode.
-	 */
-	public Vector getAggregateVector(int clause)
-	{
-		switch (clause)
-		{
-			case ValueNode.IN_SELECT_LIST:
-				return selectAggregates;
-
-			case ValueNode.IN_WHERE_CLAUSE:
-				return whereAggregates;
-
-			case ValueNode.IN_HAVING_CLAUSE:
-				return null;
-
-			default:
-				if (SanityManager.DEBUG)
-				{
-					SanityManager.ASSERT(false,
-						"Unexpected value for clause");
-				}
-				return null;
-		}
-	}
-
-	/**
 	 * Return the whereSubquerys for this SelectNode.
 	 *
 	 * @return SubqueryList	The whereSubquerys for this SelectNode.
@@ -460,7 +430,6 @@
 			fromListParam.insertElementAt(fromList.elementAt(index), index);
 		}
 
-		resultColumns.setClause(ValueNode.IN_SELECT_LIST);
 		resultColumns.bindExpressions(fromListParam, 
 									  selectSubquerys,
 									  selectAggregates);
@@ -2190,5 +2159,13 @@
 		}
 		
 		return returnNode;
+	}
+
+	/**
+	 * @return true if there are aggregates in the select list.
+	 */
+	public boolean hasAggregatesInSelectList() 
+	{
+		return !selectAggregates.isEmpty();
 	}
 }

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?view=diff&rev=520885&r1=520884&r2=520885
==============================================================================
--- 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 Wed
Mar 21 06:46:43 2007
@@ -696,7 +696,7 @@
 		if (flattenable)
 		{
 			SelectNode	select = (SelectNode) resultSet;
-			if ((select.getAggregateVector(IN_SELECT_LIST).size() == 0) &&
+			if ((!select.hasAggregatesInSelectList()) &&
 			    (select.havingClause == null))
 			{
 				ValueNode origLeftOperand = leftOperand;

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?view=diff&rev=520885&r1=520884&r2=520885
==============================================================================
--- 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
Wed Mar 21 06:46:43 2007
@@ -154,22 +154,6 @@
 	}
 
 	/**
-	 * Set the clause that this node appears in.
-	 *
-	 * @param clause	The clause that this node appears in.
-	 */
-	public void setClause(int clause)
-	{
-		super.setClause(clause);
-		receiver.setClause(clause);
-		leftOperand.setClause(clause);
-		if (rightOperand != null)
-		{
-			rightOperand.setClause(clause);
-		}
-	}
-
-	/**
 	 * Prints the sub-nodes of this object.  See QueryTreeNode.java for
 	 * how tree printing is supposed to work.
 	 *

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UnaryOperatorNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UnaryOperatorNode.java?view=diff&rev=520885&r1=520884&r2=520885
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UnaryOperatorNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UnaryOperatorNode.java
Wed Mar 21 06:46:43 2007
@@ -281,23 +281,6 @@
 		}
 	}
 
-	/**
-	 * Set the clause that this node appears in.
-	 *
-	 * @param clause	The clause that this node appears in.
-	 */
-	public void setClause(int clause)
-	{
-		super.setClause(clause);
-
-		/*
-		** Operator may be null for COUNT(*)
-		*/
-		if (operand != null)
-		{
-			operand.setClause(clause);
-		}
-	}
 
 	/**
 	 * Bind this expression.  This means binding the sub-expressions,

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ValueNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ValueNode.java?view=diff&rev=520885&r1=520884&r2=520885
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ValueNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ValueNode.java Wed Mar
21 06:46:43 2007
@@ -66,15 +66,9 @@
 
 public abstract class ValueNode extends QueryTreeNode
 {
-	public static final int IN_UNKNOWN_CLAUSE = 0;
-	public static final int IN_SELECT_LIST = 1;
-	public static final int IN_WHERE_CLAUSE = 2;
-	public static final int IN_HAVING_CLAUSE = 3;
-
 	protected DataTypeDescriptor	dataTypeServices;
 	private TypeId typeId;	   
 	private TypeCompiler typeCompiler;
-	protected int				clause = IN_UNKNOWN_CLAUSE;
 
 	// Whether or not additional predicates have been created from this one.
 	boolean	transformed;
@@ -165,7 +159,6 @@
 			return "dataTypeServices: " +
 				( ( dataTypeServices != null) ?
 						dataTypeServices.toString() : "null" ) + "\n" +
-				"clause: " + clause + "\n" +
 				super.toString();
 		}
 		else
@@ -260,26 +253,6 @@
 			"getSourceResultColumn() not expected to be called for this node - " +
 			getClass().toString());
 		return null;
-	}
-
-	/**
-	 * Get the clause that this node appears in.
-	 *
-	 * @return int	The clause that this node appears in.
-	 */
-	public int getClause()
-	{
-		return clause;
-	}
-
-	/**
-	 * Set the clause that this node appears in.
-	 *
-	 * @param clause	The clause that this node appears in.
-	 */
-	public void setClause(int clause)
-	{
-		this.clause = clause;
 	}
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ValueNodeList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ValueNodeList.java?view=diff&rev=520885&r1=520884&r2=520885
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ValueNodeList.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ValueNodeList.java Wed
Mar 21 06:46:43 2007
@@ -75,22 +75,6 @@
 		}
 	}
 
-	/**
-	 * Set the clause that this node appears in.
-	 *
-	 * @param clause	The clause that this node appears in.
-	 */
-	public void setClause(int clause)
-	{
-		int size = size();
-
-		for (int index = 0; index < size; index++)
-		{
-			ValueNode		valueNode;
-				valueNode = (ValueNode) elementAt(index);
-			valueNode.setClause(clause);
-		}
-	}
 
 	/**
 	 * Add a ValueNode to the list.



Mime
View raw message