You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by rh...@apache.org on 2009/12/02 20:28:33 UTC
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
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");