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:54 GMT
Repository: crunch
Updated Branches:
  refs/heads/master f54d3d638 -> c182309f0


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/c182309f
Tree: http://git-wip-us.apache.org/repos/asf/crunch/tree/c182309f
Diff: http://git-wip-us.apache.org/repos/asf/crunch/diff/c182309f

Branch: refs/heads/master
Commit: c182309f082757c10e6c817890a8b0f819f3ef89
Parents: f54d3d6
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:56:25 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/c182309f/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 3d2170c..794caa0 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