title: Flink - how to compute sum and average at the same time?
body: <p>Is there a way in Flink (batch/streaming) to compute the average and sum of a field at the same time? Using the aggregate method I can compute the sum of a field on a groupBy result, but how do I calculate the average also at the same time? Example code below.</p>
  
  <pre><code>ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
  DataSet&lt;Tuple3&lt;String,Integer,Double&gt;&gt; source = 
           env.readCsvFile(PathConfig.LINEITEM_1)
           .fieldDelimiter("|")
           types(String.class, Integer.class, Double.class);
  
  source.groupBy(0,1).aggregate(Aggregations.SUM, 2);
  //average of field 2???
  </code></pre>