db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
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 GMT
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);



Mime
View raw message