优化group

This commit is contained in:
zhou-hao 2020-12-28 11:09:08 +08:00
parent 17ce3d2ecd
commit 556ba4f27c
2 changed files with 3 additions and 3 deletions

View File

@ -239,13 +239,13 @@ public class TimeSeriesRowDeviceDataStoreStoragePolicy extends TimeSeriesDeviceD
//执行查询
.execute(timeSeriesManager.getService(getTimeSeriesMetric(productId))::aggregation)
//按时间分组,然后将返回的结果合并起来
.groupBy(agg -> agg.getString("time", ""))
.groupBy(agg -> agg.getString("time", ""),Integer.MAX_VALUE)
.flatMap(group ->
{
String time = group.key();
return group
//按属性分组
.groupBy(agg -> agg.getString("property", ""))
.groupBy(agg -> agg.getString("property", ""),Integer.MAX_VALUE)
.flatMap(propsGroup -> {
String property = propsGroup.key();
return propsGroup

View File

@ -82,7 +82,7 @@ public class GatewayDeviceController {
.where()
.in(DeviceInstanceEntity::getParentId, mapping.keySet())
.fetch()
.groupBy(DeviceInstanceEntity::getParentId)
.groupBy(DeviceInstanceEntity::getParentId,Integer.MAX_VALUE)
.flatMap(group -> {
String parentId = group.key();
return group