private Object[] calcPartialResult(PTFPartitionIterator<Object> pItr, LeadLagInfo leadLagInfo)
        throws HiveException {
      // To handle the case like SUM(LAG(f)) over(), aggregation function includes
      // LAG/LEAD call
      PTFOperator.connectLeadLagFunctionsToPartition(leadLagInfo, pItr);

      AggregationBuffer aggBuffer = wrappedEvaluator.getNewAggregationBuffer();
      Object[] argValues = new Object[parameters == null ? 0 : parameters.size()];
      while(pItr.hasNext())
      {
        Object row = pItr.next();
        int i = 0;
        if ( parameters != null ) {
          for(PTFExpressionDef param : parameters)
          {
            argValues[i++] = param.getExprEvaluator().evaluate(row);
          }
        }
        wrappedEvaluator.aggregate(aggBuffer, argValues);
      }

      // The object [count LongWritable, sum ResultType] is reused during evaluating
      Object[] partial = (Object[])wrappedEvaluator.terminatePartial(aggBuffer);
      return new Object[] {((LongWritable)partial[0]).get(), ObjectInspectorUtils.copyToStandardObject(partial[1], outputOI)};
    }
Calculate the partial result sum + count giving a parition range
@return a 2-element Object array of [count long, sum ResultType]
ql/src/java/org/apache/hadoop/hive/ql/udf/ptf/BasePartitionEvaluator.java