Return-Path: X-Original-To: apmail-hbase-user-archive@www.apache.org Delivered-To: apmail-hbase-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BD50110C22 for ; Thu, 29 Aug 2013 15:59:33 +0000 (UTC) Received: (qmail 42664 invoked by uid 500); 29 Aug 2013 15:59:31 -0000 Delivered-To: apmail-hbase-user-archive@hbase.apache.org Received: (qmail 42237 invoked by uid 500); 29 Aug 2013 15:59:25 -0000 Mailing-List: contact user-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hbase.apache.org Delivered-To: mailing list user@hbase.apache.org Received: (qmail 42229 invoked by uid 99); 29 Aug 2013 15:59:24 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Aug 2013 15:59:24 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of shahab.yunus@gmail.com designates 209.85.214.47 as permitted sender) Received: from [209.85.214.47] (HELO mail-bk0-f47.google.com) (209.85.214.47) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Aug 2013 15:59:19 +0000 Received: by mail-bk0-f47.google.com with SMTP id mx12so257663bkb.6 for ; Thu, 29 Aug 2013 08:58:58 -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; bh=MyziCsJzIG6DQshrx+3uS+P0UUpk2M7XDyZE3Il7Kqk=; b=NRKdt1bfvBKZpuvq0GMlcIld2jA9dqjuyio2wVnq26A4aaWTTOzdnsw/x9q7DhAi+O uvK0PXVJOA8pTX0PdUkWGYySXm8TkI6OrDrtvf9twPTiXoBZlTAL0Ip5NYOJ0DWbdOjO KI+34w6mfsPkFjd9D7ptngi9Z3zaQcpIFqQBBssG8T6YlNWJs6N+aiOqHL16rLnGjJYz 9cwJo1WAnVGWNY/BqrJ/uCUGYR08n6N1CVY04e1i9XSG6ZhwmUmw8nPZ8K22KPQka38v dn2zEPoJiKPHhqGxg9U+wnlJupaA/bPmxYo4899IFP18KCuyU9z/3KRIaiRBkT/fX+E6 aIOQ== MIME-Version: 1.0 X-Received: by 10.204.62.201 with SMTP id y9mr3284649bkh.23.1377791938173; Thu, 29 Aug 2013 08:58:58 -0700 (PDT) Received: by 10.204.231.76 with HTTP; Thu, 29 Aug 2013 08:58:58 -0700 (PDT) In-Reply-To: References: Date: Thu, 29 Aug 2013 11:58:58 -0400 Message-ID: Subject: Re: java.io.IOException: Type mismatch in value from map: expected org.apache.hadoop.hbase.client.Put, recieved org.apache.hadoop.io.BytesWritable From: Shahab Yunus To: "user@hbase.apache.org" Content-Type: multipart/alternative; boundary=001a11c378a20ccbea04e5182f19 X-Virus-Checked: Checked by ClamAV on apache.org --001a11c378a20ccbea04e5182f19 Content-Type: text/plain; charset=ISO-8859-1 ".... public class MYHBaseLoader extends Mapper<*NullWritable*,BytesWritable,NullWritable,Put> { protected void map (*LongWritable* key, BytesWritable value, Context context) throws IOException, InterruptedException { ..." Why is the difference in types of the keys? Regards, Shahab On Thu, Aug 29, 2013 at 5:46 AM, praveenesh kumar wrote: > Hi all, > > I am trying to write a MR code to load a HBase table. > > I have a mapper that emits (null,put object) and I am using > TableMapReduceUtil.initTableReducerJob() to write it into a HBase table. > > Following is my code snippet > > public class MYHBaseLoader extends > Mapper { > > protected void map (LongWritable key, BytesWritable value, Context > context) throws IOException, InterruptedException { > > /****----- Some processing here.. Create put object and pushing it > into Put object). > context.write(null, put);// Pushing the put object. > > } > > public static void main (String args[]) throws IOException, > ClassNotFoundException, InterruptedException{ > Configuration conf = new Configuration(); > Job job = new Job(conf); > job.setJarByClass(MYHBaseLoader.class); > job.setMapperClass(MYHBaseLoader.class); > > > TableMapReduceUtil.initTableReducerJob(MY_IMPORT_TABLE_NAME,IdentityTableReducer.class,job); > job.setMapOutputKeyClass(NullWritable.class); > job.setMapOutputValueClass(Put.class); > job.setInputFormatClass(SequenceFileInputFormat.class); > //job.setNumReduceTasks(0); > > FileInputFormat.setInputPaths(job, new Path("test")); > Path outputPath = new Path("test_output"); > FileOutputFormat.setOutputPath(job,outputPath); > > //outputPath.getFileSystem(conf).delete(outputPath, true); > > job.waitForCompletion(true); > System.out.println("Done"); > } > > > I am getting the following error while running. Any help/guidance: > > > java.io.IOException: Type mismatch in value from map: expected > org.apache.hadoop.hbase.client.Put, recieved > org.apache.hadoop.io.BytesWritable > at > org.apache.hadoop.mapred.MapTask$MapOutputBuffer.collect(MapTask.java:1023) > at > org.apache.hadoop.mapred.MapTask$NewOutputCollector.write(MapTask.java:689) > at > > org.apache.hadoop.mapreduce.TaskInputOutputContext.write(TaskInputOutputContext.java:80) > at org.apache.hadoop.mapreduce.Mapper.map(Mapper.java:124) > at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:145) > at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:763) > at org.apache.hadoop.mapred.MapTask.run(MapTask.java:363) > at org.apache.hadoop.mapred.Child$4.run(Child.java:255) > at java.security.AccessController.doPrivileged(Native Method) > at javax.security.auth.Subject.doAs(Subject.java:396) > at > > org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1232) > at org.apache.hadoop.mapred.Child.main(Child.java:249) > > > Regards > Praveenesh > --001a11c378a20ccbea04e5182f19--