db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r639316 - in /db/derby/code/branches/10.1/java: engine/org/apache/derby/impl/sql/execute/ testing/org/apache/derbyTesting/functionTests/master/ testing/org/apache/derbyTesting/functionTests/tests/lang/
Date Thu, 20 Mar 2008 15:31:52 GMT
Author: kmarsden
Date: Thu Mar 20 08:31:50 2008
New Revision: 639316

URL: http://svn.apache.org/viewvc?rev=639316&view=rev
Log:
 DERBY-3538 NullPointerException during execution for query with LEFT OUTER JOIN whose inner
table selects all constants.

Contributeed by Army Brown.
port from trunk revision 638425


Modified:
    db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/execute/ProjectRestrictResultSet.java
    db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/joins.out
    db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/lang/joins.sql

Modified: db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/execute/ProjectRestrictResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/execute/ProjectRestrictResultSet.java?rev=639316&r1=639315&r2=639316&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/execute/ProjectRestrictResultSet.java
(original)
+++ db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/execute/ProjectRestrictResultSet.java
Thu Mar 20 08:31:50 2008
@@ -483,6 +483,15 @@
 		// No need to use reflection if reusing the result
 		if (reuseResult && projRow != null)
 		{
+			/* Make sure we reset the current row based on the re-used
+			 * result.  Otherwise, if the "current row" for this result
+			 * set was nulled out in a previous call to getNextRow(),
+			 * which can happen if this node is the right-side of
+			 * a left outer join, the "current row" stored for this
+			 * result set in activation.row would remain null, which
+			 * would be wrong. DERBY-3538.
+			 */
+			setCurrentRow(projRow);
 			return projRow;
 		}
 

Modified: db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/joins.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/joins.out?rev=639316&r1=639315&r2=639316&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/joins.out
(original)
+++ db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/joins.out
Thu Mar 20 08:31:50 2008
@@ -366,6 +366,23 @@
 -----------------------------------------------------------------------
 1          |1          |1          |1          |1          |2          
 7          |7          |8          |9          |1          |3          
+ij> -- DERBY-3538 NullPointerException during execution for query with LEFT
+-- OUTER JOIN whose inner table selects all constants.
+create table t3538 (i int, j int);
+0 rows inserted/updated/deleted
+ij> insert into t3538 values (-1, -2), (-2, -4), (-3, -9);
+3 rows inserted/updated/deleted
+ij> select * from
+t3538 left outer join
+    (select -1 a, 1 b from t3538) x0 --DERBY-PROPERTIES joinStrategy=NESTEDLOOP
+   on x0.a = t3538.i;
+I          |J          |A          |B          
+-----------------------------------------------
+-1         |-2         |-1         |1          
+-1         |-2         |-1         |1          
+-1         |-2         |-1         |1          
+-2         |-4         |NULL       |NULL       
+-3         |-9         |NULL       |NULL       
 ij> -----------------------------------
 -- clean up
 ----------------------------------
@@ -390,5 +407,7 @@
 ij> drop table x;
 0 rows inserted/updated/deleted
 ij> drop table y;
+0 rows inserted/updated/deleted
+ij> drop table t3538;
 0 rows inserted/updated/deleted
 ij> 

Modified: db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/lang/joins.sql
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/lang/joins.sql?rev=639316&r1=639315&r2=639316&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/lang/joins.sql
(original)
+++ db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/lang/joins.sql
Thu Mar 20 08:31:50 2008
@@ -170,6 +170,17 @@
   from D join ((B join C on b2=c2) right outer join A on a1=b1) 
     on d3=b3 and d1=a2;
 
+
+-- DERBY-3538 NullPointerException during execution for query with LEFT
+-- OUTER JOIN whose inner table selects all constants.
+create table t3538 (i int, j int);
+insert into t3538 values (-1, -2), (-2, -4), (-3, -9);
+
+select * from
+t3538 left outer join
+    (select -1 a, 1 b from t3538) x0 --DERBY-PROPERTIES joinStrategy=NESTEDLOOP
+   on x0.a = t3538.i; 
+
 -----------------------------------
 -- clean up
 ----------------------------------
@@ -184,3 +195,5 @@
 drop table instab;
 drop table x;
 drop table y;
+drop table t3538;
+



Mime
View raw message