Return-Path: X-Original-To: apmail-db-derby-dev-archive@www.apache.org Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 160EF489E for ; Wed, 25 May 2011 10:18:31 +0000 (UTC) Received: (qmail 36227 invoked by uid 500); 25 May 2011 10:18:30 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 36198 invoked by uid 500); 25 May 2011 10:18:30 -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 36184 invoked by uid 99); 25 May 2011 10:18:30 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 May 2011 10:18:30 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 May 2011 10:18:28 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 75702DDF2A for ; Wed, 25 May 2011 10:17:47 +0000 (UTC) Date: Wed, 25 May 2011 10:17:47 +0000 (UTC) From: "Knut Anders Hatlen (JIRA)" To: derby-dev@db.apache.org Message-ID: <1463966256.42057.1306318667477.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1322130874.42050.1306318187332.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Updated] (DERBY-5246) Simplify bytecode generation for concatenation operator MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-5246?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Knut Anders Hatlen updated DERBY-5246: -------------------------------------- Attachment: concat.diff The attached patch removes the generation of the null check in ConcatenationOperatorNode and removes the special handling of concatenation that was required in BinaryOperatorNode because of it. The patch also changes the implementations of concatenate() in SQLChar, SQLLongvarchar and SQLBinary to work if a null value is passed in for the result object. This makes the methods match the javadoc comments in the interfaces (StringDataValue and BitDataValue), which state that the result parameter in the concatenate() methods should accept null values. The regression tests ran cleanly with the patch. > Simplify bytecode generation for concatenation operator > ------------------------------------------------------- > > Key: DERBY-5246 > URL: https://issues.apache.org/jira/browse/DERBY-5246 > Project: Derby > Issue Type: Improvement > Components: SQL > Affects Versions: 10.9.0.0 > Reporter: Knut Anders Hatlen > Assignee: Knut Anders Hatlen > Priority: Minor > Attachments: concat.diff > > > ConcatenationOperatorNode generates bytecode that ensures the result object is not null before calling the method that implements the operator. This breaks the pattern used by other operators (which ensures that the result object is not null inside the method that implements the operator, not in the generated bytecode), and it unnecessarily complicates the code in BinaryOperatorNode. > The comments indicate that the current approach was chosen to prevent the null check from happening at execution time, but the generated bytecode does perform the null check at execution time, so generating byte code for it shouldn't have any real benefit over writing Java code for it. In general, implementing as much as possible of the execution time code as Java code is preferred to implementing it directly as bytecode because it's easier to read and debug Java code, and because the generated bytecode cannot be shared between execution plans and take more memory. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira