Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 77602 invoked from network); 22 Feb 2006 07:56:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 22 Feb 2006 07:56:19 -0000 Received: (qmail 55972 invoked by uid 500); 22 Feb 2006 07:56:18 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 55940 invoked by uid 500); 22 Feb 2006 07:56:18 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 55929 invoked by uid 99); 22 Feb 2006 07:56:17 -0000 X-ASF-Spam-Status: No, hits=1.3 required=10.0 tests=SPF_FAIL X-Spam-Check-By: apache.org Received: from [192.87.106.226] (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Feb 2006 23:56:17 -0800 Received: from ajax.apache.org (ajax.apache.org [127.0.0.1]) by ajax.apache.org (Postfix) with ESMTP id 4F3B6DE for ; Wed, 22 Feb 2006 08:55:56 +0100 (CET) Message-ID: <485288821.1140594956322.JavaMail.jira@ajax.apache.org> Date: Wed, 22 Feb 2006 08:55:56 +0100 (CET) From: "Mamta A. Satoor (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Commented: (DERBY-479) Passing the return of a RETURN NULL ON NULL INPUT function to another function call throws linkage error. In-Reply-To: <365066524.1122568530711.JavaMail.jira@ajax.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/DERBY-479?page=comments#action_12367315 ] Mamta A. Satoor commented on DERBY-479: --------------------------------------- Dan, you are probably right about following >>>>>>>>> Dan's review comments start "Looking more at StaticMethodCallNode.optimizeDomainValueConversion() I'm not convinced it is correct. The comments and code seem to say if I have f1(f2()) then if f2() is CALLED ON NULL INPUT then I can take the java value directly from f2() and pass it to f1(). But, what if f1() is RETURNS NULL ON NULL INPUT, don't I need the SQL nodes to perform the NULL check? Thus don't both methods, the one being called and the one providing the parameter have to be CALLED ON NULL INPUT to take allow the conversion nodes to be dropped? " >>>>>>>>> Dan's review comments end But I wanted to write an example for what you have described above to test what exactly happens with my changes. Following is the example I came up with and it worked fine with my changes CREATE FUNCTION f2(A varchar(128)) RETURNS varchar(128) EXTERNAL NAME 'org.apache.derbyTesting.functionTests.util.ProcedureTest.function2AlwaysReturnsNull' CALLED ON NULL INPUT LANGUAGE JAVA PARAMETER STYLE JAVA; CREATE FUNCTION f1(A varchar(128)) RETURNS varchar(128) EXTERNAL NAME 'org.apache.derbyTesting.functionTests.util.ProcedureTest.function1AlwaysReturnsAAA' RETURNs NULL ON NULL INPUT LANGUAGE JAVA PARAMETER STYLE JAVA; The java methods invoked by the 2 sql functions are as follows public static String function1AlwaysReturnsAAA(String a) throws SQLException { return "AAA"; } public static String function2AlwaysReturnsNull(String a) throws SQLException { return (String)null; } Then I tried following in ij and both of them returned null which is the correct value values f1(f2('sss')); 1 -------------------------------------------------------------------------------- NULL values f1(f2(null)); 1 -------------------------------------------------------------------------------- NULL I have spent couple of hours on trying to come up with another example where I can see that my changes won't work but I haven't succedded. Do you have an example in mind which I can try? Thanks > Passing the return of a RETURN NULL ON NULL INPUT function to another function call throws linkage error. > ---------------------------------------------------------------------------------------------------------- > > Key: DERBY-479 > URL: http://issues.apache.org/jira/browse/DERBY-479 > Project: Derby > Type: Bug > Components: SQL > Versions: 10.2.0.0 > Reporter: Daniel John Debrunner > Assignee: Mamta A. Satoor > Attachments: Derby479LinkageErrorReturnNullIfNulldiff021306.txt, Derby479LinkageErrorReturnNullIfNulldiff021406.txt, Derby479LinkageErrorReturnNullIfNulldiff021606.txt, Derby479Version4LinkageErrorReturnNullIfNull022006.txt, wisconsin.out, wisconsinAfterRemovingNullChk.out > > Error in ij (RN_RADIANS is a function declared as returns null on null input) > ij> VALUES CAST( CALL_COS(RN_RADIANS(90.0)) AS DECIMAL(3,2)); > ERROR XBCM1: Java linkage error thrown during load of generated class org.apache.derby.exe.ace5214067x0105x5e41x7a46xffff855452e375. > ERROR XJ001: Java exception: '(class: org/apache/derby/exe/ace5214067x0105x5e41x > 7a46xffff855452e375, method: e0 signature: ()Ljava/lang/Object;) Expecting to find double on stack: java.lang.VerifyError'. > extract from derby.log > 2005-07-28 16:23:43.836 GMT Thread[main,5,main] Wrote class org.apache.derby.exe > .ace5214067x0105x5e41x7a46xffff855452e375 to file C:\_work\svn_pb\trunk\systest\ > out\functions\ace5214067x0105x5e41x7a46xffff855452e375.class. Please provide sup > port with the file and the following exception information: java.lang.VerifyErro > r: (class: org/apache/derby/exe/ace5214067x0105x5e41x7a46xffff855452e375, method > : e0 signature: ()Ljava/lang/Object;) Expecting to find double on stack > I will add a test case to lang/functions.sql commented with this bug number. Test cases > that fail will be commented out. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira