crunch-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwi...@apache.org
Subject git commit: CRUNCH-253: Make the sourceTarget API calls on ParallelDoOptions and GroupingOptions consistent
Date Sat, 17 Aug 2013 22:15:59 GMT
Updated Branches:
  refs/heads/master 3a377e029 -> 028fa14b7


CRUNCH-253: Make the sourceTarget API calls on ParallelDoOptions and GroupingOptions consistent


Project: http://git-wip-us.apache.org/repos/asf/crunch/repo
Commit: http://git-wip-us.apache.org/repos/asf/crunch/commit/028fa14b
Tree: http://git-wip-us.apache.org/repos/asf/crunch/tree/028fa14b
Diff: http://git-wip-us.apache.org/repos/asf/crunch/diff/028fa14b

Branch: refs/heads/master
Commit: 028fa14b7edc631d1250acb65a11fa2b770e7241
Parents: 3a377e0
Author: Josh Wills <jwills@apache.org>
Authored: Fri Aug 16 08:53:15 2013 -0700
Committer: Josh Wills <jwills@apache.org>
Committed: Fri Aug 16 08:53:15 2013 -0700

----------------------------------------------------------------------
 .../java/org/apache/crunch/GroupingOptions.java    | 17 +++++++++++++++--
 .../java/org/apache/crunch/ParallelDoOptions.java  |  8 +++++++-
 .../src/main/java/org/apache/crunch/lib/Sort.java  |  2 +-
 3 files changed, 23 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/crunch/blob/028fa14b/crunch-core/src/main/java/org/apache/crunch/GroupingOptions.java
----------------------------------------------------------------------
diff --git a/crunch-core/src/main/java/org/apache/crunch/GroupingOptions.java b/crunch-core/src/main/java/org/apache/crunch/GroupingOptions.java
index 4aa1343..baaecdc 100644
--- a/crunch-core/src/main/java/org/apache/crunch/GroupingOptions.java
+++ b/crunch-core/src/main/java/org/apache/crunch/GroupingOptions.java
@@ -17,6 +17,8 @@
  */
 package org.apache.crunch;
 
+import java.util.Collection;
+import java.util.Collections;
 import java.util.Map;
 import java.util.Set;
 
@@ -153,12 +155,23 @@ public class GroupingOptions {
       this.extraConf.put(confKey, confValue);
       return this;
     }
-    
+
+    @Deprecated
     public Builder sourceTarget(SourceTarget<?> st) {
       this.sourceTargets.add(st);
       return this;
     }
-    
+
+    public Builder sourceTargets(SourceTarget<?>... st) {
+      Collections.addAll(this.sourceTargets, st);
+      return this;
+    }
+
+    public Builder sourceTargets(Collection<SourceTarget<?>> st) {
+      this.sourceTargets.addAll(st);
+      return this;
+    }
+
     public GroupingOptions build() {
       return new GroupingOptions(partitionerClass, groupingComparatorClass, sortComparatorClass,
           numReducers, extraConf, sourceTargets);

http://git-wip-us.apache.org/repos/asf/crunch/blob/028fa14b/crunch-core/src/main/java/org/apache/crunch/ParallelDoOptions.java
----------------------------------------------------------------------
diff --git a/crunch-core/src/main/java/org/apache/crunch/ParallelDoOptions.java b/crunch-core/src/main/java/org/apache/crunch/ParallelDoOptions.java
index 2407b3a..b02fc9c 100644
--- a/crunch-core/src/main/java/org/apache/crunch/ParallelDoOptions.java
+++ b/crunch-core/src/main/java/org/apache/crunch/ParallelDoOptions.java
@@ -17,6 +17,7 @@
  */
 package org.apache.crunch;
 
+import java.util.Collection;
 import java.util.Collections;
 import java.util.Set;
 
@@ -54,7 +55,12 @@ public class ParallelDoOptions {
       Collections.addAll(this.sourceTargets, sourceTargets);
       return this;
     }
-    
+
+    public Builder sourceTargets(Collection<SourceTarget<?>> sourceTargets) {
+      this.sourceTargets.addAll(sourceTargets);
+      return this;
+    }
+
     public ParallelDoOptions build() {
       return new ParallelDoOptions(sourceTargets);
     }

http://git-wip-us.apache.org/repos/asf/crunch/blob/028fa14b/crunch-core/src/main/java/org/apache/crunch/lib/Sort.java
----------------------------------------------------------------------
diff --git a/crunch-core/src/main/java/org/apache/crunch/lib/Sort.java b/crunch-core/src/main/java/org/apache/crunch/lib/Sort.java
index 60c1b85..1228617 100644
--- a/crunch-core/src/main/java/org/apache/crunch/lib/Sort.java
+++ b/crunch-core/src/main/java/org/apache/crunch/lib/Sort.java
@@ -285,7 +285,7 @@ public class Sort {
       Iterable<K> iter = Sample.reservoirSample(ptable.keys(), numReducers - 1).materialize();
       MaterializableIterable<K> mi = (MaterializableIterable<K>) iter;
       if (mi.isSourceTarget()) {
-        builder.sourceTarget((SourceTarget) mi.getSource());
+        builder.sourceTargets((SourceTarget) mi.getSource());
       }
       builder.partitionerClass(TotalOrderPartitioner.class);
       builder.conf(TotalOrderPartitioner.PARTITIONER_PATH, mi.getPath().toString());


Mime
View raw message