Commit 1e1beaaeac53284994781e85867cc6288413661c
1 parent
94f3680f
Was modified findLatest(...) method & BaseTimeseriesService(...) constructor for…
… set limit and order by values
Showing
2 changed files
with
8 additions
and
1 deletions
@@ -42,4 +42,8 @@ public class BaseReadTsKvQuery extends BaseTsKvQuery implements ReadTsKvQuery { | @@ -42,4 +42,8 @@ public class BaseReadTsKvQuery extends BaseTsKvQuery implements ReadTsKvQuery { | ||
42 | this(key, startTs, endTs, endTs - startTs, 1, Aggregation.AVG, "DESC"); | 42 | this(key, startTs, endTs, endTs - startTs, 1, Aggregation.AVG, "DESC"); |
43 | } | 43 | } |
44 | 44 | ||
45 | + public BaseReadTsKvQuery(String key, long startTs, long endTs, int limit, String orderBy) { | ||
46 | + this(key, startTs, endTs, endTs - startTs, limit, Aggregation.AVG, orderBy); | ||
47 | + } | ||
48 | + | ||
45 | } | 49 | } |
@@ -75,7 +75,10 @@ public class BaseTimeseriesService implements TimeseriesService { | @@ -75,7 +75,10 @@ public class BaseTimeseriesService implements TimeseriesService { | ||
75 | EntityView entityView = entityViewService.findEntityViewById((EntityViewId) entityId); | 75 | EntityView entityView = entityViewService.findEntityViewById((EntityViewId) entityId); |
76 | Collection<String> matchingKeys = chooseKeysForEntityView(entityView, keys); | 76 | Collection<String> matchingKeys = chooseKeysForEntityView(entityView, keys); |
77 | List<ReadTsKvQuery> queries = new ArrayList<>(); | 77 | List<ReadTsKvQuery> queries = new ArrayList<>(); |
78 | - matchingKeys.forEach(key -> queries.add(new BaseReadTsKvQuery(key, entityView.getStartTs(), entityView.getEndTs()))); | 78 | + |
79 | + matchingKeys.forEach(key -> queries.add( | ||
80 | + new BaseReadTsKvQuery(key, entityView.getStartTs(), entityView.getEndTs(), 1, "ASC"))); | ||
81 | + | ||
79 | return timeseriesDao.findAllAsync(entityView.getEntityId(), updateQueriesForEntityView(entityView, queries)); | 82 | return timeseriesDao.findAllAsync(entityView.getEntityId(), updateQueriesForEntityView(entityView, queries)); |
80 | } | 83 | } |
81 | keys.forEach(key -> futures.add(timeseriesDao.findLatest(entityId, key))); | 84 | keys.forEach(key -> futures.add(timeseriesDao.findLatest(entityId, key))); |