Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
HBase, mail # user - Possibly unnecessary check in Result.getColumnLatest(byte[] family, byte[] qualifier)


Copy link to this message
-
Re: Possibly unnecessary check in Result.getColumnLatest(byte[] family, byte[] qualifier)
Ted Yu 2013-01-22, 23:19
KeyValue.KVComparator in 0.94 looks similar to that in trunk.

Here is the compare() method:

    public int compare(final KeyValue left, final KeyValue right) {

      int ret = getRawComparator().compare(left.getBuffer(),

          left.getOffset() + ROW_OFFSET, left.getKeyLength(),

          right.getBuffer(), right.getOffset() + ROW_OFFSET,

          right.getKeyLength());

      if (ret != 0) return ret;

      // Negate this comparison so later edits show up first

      return -Longs.compare(left.getMemstoreTS(), right.getMemstoreTS());

    }
On Tue, Jan 22, 2013 at 2:49 PM, anil gupta <[EMAIL PROTECTED]> wrote:

> Hi Ted,
>
> Maybe it is out of sync with trunk. Here is the svn link for Result.java in
> HBase0.94.3:
>
> http://svn.apache.org/repos/asf/hbase/tags/0.94.3/src/main/java/org/apache/hadoop/hbase/client/Result.java
>
> ~Anil
>
>
> On Tue, Jan 22, 2013 at 10:18 AM, Ted Yu <[EMAIL PROTECTED]> wrote:
>
> > I am looking at trunk code.
> >
> > binarySearch() calls this method:
> >
> >     int pos = Arrays.binarySearch(kvs, searchTerm, KeyValue.COMPARATOR);
> > Here is the compare() method of KVComparator:
> >
> >     public int compare(final KeyValue left, final KeyValue right) {
> >
> >       int ret = getRawComparator().compare(left.getBuffer(),
> >
> >           left.getOffset() + ROW_OFFSET, left.getKeyLength(),
> >
> >           right.getBuffer(), right.getOffset() + ROW_OFFSET,
> >
> >           right.getKeyLength());
> >
> >       if (ret != 0) return ret;
> >
> >       // Negate this comparison so later edits show up first
> >
> >       return -Longs.compare(left.getMemstoreTS(), right.getMemstoreTS());
> >
> >     }
> > I don't see duplicate check.
> >
> > Cheers
> >
> > On Tue, Jan 22, 2013 at 9:43 AM, anil gupta <[EMAIL PROTECTED]>
> wrote:
> >
> > > Hi All,
> > >
> > > I was looking into the code of Result.getColumnLatest(byte[] family,
> > byte[]
> > > qualifier) in HBase0.94.3 tag.
> > > I feel like the following check is unnecessary on line #245 since we
> have
> > > already got the right column by preforming binary search previously:
> > >     if (kv.matchingColumn(family, qualifier)) {
> > >       return kv;
> > >     }
> > >
> > > Am i missing something over here?
> > > --
> > > Thanks & Regards,
> > > Anil Gupta
> > >
> >
>
>
>
> --
> Thanks & Regards,
> Anil Gupta
>