You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Mark Kerzner <ma...@gmail.com> on 2011/01/27 06:10:26 UTC

New java construct? NavigableMap>> map = result.getMap();

Hi, I found this construct on the blog here,
http://allaboutdata.net/blog/?p=38, and I have no idea what it means. But
the documentation supports this and says

getMap

public NavigableMap<byte[],NavigableMap<byte[],NavigableMap<Long,byte[]>>>
getMap()
Map of families to all versions of its qualifiers and values.
Returns a three level Map of the form: Map>>

this one, here,
http://hbase.apache.org/docs/r0.20.5/api/org/apache/hadoop/hbase/client/Result.html#getMap()

It does NOT compile for me :)

Thank you.

Re: New java construct? NavigableMap>> map = result.getMap();

Posted by Ted Yu <yu...@gmail.com>.
You can start with:
./src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormat.java
./src/main/java/org/apache/hadoop/hbase/mapreduce/TableInputFormat.java
./src/test/java/org/apache/hadoop/hbase/mapreduce/NMapInputFormat.java

On Wed, Jan 26, 2011 at 9:41 PM, Mark Kerzner <ma...@gmail.com> wrote:

> Thank you, Ted. I see.
>
> What is a good example of reading HBase from a MR job?
>
> On Wed, Jan 26, 2011 at 11:35 PM, Ted Yu <yu...@gmail.com> wrote:
>
> > Just replace 'NavigableMap>>' with:
> >
> > NavigableMap<byte[], NavigableMap<byte[], NavigableMap<Long, byte[]>>>
> >
> > Take a look at the source code in Result.java
> >
> > On Wed, Jan 26, 2011 at 9:26 PM, Mark Kerzner <ma...@gmail.com>
> > wrote:
> >
> > > Sure. At this line
> > >
> > > NavigableMap>> map =
> > >                        value
> > >                        .getMap();
> > >
> > > I get this:
> > >
> > > cannot find symbol
> > >  symbol:   variable NavigableMap
> > >  location: class com.mypackage.hadoop.HBaseUniqueVisitsMapper
> > >
> > > cannot find symbol
> > >  symbol:   variable map
> > >  location: class com.mypackage.hadoop.HBaseUniqueVisitsMapper
> > >
> > > unexpected type
> > >  required: variable
> > >  found:    value
> > >
> > > On Wed, Jan 26, 2011 at 11:20 PM, Ted Yu <yu...@gmail.com> wrote:
> > >
> > > > This is not new Java construct.
> > > >
> > > > Can you show us the compilation error ?
> > > >
> > > > On Wed, Jan 26, 2011 at 9:10 PM, Mark Kerzner <markkerzner@gmail.com
> >
> > > > wrote:
> > > >
> > > > > Hi, I found this construct on the blog here,
> > > > > http://allaboutdata.net/blog/?p=38, and I have no idea what it
> > means.
> > > > But
> > > > > the documentation supports this and says
> > > > >
> > > > > getMap
> > > > >
> > > > > public
> > > > NavigableMap<byte[],NavigableMap<byte[],NavigableMap<Long,byte[]>>>
> > > > > getMap()
> > > > > Map of families to all versions of its qualifiers and values.
> > > > > Returns a three level Map of the form: Map>>
> > > > >
> > > > > this one, here,
> > > > >
> > > > >
> > > >
> > >
> >
> http://hbase.apache.org/docs/r0.20.5/api/org/apache/hadoop/hbase/client/Result.html#getMap()<http://hbase.apache.org/docs/r0.20.5/api/org/apache/hadoop/hbase/client/Result.html#getMap%28%29>
> > <
> >
> http://hbase.apache.org/docs/r0.20.5/api/org/apache/hadoop/hbase/client/Result.html#getMap%28%29
> > >
> > > > <
> > > >
> > >
> >
> http://hbase.apache.org/docs/r0.20.5/api/org/apache/hadoop/hbase/client/Result.html#getMap%28%29
> > > > >
> > > > >
> > > > > It does NOT compile for me :)
> > > > >
> > > > > Thank you.
> > > > >
> > > >
> > >
> >
>

Re: New java construct? NavigableMap>> map = result.getMap();

Posted by Mark Kerzner <ma...@gmail.com>.
Thank you, Ted. I see.

What is a good example of reading HBase from a MR job?

On Wed, Jan 26, 2011 at 11:35 PM, Ted Yu <yu...@gmail.com> wrote:

> Just replace 'NavigableMap>>' with:
>
> NavigableMap<byte[], NavigableMap<byte[], NavigableMap<Long, byte[]>>>
>
> Take a look at the source code in Result.java
>
> On Wed, Jan 26, 2011 at 9:26 PM, Mark Kerzner <ma...@gmail.com>
> wrote:
>
> > Sure. At this line
> >
> > NavigableMap>> map =
> >                        value
> >                        .getMap();
> >
> > I get this:
> >
> > cannot find symbol
> >  symbol:   variable NavigableMap
> >  location: class com.mypackage.hadoop.HBaseUniqueVisitsMapper
> >
> > cannot find symbol
> >  symbol:   variable map
> >  location: class com.mypackage.hadoop.HBaseUniqueVisitsMapper
> >
> > unexpected type
> >  required: variable
> >  found:    value
> >
> > On Wed, Jan 26, 2011 at 11:20 PM, Ted Yu <yu...@gmail.com> wrote:
> >
> > > This is not new Java construct.
> > >
> > > Can you show us the compilation error ?
> > >
> > > On Wed, Jan 26, 2011 at 9:10 PM, Mark Kerzner <ma...@gmail.com>
> > > wrote:
> > >
> > > > Hi, I found this construct on the blog here,
> > > > http://allaboutdata.net/blog/?p=38, and I have no idea what it
> means.
> > > But
> > > > the documentation supports this and says
> > > >
> > > > getMap
> > > >
> > > > public
> > > NavigableMap<byte[],NavigableMap<byte[],NavigableMap<Long,byte[]>>>
> > > > getMap()
> > > > Map of families to all versions of its qualifiers and values.
> > > > Returns a three level Map of the form: Map>>
> > > >
> > > > this one, here,
> > > >
> > > >
> > >
> >
> http://hbase.apache.org/docs/r0.20.5/api/org/apache/hadoop/hbase/client/Result.html#getMap()
> <
> http://hbase.apache.org/docs/r0.20.5/api/org/apache/hadoop/hbase/client/Result.html#getMap%28%29
> >
> > > <
> > >
> >
> http://hbase.apache.org/docs/r0.20.5/api/org/apache/hadoop/hbase/client/Result.html#getMap%28%29
> > > >
> > > >
> > > > It does NOT compile for me :)
> > > >
> > > > Thank you.
> > > >
> > >
> >
>

Re: New java construct? NavigableMap>> map = result.getMap();

Posted by Ted Yu <yu...@gmail.com>.
Just replace 'NavigableMap>>' with:

NavigableMap<byte[], NavigableMap<byte[], NavigableMap<Long, byte[]>>>

Take a look at the source code in Result.java

On Wed, Jan 26, 2011 at 9:26 PM, Mark Kerzner <ma...@gmail.com> wrote:

> Sure. At this line
>
> NavigableMap>> map =
>                        value
>                        .getMap();
>
> I get this:
>
> cannot find symbol
>  symbol:   variable NavigableMap
>  location: class com.mypackage.hadoop.HBaseUniqueVisitsMapper
>
> cannot find symbol
>  symbol:   variable map
>  location: class com.mypackage.hadoop.HBaseUniqueVisitsMapper
>
> unexpected type
>  required: variable
>  found:    value
>
> On Wed, Jan 26, 2011 at 11:20 PM, Ted Yu <yu...@gmail.com> wrote:
>
> > This is not new Java construct.
> >
> > Can you show us the compilation error ?
> >
> > On Wed, Jan 26, 2011 at 9:10 PM, Mark Kerzner <ma...@gmail.com>
> > wrote:
> >
> > > Hi, I found this construct on the blog here,
> > > http://allaboutdata.net/blog/?p=38, and I have no idea what it means.
> > But
> > > the documentation supports this and says
> > >
> > > getMap
> > >
> > > public
> > NavigableMap<byte[],NavigableMap<byte[],NavigableMap<Long,byte[]>>>
> > > getMap()
> > > Map of families to all versions of its qualifiers and values.
> > > Returns a three level Map of the form: Map>>
> > >
> > > this one, here,
> > >
> > >
> >
> http://hbase.apache.org/docs/r0.20.5/api/org/apache/hadoop/hbase/client/Result.html#getMap()<http://hbase.apache.org/docs/r0.20.5/api/org/apache/hadoop/hbase/client/Result.html#getMap%28%29>
> > <
> >
> http://hbase.apache.org/docs/r0.20.5/api/org/apache/hadoop/hbase/client/Result.html#getMap%28%29
> > >
> > >
> > > It does NOT compile for me :)
> > >
> > > Thank you.
> > >
> >
>

Re: New java construct? NavigableMap>> map = result.getMap();

Posted by Mark Kerzner <ma...@gmail.com>.
Sure. At this line

NavigableMap>> map =
                        value
                        .getMap();

I get this:

cannot find symbol
  symbol:   variable NavigableMap
  location: class com.mypackage.hadoop.HBaseUniqueVisitsMapper

cannot find symbol
  symbol:   variable map
  location: class com.mypackage.hadoop.HBaseUniqueVisitsMapper

unexpected type
  required: variable
  found:    value

On Wed, Jan 26, 2011 at 11:20 PM, Ted Yu <yu...@gmail.com> wrote:

> This is not new Java construct.
>
> Can you show us the compilation error ?
>
> On Wed, Jan 26, 2011 at 9:10 PM, Mark Kerzner <ma...@gmail.com>
> wrote:
>
> > Hi, I found this construct on the blog here,
> > http://allaboutdata.net/blog/?p=38, and I have no idea what it means.
> But
> > the documentation supports this and says
> >
> > getMap
> >
> > public
> NavigableMap<byte[],NavigableMap<byte[],NavigableMap<Long,byte[]>>>
> > getMap()
> > Map of families to all versions of its qualifiers and values.
> > Returns a three level Map of the form: Map>>
> >
> > this one, here,
> >
> >
> http://hbase.apache.org/docs/r0.20.5/api/org/apache/hadoop/hbase/client/Result.html#getMap()
> <
> http://hbase.apache.org/docs/r0.20.5/api/org/apache/hadoop/hbase/client/Result.html#getMap%28%29
> >
> >
> > It does NOT compile for me :)
> >
> > Thank you.
> >
>

Re: New java construct? NavigableMap>> map = result.getMap();

Posted by Ted Yu <yu...@gmail.com>.
This is not new Java construct.

Can you show us the compilation error ?

On Wed, Jan 26, 2011 at 9:10 PM, Mark Kerzner <ma...@gmail.com> wrote:

> Hi, I found this construct on the blog here,
> http://allaboutdata.net/blog/?p=38, and I have no idea what it means. But
> the documentation supports this and says
>
> getMap
>
> public NavigableMap<byte[],NavigableMap<byte[],NavigableMap<Long,byte[]>>>
> getMap()
> Map of families to all versions of its qualifiers and values.
> Returns a three level Map of the form: Map>>
>
> this one, here,
>
> http://hbase.apache.org/docs/r0.20.5/api/org/apache/hadoop/hbase/client/Result.html#getMap()<http://hbase.apache.org/docs/r0.20.5/api/org/apache/hadoop/hbase/client/Result.html#getMap%28%29>
>
> It does NOT compile for me :)
>
> Thank you.
>

Re: New java construct? NavigableMap>> map = result.getMap();

Posted by Mark Kerzner <ma...@gmail.com>.
Thank you, I did :)

What is a good example of reading HBase from a MR job?

Mark

On Wed, Jan 26, 2011 at 11:32 PM, Ted Dunning <td...@maprtech.com> wrote:

> The blog code is hash.  My guess is that the blog software misinterpreted
> some of the code as markup and ate it.  Here are some example of chewed up
> lines.
>
> Ask the author for a fix.
>
>
> System.out.println(String.format("Number of elements in the result :
> %s",result.size()));
>            NavigableMap>> map = result.getMap();
>            for(Entry>> columnFamilyEntry : map.entrySet()){
>                NavigableMap> columnMap = columnFamilyEntry.getValue();
>
> On Wed, Jan 26, 2011 at 9:10 PM, Mark Kerzner <ma...@gmail.com>
> wrote:
>
> > Hi, I found this construct on the blog here,
> > http://allaboutdata.net/blog/?p=38, and I have no idea what it means.
> But
> > the documentation supports this and says
> >
> > getMap
> >
> > public
> NavigableMap<byte[],NavigableMap<byte[],NavigableMap<Long,byte[]>>>
> > getMap()
> > Map of families to all versions of its qualifiers and values.
> > Returns a three level Map of the form: Map>>
> >
> > this one, here,
> >
> >
> http://hbase.apache.org/docs/r0.20.5/api/org/apache/hadoop/hbase/client/Result.html#getMap()
> >
> > It does NOT compile for me :)
> >
> > Thank you.
> >
>

Re: New java construct? NavigableMap>> map = result.getMap();

Posted by Ted Dunning <td...@maprtech.com>.
The blog code is hash.  My guess is that the blog software misinterpreted
some of the code as markup and ate it.  Here are some example of chewed up
lines.

Ask the author for a fix.


System.out.println(String.format("Number of elements in the result :
%s",result.size()));
            NavigableMap>> map = result.getMap();
            for(Entry>> columnFamilyEntry : map.entrySet()){
                NavigableMap> columnMap = columnFamilyEntry.getValue();

On Wed, Jan 26, 2011 at 9:10 PM, Mark Kerzner <ma...@gmail.com> wrote:

> Hi, I found this construct on the blog here,
> http://allaboutdata.net/blog/?p=38, and I have no idea what it means. But
> the documentation supports this and says
>
> getMap
>
> public NavigableMap<byte[],NavigableMap<byte[],NavigableMap<Long,byte[]>>>
> getMap()
> Map of families to all versions of its qualifiers and values.
> Returns a three level Map of the form: Map>>
>
> this one, here,
>
> http://hbase.apache.org/docs/r0.20.5/api/org/apache/hadoop/hbase/client/Result.html#getMap()
>
> It does NOT compile for me :)
>
> Thank you.
>