[
https://issues.apache.org/jira/browse/FLINK-2725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14949843#comment-14949843
]
ASF GitHub Bot commented on FLINK-2725:
---------------------------------------
Github user rmetzger commented on a diff in the pull request:
https://github.com/apache/flink/pull/1191#discussion_r41595115
--- Diff:
flink-java/src/main/java/org/apache/flink/api/java/aggregation/SumAggregationFunction.java
---
@@ -113,11 +182,32 @@ public Long getAggregate() {
return agg;
}
}
-
+
+ public static final class LongValueSumAgg extends
SumAggregationFunction<LongValue> {
+ private static final long serialVersionUID = 1L;
+
+ private long agg;
+
+ @Override
+ public void initializeAggregate() {
+ agg = 0L;
+ }
+
+ @Override
+ public void aggregate(LongValue value) {
+ agg += value.getValue();
+ }
+
+ @Override
+ public LongValue getAggregate() {
+ return new LongValue(agg);
+ }
+ }
+
public static final class FloatSumAgg extends
SumAggregationFunction<Float> {
private static final long serialVersionUID = 1L;
-
- private float agg;
+
+ private double agg;
--- End diff --
why are you storing the float sum in a double?
> Max/Min/Sum Aggregation of mutable types
> ----------------------------------------
>
> Key: FLINK-2725
> URL: https://issues.apache.org/jira/browse/FLINK-2725
> Project: Flink
> Issue Type: Improvement
> Components: Java API
> Affects Versions: 0.10
> Reporter: Greg Hogan
> Assignee: Greg Hogan
> Priority: Minor
>
> Support mutable value types in min, max, and sum aggregations.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)