Return-Path: X-Original-To: apmail-incubator-hama-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-hama-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 12876968B for ; Thu, 10 Nov 2011 13:17:07 +0000 (UTC) Received: (qmail 57489 invoked by uid 500); 10 Nov 2011 13:17:07 -0000 Delivered-To: apmail-incubator-hama-commits-archive@incubator.apache.org Received: (qmail 57465 invoked by uid 500); 10 Nov 2011 13:17:07 -0000 Mailing-List: contact hama-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hama-dev@incubator.apache.org Delivered-To: mailing list hama-commits@incubator.apache.org Received: (qmail 57457 invoked by uid 99); 10 Nov 2011 13:17:07 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Nov 2011 13:17:06 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Nov 2011 13:17:04 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 48FDE23889CB; Thu, 10 Nov 2011 13:16:43 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1200322 - in /incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp: BSPJobClient.java FileInputFormat.java Date: Thu, 10 Nov 2011 13:16:43 -0000 To: hama-commits@incubator.apache.org From: tjungblut@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111110131643.48FDE23889CB@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tjungblut Date: Thu Nov 10 13:16:42 2011 New Revision: 1200322 URL: http://svn.apache.org/viewvc?rev=1200322&view=rev Log: Fix for partitioning Modified: incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPJobClient.java incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/FileInputFormat.java Modified: incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPJobClient.java URL: http://svn.apache.org/viewvc/incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPJobClient.java?rev=1200322&r1=1200321&r2=1200322&view=diff ============================================================================== --- incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPJobClient.java (original) +++ incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPJobClient.java Thu Nov 10 13:16:42 2011 @@ -451,7 +451,7 @@ public class BSPJobClient extends Config Object key = recordReader.createKey(); Object value = recordReader.createValue(); while (recordReader.next(key, value)) { - int index = partitioner.getPartition(key, value, numOfTasks); + int index = Math.abs(partitioner.getPartition(key, value, numOfTasks)); writers.get(index).append(key, value); } LOG.debug("Done with split " + i); Modified: incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/FileInputFormat.java URL: http://svn.apache.org/viewvc/incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/FileInputFormat.java?rev=1200322&r1=1200321&r2=1200322&view=diff ============================================================================== --- incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/FileInputFormat.java (original) +++ incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/FileInputFormat.java Thu Nov 10 13:16:42 2011 @@ -185,12 +185,21 @@ public abstract class FileInputFormat splits = new ArrayList(numSplits); + // take the short circuit path if we have already partitioned + if (numSplits == files.length) { + for (FileStatus file : files) { + splits.add(new FileSplit(file.getPath(), 0, file.getLen(), + new String[0])); + } + return splits.toArray(new FileSplit[splits.size()]); + } + long goalSize = totalSize / (numSplits == 0 ? 1 : numSplits); long minSize = Math.max(job.getConf().getLong("bsp.min.split.size", 1), minSplitSize); // generate splits - ArrayList splits = new ArrayList(numSplits); NetworkTopology clusterMap = new NetworkTopology(); for (FileStatus file : files) { Path path = file.getPath(); @@ -255,8 +264,8 @@ public abstract class FileInputFormat