db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r833430 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/sql/compile/TableOperatorNode.java testing/org/apache/derbyTesting/functionTests/tests/lang/JoinTest.java
Date Fri, 06 Nov 2009 15:08:35 GMT
Author: mamta
Date: Fri Nov  6 15:08:35 2009
New Revision: 833430

URL: http://svn.apache.org/viewvc?rev=833430&view=rev
Log:
DERBY-4365

For JOIN, we were doing a no-op in the method bindUntypedNullsToResultColumns(ResultColumnList)
rather than checking for untyped nulls for the left and right resultsets. The changes through
this commit now checks for untyped nulls for joins. Added couple more tests (including where
a CAST of NULL values should work fine). The derbyall and junit suites ran fine with the exception
of known intermittent (DERBY-3757) 'ASSERT FAILED transaction table has null entry when running
new StressMultiTest 


Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableOperatorNode.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/JoinTest.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableOperatorNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableOperatorNode.java?rev=833430&r1=833429&r2=833430&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableOperatorNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableOperatorNode.java
Fri Nov  6 15:08:35 2009
@@ -87,6 +87,23 @@
 	}
 
 	/**
+	 * DERBY-4365
+	 * Bind untyped nulls to the types in the given ResultColumnList.
+	 * This is used for binding the nulls in row constructors and
+	 * table constructors.  
+	 *
+	 * @param rcl	The ResultColumnList with the types to bind nulls to
+	 *
+	 * @exception StandardException		Thrown on error
+	 */
+	public void bindUntypedNullsToResultColumns(ResultColumnList rcl)
+	throws StandardException
+	{
+		leftResultSet.bindUntypedNullsToResultColumns(rcl);
+		rightResultSet.bindUntypedNullsToResultColumns(rcl);
+	}
+
+	/**
 	 * @see Optimizable#modifyAccessPath
 	 *
 	 * @exception StandardException		Thrown on error

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/JoinTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/JoinTest.java?rev=833430&r1=833429&r2=833430&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/JoinTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/JoinTest.java
Fri Nov  6 15:08:35 2009
@@ -40,6 +40,7 @@
     private static final String NON_COMPARABLE = "42818";
     private static final String NO_COLUMNS = "42X81";
     private static final String TABLE_NAME_NOT_IN_SCOPE = "42X10";
+    private static final String VALUES_WITH_NULL = "42X07";
 
     public JoinTest(String name) {
         super(name);
@@ -50,6 +51,36 @@
     }
 
     /**
+     * DERBY-4365 Test that the NULL values are caught in VALUES clause when it
+     * is part of a non-INSERT statement. Throw exception 42X07 for such a 
+     * case.
+     * 
+     */
+    public void testNullabilityInValues() throws SQLException {
+        Statement s = createStatement();
+        assertStatementError(
+        		VALUES_WITH_NULL, s, 
+        		"select a.* from (values (null)) a left outer join "+
+        		"(values ('a')) b on 1=1");
+        assertStatementError(
+        		VALUES_WITH_NULL, s, 
+        		"select a.* from (values (null)) a");
+
+        String[][] expectedResult = {
+            {"a"},
+            {"a"},
+            {"b"},
+            {"b"},
+            {null},
+            {null}
+        };
+        JDBC.assertUnorderedResultSet(s.executeQuery(
+        		"select a.* from (values ('a'),('b'),(cast(null as char(1)))) "
+        		+ "a left outer join (values ('c'),('d')) b on 1=1"), 
+        		expectedResult);
+    }
+
+    /**
      * Test that the columns returned by a left or right outer join have the
      * correct nullability. In a left outer join, the columns from the left
      * side of the join should have their original nullability, and all the



Mime
View raw message