db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r639040 - in /db/derby/code/branches/10.4/java: engine/org/apache/derby/impl/sql/execute/ testing/org/apache/derbyTesting/functionTests/master/ testing/org/apache/derbyTesting/functionTests/tests/lang/
Date Wed, 19 Mar 2008 22:17:18 GMT
Author: kmarsden
Date: Wed Mar 19 15:17:13 2008
New Revision: 639040

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

port revision 638425 from trunk


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

Modified: db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/sql/execute/ProjectRestrictResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/sql/execute/ProjectRestrictResultSet.java?rev=639040&r1=639039&r2=639040&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/sql/execute/ProjectRestrictResultSet.java
(original)
+++ db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/sql/execute/ProjectRestrictResultSet.java
Wed Mar 19 15:17:13 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.4/java/testing/org/apache/derbyTesting/functionTests/master/joins.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/master/joins.out?rev=639040&r1=639039&r2=639040&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/master/joins.out
(original)
+++ db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/master/joins.out
Wed Mar 19 15:17:13 2008
@@ -613,6 +613,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
 ----------------------------------
@@ -641,5 +658,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.4/java/testing/org/apache/derbyTesting/functionTests/tests/lang/joins.sql
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/lang/joins.sql?rev=639040&r1=639039&r2=639040&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/lang/joins.sql
(original)
+++ db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/lang/joins.sql
Wed Mar 19 15:17:13 2008
@@ -352,6 +352,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
 ----------------------------------
@@ -368,3 +379,4 @@
 drop table y;
 drop table j1089_source;
 drop table j1089_dest;
+drop table t3538;



Mime
View raw message