You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@crunch.apache.org by jw...@apache.org on 2013/04/25 22:17:15 UTC
git commit: CRUNCH-198: Update CoGroupIT to run on hadoop-2 by
ignoring ordering of cogrouped elements in the output
Updated Branches:
refs/heads/master 7c536c395 -> f1e877d4f
CRUNCH-198: Update CoGroupIT to run on hadoop-2 by ignoring ordering of cogrouped elements in the output
Project: http://git-wip-us.apache.org/repos/asf/crunch/repo
Commit: http://git-wip-us.apache.org/repos/asf/crunch/commit/f1e877d4
Tree: http://git-wip-us.apache.org/repos/asf/crunch/tree/f1e877d4
Diff: http://git-wip-us.apache.org/repos/asf/crunch/diff/f1e877d4
Branch: refs/heads/master
Commit: f1e877d4f1627a8289d42072202556a42e56e97c
Parents: 7c536c3
Author: Josh Wills <jw...@apache.org>
Authored: Thu Apr 25 13:17:02 2013 -0700
Committer: Josh Wills <jw...@apache.org>
Committed: Thu Apr 25 13:17:02 2013 -0700
----------------------------------------------------------------------
.../it/java/org/apache/crunch/lib/CogroupIT.java | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/crunch/blob/f1e877d4/crunch-core/src/it/java/org/apache/crunch/lib/CogroupIT.java
----------------------------------------------------------------------
diff --git a/crunch-core/src/it/java/org/apache/crunch/lib/CogroupIT.java b/crunch-core/src/it/java/org/apache/crunch/lib/CogroupIT.java
index 4b28da7..0d8b2b8 100644
--- a/crunch-core/src/it/java/org/apache/crunch/lib/CogroupIT.java
+++ b/crunch-core/src/it/java/org/apache/crunch/lib/CogroupIT.java
@@ -42,8 +42,9 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
-import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Maps;
public class CogroupIT {
@@ -84,8 +85,13 @@ public class CogroupIT {
PTable<String, Pair<Collection<String>, Collection<String>>> cg = Cogroup.cogroup(kv1, kv2);
- Map<String, Pair<Collection<String>, Collection<String>>> actual = cg.materializeToMap();
-
+ Map<String, Pair<Collection<String>, Collection<String>>> result = cg.materializeToMap();
+ Map<String, Pair<Collection<String>, Collection<String>>> actual = Maps.newHashMap();
+ for (Map.Entry<String, Pair<Collection<String>, Collection<String>>> e : result.entrySet()) {
+ Collection<String> one = ImmutableSet.copyOf(e.getValue().first());
+ Collection<String> two = ImmutableSet.copyOf(e.getValue().second());
+ actual.put(e.getKey(), Pair.of(one, two));
+ }
Map<String, Pair<Collection<String>, Collection<String>>> expected = ImmutableMap.of(
"a", Pair.of(coll("1-1", "1-4"), coll()),
"b", Pair.of(coll("1-2"), coll("2-1")),
@@ -106,7 +112,7 @@ public class CogroupIT {
}
private static Collection<String> coll(String... values) {
- return ImmutableList.copyOf(values);
+ return ImmutableSet.copyOf(values);
}
}