Return-Path: X-Original-To: apmail-hadoop-common-issues-archive@minotaur.apache.org Delivered-To: apmail-hadoop-common-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 05B8880AF for ; Sat, 17 Sep 2011 09:43:37 +0000 (UTC) Received: (qmail 37389 invoked by uid 500); 17 Sep 2011 09:43:36 -0000 Delivered-To: apmail-hadoop-common-issues-archive@hadoop.apache.org Received: (qmail 37326 invoked by uid 500); 17 Sep 2011 09:43:36 -0000 Mailing-List: contact common-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-issues@hadoop.apache.org Delivered-To: mailing list common-issues@hadoop.apache.org Received: (qmail 37312 invoked by uid 99); 17 Sep 2011 09:43:36 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 17 Sep 2011 09:43:36 +0000 X-ASF-Spam-Status: No, hits=-2000.5 required=5.0 tests=ALL_TRUSTED,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; Sat, 17 Sep 2011 09:43:30 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id D925E9FC81 for ; Sat, 17 Sep 2011 09:43:08 +0000 (UTC) Date: Sat, 17 Sep 2011 09:43:08 +0000 (UTC) From: "Hung-chih Yang (JIRA)" To: common-issues@hadoop.apache.org Message-ID: <559970296.38098.1316252588886.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Created] (HADOOP-7651) Hadoop Record compiler generates Java files with erroneous byte-array lengths for fields trailing a 'ustring' field 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 Hadoop Record compiler generates Java files with erroneous byte-array lengths for fields trailing a 'ustring' field ------------------------------------------------------------------------------------------------------------------- Key: HADOOP-7651 URL: https://issues.apache.org/jira/browse/HADOOP-7651 Project: Hadoop Common Issue Type: Bug Components: record Affects Versions: 0.21.0, 0.20.203.0 Reporter: Hung-chih Yang Hadoop Record compiler produces Java files from a DDL file. If a DDL file has a class that contains a 'ustring' field, then the generated 'compareRaw()' function for this record is erroneous in computing the length of remaining bytes after the logic of computing the buffer segment for a 'ustring' field. Below is a line in a generated 'compareRaw()' function for a record class with a 'ustring' field : s1+=i1; s2+=i2; l1-=i1; l1-=i2; This line shoud be corrected by changing the last 'l1' to 'l2': s1+=i1; s2+=i2; l1-=i1; l2-=i2; To fix this bug, one should correct the 'genCompareBytes()' function in the 'JString.java' file of the package 'org.apache.hadoop.record.compiler' by changing the line below to the ensuing line. There is only one digit difference: cb.append("s1+=i1; s2+=i2; l1-=i1; l1-=i2;\n"); cb.append("s1+=i1; s2+=i2; l1-=i1; l2-=i2;\n"); This bug is serious as it will always crash unserializing a record with a simple definition like the one below class PairStringDouble { ustring first; double second; } Unserializing a record of this class will throw an exception as the 'second' field does not have 8 bytes for a double value due to the erroneous length computation for the remaining buffer. Both Hadoop 0.20 and 0.21 have this bug. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira