db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r886277 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java testing/org/apache/derbyTesting/functionTests/tests/lang/RoutineTest.java
Date Wed, 02 Dec 2009 19:28:33 GMT
Author: rhillegas
Date: Wed Dec  2 19:28:32 2009
New Revision: 886277

URL: http://svn.apache.org/viewvc?rev=886277&view=rev
Log:
DERBY-1030: Remove over-eager optimization which short-circuited NULL ON NULL INPUT processing
when argument values came out of nested function calls.

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

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java?rev=886277&r1=886276&r2=886277&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java
Wed Dec  2 19:28:32 2009
@@ -347,8 +347,21 @@
 	 * This can't be done for parameters which are wrappers over SQL function
 	 * defined with RETURN NULL ON NULL INPUT because such functions need
 	 * access to both sql domain value and java domain value. - Derby479
+     * This optimization is not available if the outer function is
+	 * RETURN NULL ON NULL INPUT. That is because the SQLToJavaNode is
+	 * responsible for compiling the byte code which skips the method call if
+     * the parameter is null--if we remove the SQLToJavaNode, then we don't
+     * compile that check and we get bug DERBY-1030.
 	 */
 	private void optimizeDomainValueConversion() throws StandardException {
+
+        //
+        // This optimization is not possible if we are compiling a call to
+        // a NULL ON NULL INPUT method. See DERBY-1030 and the header
+        // comment above.
+        //
+        if ( !routineInfo.calledOnNullInput() ) { return; }
+        
 		int		count = methodParms.length;
 		for (int parm = 0; parm < count; parm++)
 		{

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RoutineTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RoutineTest.java?rev=886277&r1=886276&r2=886277&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RoutineTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RoutineTest.java
Wed Dec  2 19:28:32 2009
@@ -572,7 +572,7 @@
         // noon->NULL by inner function
         // NULL->NULL by outer due to RETURN NULL ON NULL INPUT
         ps.setTime(1, noon); // noon->NULL->NULL
-        JDBC.assertSingleValueResultSet(ps.executeQuery(), "11:00:00");        
+        JDBC.assertSingleValueResultSet(ps.executeQuery(), null);        
         ps.setTime(1, null); // NULL->11:00:00->11:30:00
         JDBC.assertSingleValueResultSet(ps.executeQuery(), "11:30:00");
 



Mime
View raw message