Return-Path: X-Original-To: apmail-hbase-dev-archive@www.apache.org Delivered-To: apmail-hbase-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3E9DC104D8 for ; Fri, 28 Feb 2014 18:21:35 +0000 (UTC) Received: (qmail 82618 invoked by uid 500); 28 Feb 2014 18:21:33 -0000 Delivered-To: apmail-hbase-dev-archive@hbase.apache.org Received: (qmail 82548 invoked by uid 500); 28 Feb 2014 18:21:32 -0000 Mailing-List: contact dev-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list dev@hbase.apache.org Received: (qmail 82540 invoked by uid 99); 28 Feb 2014 18:21:32 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Feb 2014 18:21:32 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_HELO_PASS X-Spam-Check-By: apache.org Received-SPF: unknown (nike.apache.org: error in processing during lookup of clehene@adobe.com) Received: from [207.46.163.207] (HELO na01-bl2-obe.outbound.protection.outlook.com) (207.46.163.207) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Feb 2014 18:21:26 +0000 Received: from BLUPR02MB097.namprd02.prod.outlook.com (10.242.188.11) by BLUPR02MB453.namprd02.prod.outlook.com (10.141.81.141) with Microsoft SMTP Server (TLS) id 15.0.888.9; Fri, 28 Feb 2014 18:20:47 +0000 Received: from BLUPR02MB359.namprd02.prod.outlook.com (10.141.77.148) by BLUPR02MB097.namprd02.prod.outlook.com (10.242.188.11) with Microsoft SMTP Server (TLS) id 15.0.888.9; Fri, 28 Feb 2014 18:20:45 +0000 Received: from BLUPR02MB359.namprd02.prod.outlook.com ([10.141.77.148]) by BLUPR02MB359.namprd02.prod.outlook.com ([10.141.77.148]) with mapi id 15.00.0883.010; Fri, 28 Feb 2014 18:20:45 +0000 From: Cosmin Lehene To: "dev@hbase.apache.org" Subject: Re: Why doesn't KeyValue.equals/CellComparator compare the values? Thread-Topic: Why doesn't KeyValue.equals/CellComparator compare the values? Thread-Index: AQHPM2uAMcbfAX8Bl06YOtSggmNPQ5rIgpwAgADoSACAAQu8AA== Date: Fri, 28 Feb 2014 18:20:43 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-MacOutlook/14.3.9.131030 x-originating-ip: [192.150.10.207] x-forefront-prvs: 0136C1DDA4 x-forefront-antispam-report: SFV:NSPM;SFS:(10019001)(6009001)(428001)(199002)(189002)(51704005)(24454002)(377454003)(479174003)(164054003)(76104003)(54356001)(80976001)(65816001)(63696002)(87936001)(56776001)(83506001)(54316002)(74876001)(80022001)(66066001)(15975445006)(69226001)(51856001)(74706001)(76482001)(46102001)(81816001)(85852003)(83072002)(83322001)(19580395003)(19580405001)(90146001)(56816005)(77982001)(31966008)(59766001)(74662001)(47446002)(74502001)(79102001)(87266001)(81686001)(2656002)(76786001)(76796001)(92566001)(47976001)(50986001)(47736001)(95666003)(92726001)(36756003)(94316002)(94946001)(81542001)(85306002)(93516002)(95416001)(86362001)(93136001)(53806001)(74366001)(81342001)(4396001)(49866001);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR02MB097;H:BLUPR02MB359.namprd02.prod.outlook.com;CLIP:192.150.10.207;FPR:2C3BF2E4.2426DC09.33E1BF2B.8AD8F37D.20377;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (: adobe.com does not designate permitted sender hosts) Content-Type: text/plain; charset="iso-8859-1" Content-ID: <59C44A6FEC9634449A44AC70B49F0A40@namprd02.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: adobe.com X-Virus-Checked: Checked by ClamAV on apache.org Thanks Matt, Stack, My question/comment was biased by the perspective of a co-processor implementation, but I guess it may well apply for HBase development. >From that perspective you're both in HBase-land and Java-land. A collection of cells needs to be compared to another collection of cells (I=B9m doing a diff). Java collections will end up comparing individual objects for equality so it boils down to a Cell object being equal to another Cell object. So from a java/oo perspective the question is: are two cells with different values equal (I.e. Can I swap them?) The HBase answer is indeed yes they are equal as long as row, family, qualifier, timestamp and type are the same. The Java answer, however may be different (and hence the expectations of a developer) as, in general it will be based on the known contract. And the general hashCode contract is * If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result. And the equals javadoc * Note that it is generally necessary to override the {@code hashCode} * method whenever this method is overridden, so as to maintain the * general contract for the {@code hashCode} method, which states * that equal objects must have equal hash codes. But in our case, the object equality will pass but hash codes will be different (https://gist.github.com/clehene/9276434) It=B9s obvious why the behavior is as is in Hbase, so rather than nitpicking, I wonder whether this could be made obvious as it may help avoid some unexpected behaviors :) Thanks, Cosmin On 2/27/14, 10:22 AM, "Stack" wrote: >On Wed, Feb 26, 2014 at 8:31 PM, Matt Corgan wrote: >.... > >> But maybe one of the committers could add a sentence to emphasize that >> value is excluded. >> >> >We should underline that data is not considered comparing Cells >(KeyValues). Apart from the fact that it could make for some interesting >performance issues, the system isn't plumbed for dealing with coordinates >that differ in their value only. Rather, the mvcc/sequenceid is used >splitting Cells whose coordinates are otherwise the same). > >What was your expectation mighty Cosmin? What you think HBase should do >with values that differ in value only? > >Thanks, >St.Ack