public AbstractMinMaxAggregateFunction(
     ICopyEvaluatorFactory[] args, IDataOutputProvider provider, boolean isMin)
     throws AlgebricksException {
   out = provider.getDataOutput();
   eval = args[0].createEvaluator(inputVal);
   this.isMin = isMin;
 }
  public AbstractAvgAggregateFunction(ICopyEvaluatorFactory[] args, IDataOutputProvider output)
      throws AlgebricksException {
    eval = args[0].createEvaluator(inputVal);
    out = output.getDataOutput();

    ARecordType tmpRecType;
    try {
      tmpRecType =
          new ARecordType(
              null,
              new String[] {"sum", "count"},
              new IAType[] {BuiltinType.ADOUBLE, BuiltinType.AINT64},
              false);
    } catch (AsterixException | HyracksDataException e) {
      throw new AlgebricksException(e);
    }

    recType = tmpRecType;
    recordEval =
        new ClosedRecordConstructorEval(
            recType, new ICopyEvaluator[] {evalSum, evalCount}, avgBytes, out);
  }