Return-Path: Delivered-To: apmail-hadoop-mapreduce-user-archive@minotaur.apache.org Received: (qmail 83344 invoked from network); 18 Jan 2011 18:56:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 18 Jan 2011 18:56:31 -0000 Received: (qmail 91176 invoked by uid 500); 18 Jan 2011 18:56:30 -0000 Delivered-To: apmail-hadoop-mapreduce-user-archive@hadoop.apache.org Received: (qmail 91133 invoked by uid 500); 18 Jan 2011 18:56:30 -0000 Mailing-List: contact mapreduce-user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: mapreduce-user@hadoop.apache.org Delivered-To: mailing list mapreduce-user@hadoop.apache.org Received: (qmail 91125 invoked by uid 99); 18 Jan 2011 18:56:30 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Jan 2011 18:56:30 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [208.97.132.207] (HELO homiemail-a60.g.dreamhost.com) (208.97.132.207) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Jan 2011 18:56:24 +0000 Received: from homiemail-a60.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a60.g.dreamhost.com (Postfix) with ESMTP id A0F133BC06C for ; Tue, 18 Jan 2011 10:56:03 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=darose.net; h=message-id:date :from:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; q=dns; s=darose.net; b= eZ3V2sxzc4R5Q/6BTl+lf7ThQdx3LNudfaqx9PzTGYPLfBMG99at2sFEdUNhkO9Z t9GERaQaR72EDTmmWeOYQmLopdZlbvCSUIIkMQIrlRLlMRARcePbqqXFEdgqpyHj NYRZYoan+TRguLWn2r8WhDoqGwNU5u7lN0nw7gklPc8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=darose.net; h=message-id :date:from:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; s=darose.net; bh=+rO26f 6lNZA0FVIAJVsKkRQbE08=; b=je/i+V2UCYmTYT7vP6PfejrF6ZNNPD7gTs8g3t YsdEK6iyMiW+hTWVXswNuAuQF+8EKRu58v8jSbhMjwOdty6ZjAsehBS3SfUvx61O BctQPxl83aGqJR1IR3vr+nxKjFvf2sctEtE+R3JWFIJeNZdgtRDxOMfgOvedyTlR zMXpI= Received: from darsys12 (cpe-66-108-142-190.nyc.res.rr.com [66.108.142.190]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: darose@darose.net) by homiemail-a60.g.dreamhost.com (Postfix) with ESMTPSA id 7A2613BC069 for ; Tue, 18 Jan 2011 10:56:03 -0800 (PST) Received: from [10.1.0.2] by darsys12 with esmtp (Exim 4.73) (envelope-from ) id 1PfGio-0006rK-D9 for mapreduce-user@hadoop.apache.org; Tue, 18 Jan 2011 13:56:02 -0500 Message-ID: <4D35E242.20503@darose.net> Date: Tue, 18 Jan 2011 13:56:02 -0500 From: David Rosenstrauch User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101230 Lanikai/3.1.7 MIME-Version: 1.0 To: mapreduce-user@hadoop.apache.org Subject: Re: how to write custom object using M/R References: <24012_1295029670_4D3095A6_24012_35350_1_ECB646CBB62FD044927FDEDF0252D3E701DE10AB978A@THSONEA01CMS03P.one.grp> In-Reply-To: <24012_1295029670_4D3095A6_24012_35350_1_ECB646CBB62FD044927FDEDF0252D3E701DE10AB978A@THSONEA01CMS03P.one.grp> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable I assumed you were already doing this but yes, Alain is correct, you=20 need to set the output format too. I initialize writing to sequence files like so: job.setOutputFormatClass(SequenceFileOutputFormat.class); FileOutputFormat.setOutputName(job, dataSourceName); FileOutputFormat.setOutputPath(job, hdfsJobOutputPath); FileOutputFormat.setCompressOutput(job, true); FileOutputFormat.setOutputCompressorClass(job, DefaultCodec.class); SequenceFileOutputFormat.setOutputCompressionType(job,=20 SequenceFile.CompressionType.BLOCK); DR On 01/14/2011 01:27 PM, MONTMORY Alain wrote: > Hi, > > I think you have to put : > job.setOutputFormatClass(SequenceFileOutputFormat.class); > to make it works.. > hopes this help > > Alain > > [@@THALES GROUP RESTRICTED@@] > > De : Joan [mailto:joan.monplet@gmail.com] > Envoy=E9 : vendredi 14 janvier 2011 13:58 > =C0 : mapreduce-user > Objet : how to write custom object using M/R > > Hi, > > I'm trying to write (K,V) where K is a Text object and V's CustomObject= . But It doesn't run. > > I'm configuring output job like: SequenceFileInputFormat so I have job = with: > > job.setMapOutputKeyClass(Text.class); > job.setMapOutputValueClass(CustomObject.class); > job.setOutputKeyClass(Text.class); > job.setOutputValueClass(CustomObject.class); > > SequenceFileOutputFormat.setOutputPath(job, new Path("myPath")= ; > > And I obtain the next output (this is a file: part-r-00000): > > K CustomObject@2b237512 > K CustomObject@24db06de > ... > > When this job finished I run other job which input is SequenceFileInput= Format but It doesn't run: > > The configuration's second job is: > > job.setInputFormatClass(SequenceFileInputFormat.class); > SequenceFileInputFormat.addInputPath(job, new Path("myPath")); > > But I get an error: > > java.io.IOException: hdfs://localhost:30000/user/hadoop/out/part-r-0000= 0 not a SequenceFile > at org.apache.hadoop.io.SequenceFile$Reader.init(SequenceFile.= java:1523) > at org.apache.hadoop.io.SequenceFile$Reader.(SequenceFil= e.java:1483) > at org.apache.hadoop.io.SequenceFile$Reader.(SequenceFil= e.java:1451) > at org.apache.hadoop.io.SequenceFile$Reader.(SequenceFil= e.java:1432) > at org.apache.hadoop.mapreduce.lib.input.SequenceFileRecordRea= der.initialize(SequenceFileRecordReader.java:60) > > > Can someone help me? Because I don't understand it. I don't know to sav= e my object in first M/R and how to use it in second M/R > > Thanks > > Joan > > >