Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 87504 invoked from network); 21 Nov 2005 23:54:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 21 Nov 2005 23:54:20 -0000 Received: (qmail 17061 invoked by uid 500); 21 Nov 2005 23:54:11 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 16914 invoked by uid 500); 21 Nov 2005 23:54:10 -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 16856 invoked by uid 99); 21 Nov 2005 23:54:10 -0000 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 [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 21 Nov 2005 15:54:10 -0800 Received: (qmail 87200 invoked by uid 65534); 21 Nov 2005 23:53:49 -0000 Message-ID: <20051121235349.87199.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r348033 - in /db/derby/code/branches/10.1/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: Mon, 21 Nov 2005 23:53:48 -0000 To: derby-commits@db.apache.org From: kmarsden@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: kmarsden Date: Mon Nov 21 15:53:40 2005 New Revision: 348033 URL: http://svn.apache.org/viewcvs?rev=348033&view=rev Log: DERBY-466: Reset nextCalled in SortResultSet.openCore() to handle the case of eliminating duplicates without a sorter for a distinct operator. contributeded by Manish Khettry (manish_khettry@yahoo.com) Modified: db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/execute/SortResultSet.java db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/distinct.out db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/lang/distinct.sql Modified: db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/execute/SortResultSet.java URL: http://svn.apache.org/viewcvs/db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/execute/SortResultSet.java?rev=348033&r1=348032&r2=348033&view=diff ============================================================================== --- db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/execute/SortResultSet.java (original) +++ db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/execute/SortResultSet.java Mon Nov 21 15:53:40 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: db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/distinct.out URL: http://svn.apache.org/viewcvs/db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/distinct.out?rev=348033&r1=348032&r2=348033&view=diff ============================================================================== --- db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/distinct.out (original) +++ db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/distinct.out Mon Nov 21 15:53:40 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> -- Tests for DERBY-504 (select distinct from a subquery) create table names (id int, name varchar(10), age int); 0 rows inserted/updated/deleted Modified: db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/lang/distinct.sql URL: http://svn.apache.org/viewcvs/db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/lang/distinct.sql?rev=348033&r1=348032&r2=348033&view=diff ============================================================================== --- db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/lang/distinct.sql (original) +++ db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/lang/distinct.sql Mon Nov 21 15:53:40 2005 @@ -329,6 +329,17 @@ 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); + -- Tests for DERBY-504 (select distinct from a subquery) create table names (id int, name varchar(10), age int);