Object o = input.get(0);
if (!(o instanceof DataBag)) {
throw new IOException("Expected input to be a bag, but got: " + o.getClass().getName());
}
DataBag inputBag = (DataBag) o;
QuantileEstimator estimator = createEstimator();
for (Tuple t : inputBag) {
if (t != null && t.get(0) != null) {
estimator.add(((Number) t.get(0)).doubleValue());
}
}
List<Double> quantiles = estimator.getQuantiles();
for (int i = 0; i < quantiles.size(); i++) {
output.add(tupleFactory.newTuple(ImmutableList.of(i, quantiles.get(i))));
}
return output;
}