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 ka...@apache.org on 2007/01/11 10:47:52 UTC

svn commit: r495171 - in /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile: ResultColumnList.java SelectNode.java

Author: kahatlen
Date: Thu Jan 11 01:47:42 2007
New Revision: 495171

URL: http://svn.apache.org/viewvc?view=rev&rev=495171
Log:
DERBY-504: SELECT DISTINCT returns duplicates when selecting from subselects

Remove redundant check.

Modified:
    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/SelectNode.java

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=495171&r1=495170&r2=495171
==============================================================================
--- 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 Jan 11 01:47:42 2007
@@ -2559,31 +2559,6 @@
 	}
 
 	/**
-	 * Count the number of RCs with simple ColumnReferences.  
-	 * (RC.expression instanceof ColumnReference)  This is useful
-	 * for ensuring that the number of columns in the group by list
-	 * equals the number of grouping columns.
-	 *
-	 * @return int	The number of simple ColumnReferences.
-	 */
-	public int countNumberOfSimpleColumnReferences()
-	{
-		int				numCRs = 0;
-
-		int size = size();
-
-		for (int index = 0; index < size; index++)
-		{
-			if (((ResultColumn) elementAt(index)).getExpression() instanceof ColumnReference)
-			{
-				numCRs++;
-			}
-		}
-
-		return numCRs;
-	}
-
-	/**
 	 * Given a ResultColumn at the next deepest level in the tree, 
 	 * search this RCL for its parent ResultColumn.
 	 *

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=495171&r1=495170&r2=495171
==============================================================================
--- 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 Jan 11 01:47:42 2007
@@ -1356,9 +1356,7 @@
 			 *	   from the same conglomerate in order to get consistent data.
 			 */
 			boolean distinctScanPossible = false;
-			if (origFromListSize == 1 &&
-				(! orderByAndDistinctMerged) &&
-				resultColumns.countNumberOfSimpleColumnReferences() == resultColumns.size())
+			if (origFromListSize == 1 && !orderByAndDistinctMerged)
 			{
 				boolean simpleColumns = true;
 				HashSet distinctColumns = new HashSet();