Return-Path: X-Original-To: apmail-hadoop-mapreduce-issues-archive@minotaur.apache.org Delivered-To: apmail-hadoop-mapreduce-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 762F442FF for ; Thu, 19 May 2011 20:56:28 +0000 (UTC) Received: (qmail 26914 invoked by uid 500); 19 May 2011 20:56:28 -0000 Delivered-To: apmail-hadoop-mapreduce-issues-archive@hadoop.apache.org Received: (qmail 26877 invoked by uid 500); 19 May 2011 20:56:28 -0000 Mailing-List: contact mapreduce-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: mapreduce-issues@hadoop.apache.org Delivered-To: mailing list mapreduce-issues@hadoop.apache.org Received: (qmail 26867 invoked by uid 99); 19 May 2011 20:56:28 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 May 2011 20:56:28 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 May 2011 20:56:27 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 8ACC0D1FC8 for ; Thu, 19 May 2011 20:55:47 +0000 (UTC) Date: Thu, 19 May 2011 20:55:47 +0000 (UTC) From: "Chris Douglas (JIRA)" To: mapreduce-issues@hadoop.apache.org Message-ID: <1021252607.28116.1305838547565.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <877252435.27250.1305824567588.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (MAPREDUCE-2520) InputSampler.RandomSampler only accepts Text keys 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/MAPREDUCE-2520?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13036450#comment-13036450 ] Chris Douglas commented on MAPREDUCE-2520: ------------------------------------------ Which version of Hadoop are you using? I don't see this error in [0.20|http://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20/src/mapred/org/apache/hadoop/mapred/lib/InputSampler.java], [0.21|http://svn.apache.org/repos/asf/hadoop/mapreduce/branches/branch-0.21/src/java/org/apache/hadoop/mapreduce/lib/partition/InputSampler.java], or [trunk|http://svn.apache.org/repos/asf/hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapreduce/lib/partition/InputSampler.java]. > InputSampler.RandomSampler only accepts Text keys > ------------------------------------------------- > > Key: MAPREDUCE-2520 > URL: https://issues.apache.org/jira/browse/MAPREDUCE-2520 > Project: Hadoop Map/Reduce > Issue Type: Bug > Reporter: William McNeill > Priority: Minor > > I want to do a total sort on some data whose key type is Writable but not Text. I wrote an InputSampler.RandomSampler object following the example in the "Total Sort" section of Hadoop: The Definitive Guide. When I call InputSampler.writePartitionFile() I get a runtime class cast exception because my key type cannot be cast to Text. Specifically the issue seems to be the following section of InputSampler.getSample(): > K key = reader.getCurrentKey(); > .... > Text keyCopy = WritableUtils.clone((Text)key, job.getConfiguration()); > You can only use a RandomSampler on data with Text keys despite the fact that InputSampler takes generic parameters. > InputSampler.getSample() should be changed to cast the key to type K instead of type Text. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira