hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ramkrishna vasudevan <ramkrishna.s.vasude...@gmail.com>
Subject Re: What is replacement of kv.getBuffer() in HBase0.98?
Date Tue, 05 Aug 2014 05:19:22 GMT
Hi Anil
As we have moved to the concept of Cells getBuffer() no longer applies to
it  But you could use getRowArray, getFamilyArray, getQualifierArray
anything to do what getBuffer() does. It is less intuitive but in terms of
cells we expect the KV to have its individual components backed by
individual byte arrays(row, cf, q, val) etc.

But what I expect is in your code you would try to extract row, cf, qual
etc. by using kv.getBuffer.  The same can be done even now.

For eg, to extract the family out of the row key you could use
cell.getFamilyarray(), cell.getFamilyOffset(), cell.getFamilyLength().
So it would be
Bytes.equals(columnFamily, 0, columnFamily.length, cell.getFamilyArray(),
cell.getFamilyOffset(),
                                cell.getFamilyLength())))

Regards
Ram


On Mon, Aug 4, 2014 at 9:56 PM, anil gupta <anilgupta84@gmail.com> wrote:

> Hi Ted,
>
> This will return entire backing bytes array just like keyValue.getBuffer()?
> By the documentation i thought its returning some file name :
> byte[] *getFamilyArray
> <
> https://hbase.apache.org/apidocs/org/apache/hadoop/hbase/Cell.html#getFamilyArray%28%29
> >*
> ()
> Contiguous bytes composed of legal HDFS filename characters which may start
> at any index in the containing array.
>
> IMHO, this method name is not as intuitive as "getBuffer".
>
> Thanks,
> Anil
>
>
>
> On Mon, Aug 4, 2014 at 9:32 PM, Ted Yu <yuzhihong@gmail.com> wrote:
>
> > Take a look at this method in Cell:
> >
> >   byte[] getFamilyArray();
> >
> > Cheers
> >
> >
> > On Mon, Aug 4, 2014 at 9:26 PM, anil gupta <anilgupta84@gmail.com>
> wrote:
> >
> > > I have been using KeyValues.getBuffer() very heavily in my HBase0.94
> > code.
> > > This method is not present in 0.98. What is the equivalent of
> > > KeyValues.getBuffer() in Cell?
> > > I am trying to avoid doing ArrayCopy of CF just for doing comparison.
> > >
> > > What would be equivalent for this code in 0.98?
> > > Bytes.equals(columnFamily, 0, columnFamily.length,
> keyvalue.getBuffer(),
> > > keyvalue.getFamilyOffset(),
> > >                                 keyvalue.getFamilyLength())))
> > >
> > > Maybe this?
> > > Bytes.equals(columnFamily, 0, columnFamily.length, cell.getBuffer(),
> > > cell.getFamilyOffset(),
> > >                                 cell.getFamilyLength())))
> > >
> > > --
> > > Thanks & Regards,
> > > Anil Gupta
> > >
> >
>
>
>
> --
> Thanks & Regards,
> Anil Gupta
>

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