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/03/02 19:21:28 UTC

git commit: CRUNCH-171: Force value ordering in SortByValueIT test so that results are consistent in MR1 and MR2. Contributed by Chao Shi.

Updated Branches:
  refs/heads/master 6ddbf57ff -> 453bff6fe


CRUNCH-171: Force value ordering in SortByValueIT test so that results are consistent in MR1 and MR2. Contributed by Chao Shi.


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

Branch: refs/heads/master
Commit: 453bff6fefe58334a66e02c04da909320df4b4d8
Parents: 6ddbf57
Author: Josh Wills <jw...@apache.org>
Authored: Sat Mar 2 09:57:07 2013 -0800
Committer: Josh Wills <jw...@apache.org>
Committed: Sat Mar 2 09:57:07 2013 -0800

----------------------------------------------------------------------
 .../java/org/apache/crunch/lib/SortByValueIT.java  |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/crunch/blob/453bff6f/crunch/src/it/java/org/apache/crunch/lib/SortByValueIT.java
----------------------------------------------------------------------
diff --git a/crunch/src/it/java/org/apache/crunch/lib/SortByValueIT.java b/crunch/src/it/java/org/apache/crunch/lib/SortByValueIT.java
index c313351..e19c7d3 100644
--- a/crunch/src/it/java/org/apache/crunch/lib/SortByValueIT.java
+++ b/crunch/src/it/java/org/apache/crunch/lib/SortByValueIT.java
@@ -73,7 +73,10 @@ public class SortByValueIT {
     String sbv = tmpDir.copyResourceFileName("sort_by_value.txt");
     PTable<String, Long> letterCounts = pipeline.read(From.textFile(sbv)).parallelDo(new SplitFn("\t"),
         ptf.tableOf(ptf.strings(), ptf.longs()));
-    PCollection<Pair<String, Long>> sorted = Sort.sortPairs(letterCounts, new ColumnOrder(2, Order.DESCENDING));
+    PCollection<Pair<String, Long>> sorted = Sort.sortPairs(
+        letterCounts,
+        new ColumnOrder(2, Order.DESCENDING),
+        new ColumnOrder(1, Order.ASCENDING));
     assertEquals(
         ImmutableList.of(Pair.of("C", 3L), Pair.of("A", 2L), Pair.of("D", 2L), Pair.of("B", 1L), Pair.of("E", 1L)),
         ImmutableList.copyOf(sorted.materialize()));