Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 83872 invoked from network); 23 Jul 2005 00:41:00 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 23 Jul 2005 00:41:00 -0000 Received: (qmail 3015 invoked by uid 500); 23 Jul 2005 00:41:00 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 2961 invoked by uid 500); 23 Jul 2005 00:41:00 -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 2948 invoked by uid 500); 23 Jul 2005 00:40:59 -0000 Delivered-To: apmail-incubator-derby-cvs@incubator.apache.org Received: (qmail 2945 invoked by uid 99); 23 Jul 2005 00:40:59 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 22 Jul 2005 17:40:48 -0700 Received: (qmail 83832 invoked by uid 65534); 23 Jul 2005 00:40:46 -0000 Message-ID: <20050723004046.83830.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r224427 - in /incubator/derby/code/trunk/java: engine/org/apache/derby/impl/sql/execute/SortResultSet.java testing/org/apache/derbyTesting/functionTests/master/distinct.out testing/org/apache/derbyTesting/functionTests/tests/lang/distinct.sql Date: Sat, 23 Jul 2005 00:40:45 -0000 To: derby-cvs@incubator.apache.org From: bandaram@apache.org X-Mailer: svnmailer-1.0.2 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: bandaram Date: Fri Jul 22 17:40:38 2005 New Revision: 224427 URL: http://svn.apache.org/viewcvs?rev=224427&view=rev Log: DERBY-466: Reset nextCalled in SortResultSet.openCore() to handle the case of eliminating duplicates without a sorter for a distinct operator. Submitted by Manish Khettry (manish_khettry@yahoo.com) Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/SortResultSet.java incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/distinct.out incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/distinct.sql Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/SortResultSet.java URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/SortResultSet.java?rev=224427&r1=224426&r2=224427&view=diff ============================================================================== --- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/SortResultSet.java (original) +++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/SortResultSet.java Fri Jul 22 17:40:38 2005 @@ -230,6 +230,7 @@ */ public void openCore() throws StandardException { + nextCalled = false; beginTime = getCurrentTimeMillis(); // REVISIT: through the direct DB API, this needs to be an // error, not an ASSERT; users can open twice. Only through JDBC Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/distinct.out URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/distinct.out?rev=224427&r1=224426&r2=224427&view=diff ============================================================================== --- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/distinct.out (original) +++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/distinct.out Fri Jul 22 17:40:38 2005 @@ -2477,6 +2477,31 @@ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- name1 |sum2 ij> rollback; +ij> create table td (x int); +0 rows inserted/updated/deleted +ij> insert into td values (1); +1 row inserted/updated/deleted +ij> insert into td values (1); +1 row inserted/updated/deleted +ij> insert into td values (2); +1 row inserted/updated/deleted +ij> -- distinct in subquery where the store does not perform the sort. +select * from td, (select distinct 1 from td) as sub(x); +X |X +----------------------- +1 |1 +1 |1 +2 |1 +ij> -- get the storage system to do the sort. +select * from td, (select distinct x from td) as sub(x); +X |X +----------------------- +1 |2 +1 |1 +1 |2 +1 |1 +2 |2 +2 |1 ij> -- reset autocomiit autocommit on; ij> Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/distinct.sql URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/distinct.sql?rev=224427&r1=224426&r2=224427&view=diff ============================================================================== --- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/distinct.sql (original) +++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/distinct.sql Fri Jul 22 17:40:38 2005 @@ -329,5 +329,16 @@ execute c1 using 'values(''lusername1'', ''lusername2'', ''lname1'')'; rollback; +create table td (x int); +insert into td values (1); +insert into td values (1); +insert into td values (2); + +-- distinct in subquery where the store does not perform the sort. +select * from td, (select distinct 1 from td) as sub(x); + +-- get the storage system to do the sort. +select * from td, (select distinct x from td) as sub(x); + -- reset autocomiit autocommit on;