flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject flink git commit: [FLINK-2404] add support for primitives to simple accumulator counters
Date Tue, 28 Jul 2015 15:24:28 GMT
Repository: flink
Updated Branches:
  refs/heads/master 78fd2146d -> 571084152


[FLINK-2404] add support for primitives to simple accumulator counters

This closes #942.


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

Branch: refs/heads/master
Commit: 571084152f81f984fa4cdfc2122c3edcf5b62abd
Parents: 78fd214
Author: Sachin Goel <sachingoel0101@gmail.com>
Authored: Mon Jul 27 16:53:18 2015 +0530
Committer: Maximilian Michels <mxm@apache.org>
Committed: Tue Jul 28 17:24:06 2015 +0200

----------------------------------------------------------------------
 .../flink/api/common/accumulators/DoubleCounter.java     |  7 +++++++
 .../apache/flink/api/common/accumulators/IntCounter.java |  7 +++++++
 .../flink/api/common/accumulators/LongCounter.java       | 11 +++++++++--
 3 files changed, 23 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/57108415/flink-core/src/main/java/org/apache/flink/api/common/accumulators/DoubleCounter.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/api/common/accumulators/DoubleCounter.java
b/flink-core/src/main/java/org/apache/flink/api/common/accumulators/DoubleCounter.java
index 85d187c..b7a4bfc 100644
--- a/flink-core/src/main/java/org/apache/flink/api/common/accumulators/DoubleCounter.java
+++ b/flink-core/src/main/java/org/apache/flink/api/common/accumulators/DoubleCounter.java
@@ -27,11 +27,18 @@ public class DoubleCounter implements SimpleAccumulator<Double>
{
 
 	private double localValue = 0;
 
+	/**
+	 * Consider using {@link #add(double)} instead for primitive double values
+	 */
 	@Override
 	public void add(Double value) {
 		localValue += value;
 	}
 
+	public void add(double value){
+		localValue += value;
+	}
+
 	@Override
 	public Double getLocalValue() {
 		return localValue;

http://git-wip-us.apache.org/repos/asf/flink/blob/57108415/flink-core/src/main/java/org/apache/flink/api/common/accumulators/IntCounter.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/api/common/accumulators/IntCounter.java
b/flink-core/src/main/java/org/apache/flink/api/common/accumulators/IntCounter.java
index c88c73d..a97ba51 100644
--- a/flink-core/src/main/java/org/apache/flink/api/common/accumulators/IntCounter.java
+++ b/flink-core/src/main/java/org/apache/flink/api/common/accumulators/IntCounter.java
@@ -28,11 +28,18 @@ public class IntCounter implements SimpleAccumulator<Integer> {
 
 	private int localValue = 0;
 
+	/**
+	 * Consider using {@link #add(int)} instead for primitive int values
+	 */
 	@Override
 	public void add(Integer value) {
 		localValue += value;
 	}
 
+	public void add(int value){
+		localValue += value;
+	}
+
 	@Override
 	public Integer getLocalValue() {
 		return localValue;

http://git-wip-us.apache.org/repos/asf/flink/blob/57108415/flink-core/src/main/java/org/apache/flink/api/common/accumulators/LongCounter.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/api/common/accumulators/LongCounter.java
b/flink-core/src/main/java/org/apache/flink/api/common/accumulators/LongCounter.java
index 70f2417..93b06d6 100644
--- a/flink-core/src/main/java/org/apache/flink/api/common/accumulators/LongCounter.java
+++ b/flink-core/src/main/java/org/apache/flink/api/common/accumulators/LongCounter.java
@@ -26,12 +26,19 @@ public class LongCounter implements SimpleAccumulator<Long> {
 	private static final long serialVersionUID = 1L;
 	
 	private long localValue = 0;
-	
+
+	/**
+	 * Consider using {@link #add(long)} instead for primitive long values
+	 */
 	@Override
 	public void add(Long value) {
 		this.localValue += value;
 	}
-	
+
+	public void add(long value){
+		this.localValue += value;
+	}
+
 	@Override
 	public Long getLocalValue() {
 		return this.localValue;


Mime
View raw message