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, 18:18
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
>