Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 88172 invoked from network); 11 Jan 2007 09:49:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Jan 2007 09:49:07 -0000 Received: (qmail 35545 invoked by uid 500); 11 Jan 2007 09:49:14 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 35478 invoked by uid 500); 11 Jan 2007 09:49:13 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 35467 invoked by uid 99); 11 Jan 2007 09:49:13 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Jan 2007 01:49:13 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Jan 2007 01:48:53 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id DEACB1A981A; Thu, 11 Jan 2007 01:47:52 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r495171 - in /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile: ResultColumnList.java SelectNode.java Date: Thu, 11 Jan 2007 09:47:52 -0000 To: derby-commits@db.apache.org From: kahatlen@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070111094752.DEACB1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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();