Return-Path: X-Original-To: apmail-hadoop-user-archive@minotaur.apache.org Delivered-To: apmail-hadoop-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 13828F11D for ; Thu, 28 Mar 2013 05:14:07 +0000 (UTC) Received: (qmail 91760 invoked by uid 500); 28 Mar 2013 05:14:01 -0000 Delivered-To: apmail-hadoop-user-archive@hadoop.apache.org Received: (qmail 91555 invoked by uid 500); 28 Mar 2013 05:14:01 -0000 Mailing-List: contact user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hadoop.apache.org Delivered-To: mailing list user@hadoop.apache.org Received: (qmail 91440 invoked by uid 99); 28 Mar 2013 05:14:00 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Mar 2013 05:14:00 +0000 X-ASF-Spam-Status: No, hits=2.9 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [106.10.151.71] (HELO nm23-vm8.bullet.mail.sg3.yahoo.com) (106.10.151.71) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Mar 2013 05:13:53 +0000 Received: from [106.10.166.122] by nm23.bullet.mail.sg3.yahoo.com with NNFMP; 28 Mar 2013 05:13:29 -0000 Received: from [106.10.151.171] by tm11.bullet.mail.sg3.yahoo.com with NNFMP; 28 Mar 2013 05:13:29 -0000 Received: from [127.0.0.1] by omp1011.mail.sg3.yahoo.com with NNFMP; 28 Mar 2013 05:13:29 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 820859.11177.bm@omp1011.mail.sg3.yahoo.com Received: (qmail 75644 invoked by uid 60001); 28 Mar 2013 05:13:29 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.in; s=s1024; t=1364447609; bh=wrO/hER9NhmWSiQHkpCY6CqThvas/kPNkHmnhrWqmQ0=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=q2nTu52FqmbL7PlRRdi24b6+63N2ZxkIq60CVTeFm44qt3OYhLCqT+ibGO7jk/yrzngo5bubnCnLM7hbN8Wmt+GAE/TgPrGejQ9JRArkL+E7OVqIi/Npd2aNKRyUqtTwXnGmuHQKpImXDLZ/lFGTLqvmpPuoy0cwTRE0nsDISs4= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.in; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=q8U/Ax8zzX0ytSdaoFCKuwd1EE3FuqzhWw5+Z2Gf1BS7lWV+FB2FIrQlBi4+fvXOYVI+5Yy+oW+3L6ar9hr2Tndbx6itpaKuzesyofomU3RppwMHqhwDFxHQu0jQ0cqATKfyoTTd/9J9jWAaMQd0QlAkzqjNX98sn0nSHyyh4+U=; X-YMail-OSG: cb4gVLUVM1lhtzLMVoDyrd.jVPapWOFbiltZcpZ57NdpLNJ ZcyEfOIWkX8lqvSkJVLP4UVTIM0el3fXHlNRl9jK9OopWcuTIJH944hkQjcu qtIaVO.X72YPN_85yforwKMUY4AciMw1jfmt3rP0UfWDp0wJNIcw6RzfhHt9 VTWgji5xidrzab9_X1kxPb17wBr7qRRqIOSdmihPq8U6JKKjskbHHUhpxnVj qBtDuV3kFGb9i149qJfgFx6h376thVoenA_E43FM_yCiVUFOzB1yqqsuDpqX iWtLHnXcUhzbPZ13Zv7_KPetucV2TesNuQ7HqToa.QgsNhxBv1ctpmnpQYGR EXMGOZ2varT5nWmr0Nlz82b99DPBLe7gTJPrRnSs2Hx0qU71SLyCWLz.2k6j iaVqpMfAwclMW1bzB1XzupR2eG2agRGC1lemwC2IGbWyG Received: from [49.204.42.122] by web194706.mail.sg3.yahoo.com via HTTP; Thu, 28 Mar 2013 13:13:29 SGT X-Rocket-MIMEInfo: 002.001,CgpKdXN0IHdvbmRlcmluZyB3aGF0IGlzIHRoZSBkaWZmZXJlbmNlIGJldHdlZW4gc2VyaWFsaXplZCBjb21wYXJhdG9yIHZzIG5vcm1hbCBjb21wYXJhdG9yIGdpdmVuIGJlbG93LAp0aGUgcmVhc29uIGkgYW0gdHJ5aW5nIHRvIHVuZGVyc3RhbmQgdGhpcyBpcyBob3cgd2lsbCB5b3UgdmVyaWZ5IGlmIHlvdSByIHVzaW5nIHNlcmlhbGl6ZWQgY29tcGFyYXRvciBkdXJpbmcgZGVidWdnaW5nIGlmIHRoZSBjb21wYXJhdG9yIGlzwqAKd29ya2luZyBvciBub3QgYXMgd2hlbiB5b3UgZGVidWcgaW4gZWNsaXBzZSABMAEBAQE- X-Mailer: YahooMailWebService/0.8.139.530 References: <1364443310.25186.YahooMailNeo@web194706.mail.sg3.yahoo.com> <1364446865.81556.YahooMailNeo@web194701.mail.sg3.yahoo.com> Message-ID: <1364447609.73017.YahooMailNeo@web194706.mail.sg3.yahoo.com> Date: Thu, 28 Mar 2013 13:13:29 +0800 (SGT) From: Sai Sai Reply-To: Sai Sai Subject: Re: Serialized comparator vs normal comparator To: "user@hadoop.apache.org" In-Reply-To: <1364446865.81556.YahooMailNeo@web194701.mail.sg3.yahoo.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="-318360905-104059017-1364447609=:73017" X-Virus-Checked: Checked by ClamAV on apache.org ---318360905-104059017-1364447609=:73017 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable =0A=0AJust wondering what is the difference between serialized comparator v= s normal comparator given below,=0Athe reason i am trying to understand thi= s is how will you verify if you r using serialized comparator during debugg= ing if the comparator is=A0=0Aworking or not as when you debug in eclipse i= t shows byte info which cannot be understood by developers.=0A=0AHere r the= methods i am referring to:=0A=0A/** A Comparator that compares serialized = IntPair. */=A0=0A=A0 =A0 public static class Comparator extends WritableCom= parator {=0A=A0 =A0 =A0 public Comparator() {=0A=A0 =A0 =A0 =A0 super(IntPa= ir.class);=0A=A0 =A0 =A0 }=0A=0A=A0 =A0 =A0public int compare(byte[] b1, in= t s1, int l1,=0A=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0byte[] b= 2, int s2, int l2) {=0A=A0 =A0 =A0 =A0 return compareBytes(b1, s1, l1, b2, = s2, l2);=0A=A0 =A0 =A0 }=0A=A0 =A0 }=0A=0A=A0 =A0 static { =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0// register = this comparator=0A=A0 =A0 =A0 WritableComparator.define(IntPair.class, new = Comparator());=0A=A0 =A0 }=0A=0A=A0 =A0 @Override=0A=A0 =A0public int compa= reTo(IntPair o) {=0A=A0 =A0 =A0 if (first !=3D o.first) {=0A=A0 =A0 =A0 =A0= return first < o.first ? -1 : 1;=0A=A0 =A0 =A0 } else if (second !=3D o.se= cond) {=0A=A0 =A0 =A0 =A0 return second < o.second ? -1 : 1;=0A=A0 =A0 =A0 = } else {=0A=A0 =A0 =A0 =A0 return 0;=0A=A0 =A0 =A0 }=0A=A0 =A0 } ---318360905-104059017-1364447609=:73017 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable

<= /div>
Just wondering what is the difference between serialized = comparator vs normal comparator given below,
the reason i= am trying to understand this is how will you verify if you r using seriali= zed comparator during debugging if the comparator is 
working or not as when you debug in eclipse it shows byte info which can= not be understood by developers.

H= ere r the methods i am referring to:

/** A Comparator that compares serialized IntPair. */ 
<= div style=3D"background-color: transparent; ">    public static c= lass Comparator extends WritableComparator {
      public Comparator() {
        super(IntP= air.class);
  &nbs= p;   }

<= div style=3D"background-color: transparent; ">      public int compare(byte[] b1, int s1, int l1,
                &n= bsp;        byte[] b2, int s2, int l2) {
        return compareBytes(b1, s1, l1, b2, s2, l2= );
      }
    }

  &n= bsp; static {                  = ;                     &nb= sp;// register this comparator
      WritableComparator.define(IntPair.class, new C= omparator());
  &n= bsp; }

    @Override
    public int compareTo(IntPair o) {
 =     if (first !=3D o.first) {
      &nb= sp; return first < o.first ? -1 : 1;
    &n= bsp; } else if (second !=3D o.second) {
    &n= bsp;   return second < o.second ? -1 : 1;
 =     } else {
        retu= rn 0;
      }
    }
<= /html> ---318360905-104059017-1364447609=:73017--