flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmetzger <...@git.apache.org>
Subject [GitHub] flink pull request: [FLINK-2725] Max/Min/Sum Aggregation of mutabl...
Date Fri, 09 Oct 2015 03:42:42 GMT
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?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message