Return-Path: X-Original-To: apmail-hadoop-user-archive@minotaur.apache.org Delivered-To: apmail-hadoop-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B7280F1A3 for ; Tue, 1 Oct 2013 12:54:39 +0000 (UTC) Received: (qmail 84335 invoked by uid 500); 1 Oct 2013 12:54:29 -0000 Delivered-To: apmail-hadoop-user-archive@hadoop.apache.org Received: (qmail 84233 invoked by uid 500); 1 Oct 2013 12:54:20 -0000 Mailing-List: contact user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hadoop.apache.org Delivered-To: mailing list user@hadoop.apache.org Received: (qmail 84222 invoked by uid 99); 1 Oct 2013 12:54:19 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Oct 2013 12:54:19 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of john.meagher@gmail.com designates 209.85.217.173 as permitted sender) Received: from [209.85.217.173] (HELO mail-lb0-f173.google.com) (209.85.217.173) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Oct 2013 12:54:14 +0000 Received: by mail-lb0-f173.google.com with SMTP id o14so5844506lbi.32 for ; Tue, 01 Oct 2013 05:53:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=BdHaiDf6KzxpVOz8YqNW7Gv8QUte3KwSIVpyLfvfPFM=; b=wy8ddMDF9OqG1QdUCcfYueetI9EZErTbCIg6LTej2Ysg2xbs7DGTuA00480Fb6BM0B uwAwYoFu/WlHaDOeKX2iTU+jjzlSdx9N4SkUmIfz0mYpO54z5t3CfGJGSq2VbdGAzM3E AwQzF3lPRcqopx8DsSGlvXLDj+AvrjK+sCNjc73K1UO1Tcu8apYYCRZFWdakm8d446VO 3k6Czr+P67eF6eT6Vs2ocL81C6Z9wL9a0dYq8L2QWB9a5yHI/U+3uzYM/ynM1bBOvKqv vPWX+uKDWrBCr/7nJ02PXqcaPMo7GOvwfNjQylLz1HzfSrEUqdtygrbEt8Nw3GG93pRh kt8Q== MIME-Version: 1.0 X-Received: by 10.112.77.134 with SMTP id s6mr1522083lbw.38.1380632033240; Tue, 01 Oct 2013 05:53:53 -0700 (PDT) Received: by 10.112.55.9 with HTTP; Tue, 1 Oct 2013 05:53:53 -0700 (PDT) In-Reply-To: References: Date: Tue, 1 Oct 2013 08:53:53 -0400 Message-ID: Subject: Re: Question on BytesWritable From: John Meagher To: user@hadoop.apache.org Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org https://issues.apache.org/jira/browse/HADOOP-6298 On Tue, Oct 1, 2013 at 12:39 AM, Chandra Mohan, Ananda Vel Murugan wrote: > Hi, > > > > I am using Hadoop 1.0.2. I have written a map reduce job. I have a > requirement to process the whole file without splitting. So I have writte= n a > new input format to process the file as a whole by overriding the > isSplittable() method. I have also created a new Record reader > implementation to read the whole file. I followed the sample in Chapter 7= of > =93Hadoop- The Definitive Guide=94 book. In my map reduce job, my mapper = emits > BytesWritable as value. I want to get the bytes and read some specific > information from the bytes. I use ByteArrayInputStream and do further > processing. But strangely the following code shows different numbers. > Because of this I am getting errors. > > > > //value -> BytesWritable > > System.out.println(=93Bytes length =94 + value.getLength()); // Bytes len= gth > 1931650 > > byte[] bytes =3D value.getBytes(); > > System.out.println("Bytes array length"+bytes.length); //Bytes array leng= th > 2897340 > > > > My file size is 1931650 bytes. I don=92t know why byte array is bigger th= an > the original file. > > > > Any idea what is going wrong. Please help. Thanks in advance. > > > > Regards, > > Anand.C