flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From greghogan <...@git.apache.org>
Subject [GitHub] flink pull request: [FLINK-2725] Max/Min/Sum Aggregation of mutabl...
Date Fri, 09 Oct 2015 15:17:14 GMT
Github user greghogan commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1191#discussion_r41641649
  
    --- 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 --
    
    The extra precision is beneficial when locally accumulating millions to billions of value
considering the 23 bits of precision. Is there a performance advantage to using float over
double and removing the implicit cast?


---
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