You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by mike anderson <sa...@gmail.com> on 2009/06/11 22:25:10 UTC

Changing output class type

This is probably a straightforward question, but I've banging my head
against the wall with no results.

I've been working off of the RowCounter example as well as this great blog
post http://www.larsgeorge.com/2009/05/hbase-mapreduce-101-part-i.html, but
all to no avail.


What I'd like to do is change the output type from the map function within a
Class that implements TableMap. I tried changing the types in the template
for OutputCollector to Text and IntWritable (I also set the corresponding
class in the initTableMapJob() method), but this threw compiler errors (see
below). Do I need to write my own TableMap Interface?

As a secondary question, what is the default 'key' passed to the map method
from TableMap? The output from IdentityTableMap is something like "31 2e 66
69 72...", which appears to have no significant meaning, ascii character
translation or otherwise.


Thanks in advance for any help, links to other online references would be
very welcome (especially examples)!


Cheers,
Mike


compiler error:
IdentityMapTwo.java:42: org.myorg.IdentityMapTwo.MyMapper is not abstract
and does not override abstract method
map(org.apache.hadoop.hbase.io.ImmutableBytesWritable,org.apache.hadoop.hbase.io.RowResult,org.apache.hadoop.mapred.OutputCollector<org.apache.hadoop.hbase.io.ImmutableBytesWritable,org.apache.hadoop.hbase.io.RowResult>,org.apache.hadoop.mapred.Reporter)
in org.apache.hadoop.mapred.Mapper
  static class MyMapper

Re: Changing output class type

Posted by Billy Pearson <sa...@pearsonwholesale.com>.
have you tried something like this

public static class MapClass extends MapReduceBase implements TableMap<Text 
,IntWritable> {

}

as for the output of the maps that's the output from "31 2e 66> 69 72...",
that from org.apache.hadoop.hbase.io.ImmutableBytesWritable toString() 
method
if you want to System.out.println() the keys where there readable then you 
would need to do something like
Bytes.toString(row.get()) on the row/key

Billy




"mike anderson" <sa...@gmail.com> wrote 
in message 
news:2986c2f30906111325h7e6878e3raf941179988b7d08@mail.gmail.com...
> This is probably a straightforward question, but I've banging my head
> against the wall with no results.
>
> I've been working off of the RowCounter example as well as this great blog
> post http://www.larsgeorge.com/2009/05/hbase-mapreduce-101-part-i.html, 
> but
> all to no avail.
>
>
> What I'd like to do is change the output type from the map function within 
> a
> Class that implements TableMap. I tried changing the types in the template
> for OutputCollector to Text and IntWritable (I also set the corresponding
> class in the initTableMapJob() method), but this threw compiler errors 
> (see
> below). Do I need to write my own TableMap Interface?
>
> As a secondary question, what is the default 'key' passed to the map 
> method
> from TableMap? The output from IdentityTableMap is something like "31 2e 
> 66
> 69 72...", which appears to have no significant meaning, ascii character
> translation or otherwise.
>
>
> Thanks in advance for any help, links to other online references would be
> very welcome (especially examples)!
>
>
> Cheers,
> Mike
>
>
> compiler error:
> IdentityMapTwo.java:42: org.myorg.IdentityMapTwo.MyMapper is not abstract
> and does not override abstract method
> map(org.apache.hadoop.hbase.io.ImmutableBytesWritable,org.apache.hadoop.hbase.io.RowResult,org.apache.hadoop.mapred.OutputCollector<org.apache.hadoop.hbase.io.ImmutableBytesWritable,org.apache.hadoop.hbase.io.RowResult>,org.apache.hadoop.mapred.Reporter)
> in org.apache.hadoop.mapred.Mapper
>  static class MyMapper
>