public Object getAggregate(String measure, String functionName) throws HblException {
try {
Integer index = measureName2IndexMap.get(measure);
if (index == null)
throw new HblException(String.format("Invalid measure name:%s.", measure));
AggregateFunction af = afr.findFunction(functionName);
if (af == null)
throw new HblException(String.format("Invalid function name:%s.", functionName));
if (result == null)
throw new HblException("no current result");
Aggregation measureAggr = result[index];
if (measureAggr == null) {
Aggregation.Builder b = delegate.current().getMeasures()[index];
result[index] = b == null ? null : (measureAggr = b.build()); // cache
}
return af.getAggrValue(measureAggr);
} catch (IOException exc) {
throw new HblException(exc.getMessage(), exc);
}
}