crunch-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwi...@apache.org
Subject git commit: CRUNCH-464: Empty PCollection returns null Long for length().getValue(). Contributed by Jeremy Beard.
Date Tue, 19 Aug 2014 19:31:35 GMT
Repository: crunch
Updated Branches:
  refs/heads/apache-crunch-0.8 74f512ccb -> 9e2ecba71


CRUNCH-464: Empty PCollection returns null Long for length().getValue(). Contributed by Jeremy
Beard.


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

Branch: refs/heads/apache-crunch-0.8
Commit: 9e2ecba7153a710d398209f5718213cf755db86a
Parents: 74f512c
Author: Josh Wills <jwills@apache.org>
Authored: Tue Aug 19 10:56:25 2014 -0700
Committer: Josh Wills <jwills@apache.org>
Committed: Tue Aug 19 10:59:10 2014 -0700

----------------------------------------------------------------------
 crunch-core/src/main/java/org/apache/crunch/lib/Aggregate.java | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/crunch/blob/9e2ecba7/crunch-core/src/main/java/org/apache/crunch/lib/Aggregate.java
----------------------------------------------------------------------
diff --git a/crunch-core/src/main/java/org/apache/crunch/lib/Aggregate.java b/crunch-core/src/main/java/org/apache/crunch/lib/Aggregate.java
index 68c23e1..22c5e80 100644
--- a/crunch-core/src/main/java/org/apache/crunch/lib/Aggregate.java
+++ b/crunch-core/src/main/java/org/apache/crunch/lib/Aggregate.java
@@ -85,6 +85,9 @@ public class Aggregate {
           public Pair<Integer, Long> map(S input) {
             return Pair.of(1, 1L);
           }
+          public void cleanup(Emitter<Pair<Integer, Long>> e) {
+            e.emit(Pair.of(1, 0L));
+          }
         }, tf.tableOf(tf.ints(), tf.longs()))
         .groupByKey(GroupingOptions.builder().numReducers(1).build())
         .combineValues(Aggregators.SUM_LONGS());


Mime
View raw message