"unless order is decending and a single value is requested");
}
} else {
start = filter.getBeginDate().getTime()/1000;
}
FetchRequest request = db.createFetchRequest(consolidationFunction, start, end, 1);
List<HistoricItem> items = new ArrayList<HistoricItem>();
FetchData result = request.fetchData();
long ts = result.getFirstTimestamp();
long step = result.getRowCount() > 1 ? result.getStep() : 0;
for(double value : result.getValues(DATASOURCE_STATE)) {
if(!Double.isNaN(value)) {
RRD4jItem rrd4jItem = new RRD4jItem(itemName, mapToState(value, itemName), new Date(ts * 1000));