hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kim Chew <kchew...@gmail.com>
Subject Re: KeyValue.getLength() question
Date Wed, 25 Sep 2013 17:12:57 GMT
hmm, does it mean if I do something like this, I won't get the correct
KeyValue object back?

byte[] rowKey = kv.getRow();
byte[] buf = kv.getBuffer();
KeyValue myKv = new KeyValue(buf);
byte[] myRowKey = myKv.getRow();

rowKey will not be equal to myRowKey.

Kim


On Wed, Sep 25, 2013 at 12:13 AM, Robert Dyer <rdyer@iastate.edu> wrote:

> Note that the buffer may be larger than the actually used portion.
>
> myKV.getBuffer().length gives you the length of the buffer (allocated
> array)
> myKV.getLength() gives you the length of the USED buffer (less than or
> equal to the previous)
>
>
> On Wed, Sep 25, 2013 at 2:06 AM, Kim Chew <kchew534@gmail.com> wrote:
>
> > Hello,
> >
> > I have a "strange" situation that I can't wrap my head around it. Say,
> for
> > example, I have an KeyValue instance, shouldn't
> >
> >     myKV.getLength() == myKV.getBuffer().length ?
> >
> > Given that, "getLength()" returns "Length of bytes this KeyValue occupies
> > in getBuffer()<
> >
> http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/KeyValue.html#getBuffer%28%29
> > >
> > ."
> >
> >
> > In my case the value returned by "myKV.getBuffer().length" is greater
> than
> > "myKV.getLength()". What possibly went wrong?
> >
> > TIA
> >
> > Kim.
> >
>
>
>
> --
>
> Robert Dyer
> rdyer@iastate.edu
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message