fixed limit issue on top values

This commit is contained in:
Luca Frosini 2021-11-25 12:27:52 +01:00
parent 72a4bb68b1
commit f0b2c8d61f
2 changed files with 3 additions and 3 deletions

View File

@ -264,12 +264,12 @@ public class AccountingPersistenceQueryPostgreSQL implements AccountingPersisten
}
@Override
public SortedMap<NumberedFilter, SortedMap<Calendar, Info>> getTopValues(String topKey, String orderingProperty)
public SortedMap<NumberedFilter, SortedMap<Calendar, Info>> getTopValues(String topKey, String orderingProperty, Integer limit)
throws Exception {
SortedMap<NumberedFilter,SortedMap<Calendar,Info>> ret = new TreeMap<>();
SortedSet<NumberedFilter> top = getNumberedValues(topKey, orderingProperty, 10);
SortedSet<NumberedFilter> top = getNumberedValues(topKey, orderingProperty, limit);
for(NumberedFilter numberedFilter : top) {
filters.add(numberedFilter);

View File

@ -249,7 +249,7 @@ public class AccountingPersistenceQueryPostgreSQLTest extends ContextTest {
accountingPersistenceQueryPostgreSQL.setTemporalConstraint(temporalConstraint);
accountingPersistenceQueryPostgreSQL.setFilters(filters);
SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topTimeSeries = accountingPersistenceQueryPostgreSQL.getTopValues(AggregatedServiceUsageRecord.CALLED_METHOD, orderingProperty);
SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topTimeSeries = accountingPersistenceQueryPostgreSQL.getTopValues(AggregatedServiceUsageRecord.CALLED_METHOD, orderingProperty, null);
for(NumberedFilter numberedFilter : topTimeSeries.keySet()) {
logger.debug("{}", numberedFilter);
SortedMap<Calendar, Info> timeseries = topTimeSeries.get(numberedFilter);