db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r639294 - in /db/derby/code/branches/10.2/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 14:11:04 GMT
Author: kmarsden
Date: Thu Mar 20 07:11:03 2008
New Revision: 639294

URL: http://svn.apache.org/viewvc?rev=639294&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.2/java/engine/org/apache/derby/impl/sql/execute/ProjectRestrictResultSet.java
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/joins.out
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/joins.sql

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/ProjectRestrictResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/ProjectRestrictResultSet.java?rev=639294&r1=639293&r2=639294&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/ProjectRestrictResultSet.java
(original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/ProjectRestrictResultSet.java
Thu Mar 20 07:11:03 2008
@@ -477,6 +477,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.2/java/testing/org/apache/derbyTesting/functionTests/master/joins.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/joins.out?rev=639294&r1=639293&r2=639294&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/joins.out
(original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/joins.out
Thu Mar 20 07:11:03 2008
@@ -406,6 +406,23 @@
 DEST_ID    |SOURCE_ID_1|SOURCE_ID_2
 -----------------------------------
 1          |0          |0          
+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
 ----------------------------------
@@ -434,5 +451,7 @@
 ij> drop table j1089_source;
 0 rows inserted/updated/deleted
 ij> drop table j1089_dest;
+0 rows inserted/updated/deleted
+ij> drop table t3538;
 0 rows inserted/updated/deleted
 ij> 

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/joins.sql
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/joins.sql?rev=639294&r1=639293&r2=639294&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/joins.sql
(original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/joins.sql
Thu Mar 20 07:11:03 2008
@@ -201,6 +201,17 @@
             join j1089_source as s2 on 1 = 1;
 select * from j1089_dest;
 
+
+-- 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
 ----------------------------------
@@ -217,3 +228,4 @@
 drop table y;
 drop table j1089_source;
 drop table j1089_dest;
+drop table t3538;



Mime
View raw message