crunch-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwi...@apache.org
Subject git commit: CRUNCH-179: Add a nicer union() interface for PCollection and PTable.
Date Thu, 07 Mar 2013 23:23:12 GMT
Updated Branches:
  refs/heads/master 9b0b9eb63 -> 913d76718


CRUNCH-179: Add a nicer union() interface for PCollection and PTable.


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

Branch: refs/heads/master
Commit: 913d767184b250c1c8f1b37d1a7e478cddcea172
Parents: 9b0b9eb
Author: Josh Wills <jwills@apache.org>
Authored: Wed Mar 6 15:28:12 2013 -0800
Committer: Josh Wills <jwills@apache.org>
Committed: Thu Mar 7 15:22:42 2013 -0800

----------------------------------------------------------------------
 .../main/java/org/apache/crunch/PCollection.java   |    6 ++++++
 crunch/src/main/java/org/apache/crunch/PTable.java |    7 +++++++
 .../crunch/impl/mem/collect/MemCollection.java     |    5 +++++
 .../apache/crunch/impl/mem/collect/MemTable.java   |    5 +++++
 .../crunch/impl/mr/collect/PCollectionImpl.java    |    5 +++++
 .../apache/crunch/impl/mr/collect/PTableBase.java  |    5 +++++
 6 files changed, 33 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/crunch/blob/913d7671/crunch/src/main/java/org/apache/crunch/PCollection.java
----------------------------------------------------------------------
diff --git a/crunch/src/main/java/org/apache/crunch/PCollection.java b/crunch/src/main/java/org/apache/crunch/PCollection.java
index 1783677..6f5abf6 100644
--- a/crunch/src/main/java/org/apache/crunch/PCollection.java
+++ b/crunch/src/main/java/org/apache/crunch/PCollection.java
@@ -36,6 +36,12 @@ public interface PCollection<S> {
 
   /**
    * Returns a {@code PCollection} instance that acts as the union of this
+   * {@code PCollection} and the given {@code PCollection}.
+   */
+  PCollection<S> union(PCollection<S> other);
+  
+  /**
+   * Returns a {@code PCollection} instance that acts as the union of this
    * {@code PCollection} and the input {@code PCollection}s.
    */
   PCollection<S> union(PCollection<S>... collections);

http://git-wip-us.apache.org/repos/asf/crunch/blob/913d7671/crunch/src/main/java/org/apache/crunch/PTable.java
----------------------------------------------------------------------
diff --git a/crunch/src/main/java/org/apache/crunch/PTable.java b/crunch/src/main/java/org/apache/crunch/PTable.java
index b32bd80..8df9853 100644
--- a/crunch/src/main/java/org/apache/crunch/PTable.java
+++ b/crunch/src/main/java/org/apache/crunch/PTable.java
@@ -29,6 +29,13 @@ import org.apache.crunch.types.PType;
  *
  */
 public interface PTable<K, V> extends PCollection<Pair<K, V>> {
+
+  /**
+   Returns a {@code PTable} instance that acts as the union of this
+   * {@code PTable} and the other {@code PTable}s.
+   */
+  PTable<K, V> union(PTable<K, V> other);
+  
   /**
    * Returns a {@code PTable} instance that acts as the union of this
    * {@code PTable} and the input {@code PTable}s.

http://git-wip-us.apache.org/repos/asf/crunch/blob/913d7671/crunch/src/main/java/org/apache/crunch/impl/mem/collect/MemCollection.java
----------------------------------------------------------------------
diff --git a/crunch/src/main/java/org/apache/crunch/impl/mem/collect/MemCollection.java b/crunch/src/main/java/org/apache/crunch/impl/mem/collect/MemCollection.java
index b1d6be5..da7c798 100644
--- a/crunch/src/main/java/org/apache/crunch/impl/mem/collect/MemCollection.java
+++ b/crunch/src/main/java/org/apache/crunch/impl/mem/collect/MemCollection.java
@@ -78,6 +78,11 @@ public class MemCollection<S> implements PCollection<S> {
   }
 
   @Override
+  public PCollection<S> union(PCollection<S> other) {
+    return union(new PCollection[] { other });
+  }
+  
+  @Override
   public PCollection<S> union(PCollection<S>... collections) {
     Collection<S> output = Lists.newArrayList();
     for (PCollection<S> pcollect : collections) {

http://git-wip-us.apache.org/repos/asf/crunch/blob/913d7671/crunch/src/main/java/org/apache/crunch/impl/mem/collect/MemTable.java
----------------------------------------------------------------------
diff --git a/crunch/src/main/java/org/apache/crunch/impl/mem/collect/MemTable.java b/crunch/src/main/java/org/apache/crunch/impl/mem/collect/MemTable.java
index 8d9649d..f8a5960 100644
--- a/crunch/src/main/java/org/apache/crunch/impl/mem/collect/MemTable.java
+++ b/crunch/src/main/java/org/apache/crunch/impl/mem/collect/MemTable.java
@@ -54,6 +54,11 @@ public class MemTable<K, V> extends MemCollection<Pair<K, V>>
implements PTable<
   }
 
   @Override
+  public PTable<K, V> union(PTable<K, V> other) {
+    return union(new PTable[] { other });
+  }
+  
+  @Override
   public PTable<K, V> union(PTable<K, V>... others) {
     List<Pair<K, V>> values = Lists.newArrayList();
     values.addAll(getCollection());

http://git-wip-us.apache.org/repos/asf/crunch/blob/913d7671/crunch/src/main/java/org/apache/crunch/impl/mr/collect/PCollectionImpl.java
----------------------------------------------------------------------
diff --git a/crunch/src/main/java/org/apache/crunch/impl/mr/collect/PCollectionImpl.java b/crunch/src/main/java/org/apache/crunch/impl/mr/collect/PCollectionImpl.java
index 79b7c83..6ea9c4c 100644
--- a/crunch/src/main/java/org/apache/crunch/impl/mr/collect/PCollectionImpl.java
+++ b/crunch/src/main/java/org/apache/crunch/impl/mr/collect/PCollectionImpl.java
@@ -77,6 +77,11 @@ public abstract class PCollectionImpl<S> implements PCollection<S>
{
   }
 
   @Override
+  public PCollection<S> union(PCollection<S> other) {
+    return union(new PCollection[] { other });
+  }
+  
+  @Override
   public PCollection<S> union(PCollection<S>... collections) {
     List<PCollectionImpl<S>> internal = Lists.newArrayList();
     internal.add(this);

http://git-wip-us.apache.org/repos/asf/crunch/blob/913d7671/crunch/src/main/java/org/apache/crunch/impl/mr/collect/PTableBase.java
----------------------------------------------------------------------
diff --git a/crunch/src/main/java/org/apache/crunch/impl/mr/collect/PTableBase.java b/crunch/src/main/java/org/apache/crunch/impl/mr/collect/PTableBase.java
index a41e979..3c2393d 100644
--- a/crunch/src/main/java/org/apache/crunch/impl/mr/collect/PTableBase.java
+++ b/crunch/src/main/java/org/apache/crunch/impl/mr/collect/PTableBase.java
@@ -72,6 +72,11 @@ abstract class PTableBase<K, V> extends PCollectionImpl<Pair<K,
V>> implements P
   }
 
   @Override
+  public PTable<K, V> union(PTable<K, V> other) {
+    return union(new PTable[] { other });
+  }
+  
+  @Override
   public PTable<K, V> union(PTable<K, V>... others) {
     List<PTableBase<K, V>> internal = Lists.newArrayList();
     internal.add(this);


Mime
View raw message