@Override
  public FieldValue evaluate(List<FieldValue> arguments) {
    checkArguments(arguments, 2);

    Collection<?> values = FieldValueUtil.getValue(Collection.class, arguments.get(0));

    int percentile = (arguments.get(1)).asInteger();
    if (percentile < 1 || percentile > 100) {
      throw new FunctionException(
          this,
          "Invalid percentile value "
              + percentile
              + ". Must be greater than 0 and equal or less than 100");
    }

    Double result = evaluate(values, percentile);

    return FieldValueUtil.create(result);
  }