Return-Path: X-Original-To: apmail-hadoop-common-issues-archive@minotaur.apache.org Delivered-To: apmail-hadoop-common-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DBA28E4C8 for ; Fri, 1 Feb 2013 17:14:15 +0000 (UTC) Received: (qmail 9327 invoked by uid 500); 1 Feb 2013 17:14:14 -0000 Delivered-To: apmail-hadoop-common-issues-archive@hadoop.apache.org Received: (qmail 9275 invoked by uid 500); 1 Feb 2013 17:14:14 -0000 Mailing-List: contact common-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-issues@hadoop.apache.org Delivered-To: mailing list common-issues@hadoop.apache.org Received: (qmail 9137 invoked by uid 99); 1 Feb 2013 17:14:14 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Feb 2013 17:14:14 +0000 Date: Fri, 1 Feb 2013 17:14:13 +0000 (UTC) From: "Karthik Kambatla (JIRA)" To: common-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (HADOOP-9124) SortedMapWritable violates contract of Map interface for equals() and hashCode() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HADOOP-9124?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Karthik Kambatla updated HADOOP-9124: ------------------------------------- Attachment: hadoop-9124-branch1.patch Thanks Tom for committing this. Suren - sorry for the delay. branch-1 is the dev branch for 1.x.y releases. Similarly, branch-2 is for 2.x.y. The directory structure for trunk, branch-2 and branch-0.23 is the same, but branch-1 is different. Hence, the need for a separate branch-1 patch. I have copied the changes from here verbatim to branch-1, verified the test passes. Suren - are you OK with this? Tom - can you commit this to branch-1? > SortedMapWritable violates contract of Map interface for equals() and hashCode() > -------------------------------------------------------------------------------- > > Key: HADOOP-9124 > URL: https://issues.apache.org/jira/browse/HADOOP-9124 > Project: Hadoop Common > Issue Type: Bug > Components: io > Affects Versions: 2.0.2-alpha > Reporter: Patrick Hunt > Assignee: Surenkumar Nihalani > Priority: Minor > Fix For: 2.0.3-alpha > > Attachments: hadoop-9124-branch1.patch, HADOOP-9124.patch, HADOOP-9124.patch, HADOOP-9124.patch, HADOOP-9124.patch, HADOOP-9124.patch, HADOOP-9124.patch, HADOOP-9124.patch, HADOOP-9124.patch, HADOOP-9124.patch, HADOOP-9124.patch > > > This issue is similar to HADOOP-7153. It was found when using MRUnit - see MRUNIT-158, specifically https://issues.apache.org/jira/browse/MRUNIT-158?focusedCommentId=13501985&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13501985 > -- > o.a.h.io.SortedMapWritable implements the java.util.Map interface, however it does not define an implementation of the equals() or hashCode() methods; instead the default implementations in java.lang.Object are used. > This violates the contract of the Map interface which defines different behaviour for equals() and hashCode() than Object does. More information here: http://download.oracle.com/javase/6/docs/api/java/util/Map.html#equals(java.lang.Object) > The practical consequence is that SortedMapWritables containing equal entries cannot be compared properly. We were bitten by this when trying to write an MRUnit test for a Mapper that outputs MapWritables; the MRUnit driver cannot test the equality of the expected and actual MapWritable objects. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira