mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-12 12:37:55 +00:00
(improvement) (semantic) query dimension value support specifying time range (#343)
Co-authored-by: jolunoluo
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.tencent.supersonic.semantic.api.query.request;
|
||||
|
||||
import com.tencent.supersonic.common.pojo.DateConf;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
@@ -10,5 +11,6 @@ public class QueryDimValueReq {
|
||||
private Long modelId;
|
||||
private String dimensionBizName;
|
||||
private String value;
|
||||
private DateConf dateInfo;
|
||||
|
||||
}
|
||||
|
||||
@@ -235,6 +235,16 @@ public class MetricServiceImpl implements MetricService {
|
||||
return metricResps.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MetricResp getMetric(Long id, User user) {
|
||||
MetricResp metricResp = getMetric(id);
|
||||
if (metricResp == null) {
|
||||
return null;
|
||||
}
|
||||
fillAdminRes(Lists.newArrayList(metricResp), user);
|
||||
return metricResp;
|
||||
}
|
||||
|
||||
private MetricResp getMetric(Long id) {
|
||||
MetricDO metricDO = metricRepository.getMetricById(id);
|
||||
if (metricDO == null) {
|
||||
|
||||
@@ -30,6 +30,8 @@ public interface MetricService {
|
||||
|
||||
MetricResp getMetric(Long modelId, String bizName);
|
||||
|
||||
MetricResp getMetric(Long id, User user);
|
||||
|
||||
List<String> mockAlias(MetricReq metricReq, String mockType, User user);
|
||||
|
||||
Set<String> getMetricTags();
|
||||
|
||||
@@ -92,11 +92,18 @@ public class MetricController {
|
||||
return metricService.queryMetric(pageMetricReq, user);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@GetMapping("getMetric/{modelId}/{bizName}")
|
||||
public MetricResp getMetric(@PathVariable("modelId") Long modelId, @PathVariable("bizName") String bizName) {
|
||||
return metricService.getMetric(modelId, bizName);
|
||||
}
|
||||
|
||||
@GetMapping("getMetric/{id}")
|
||||
public MetricResp getMetric(@PathVariable("id") Long id,
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
User user = UserHolder.findUser(request, response);
|
||||
return metricService.getMetric(id, user);
|
||||
}
|
||||
|
||||
@DeleteMapping("deleteMetric/{id}")
|
||||
public Boolean deleteMetric(@PathVariable("id") Long id,
|
||||
|
||||
@@ -375,10 +375,12 @@ public class QueryServiceImpl implements QueryService {
|
||||
}
|
||||
List<Aggregator> aggregators = new ArrayList<>();
|
||||
queryStructReq.setAggregators(aggregators);
|
||||
|
||||
DateConf dateInfo = new DateConf();
|
||||
dateInfo.setDateMode(DateConf.DateMode.RECENT);
|
||||
dateInfo.setUnit(1);
|
||||
DateConf dateInfo = queryDimValueReq.getDateInfo();
|
||||
if (dateInfo == null) {
|
||||
dateInfo = new DateConf();
|
||||
dateInfo.setDateMode(DateConf.DateMode.RECENT);
|
||||
dateInfo.setUnit(1);
|
||||
}
|
||||
queryStructReq.setDateInfo(dateInfo);
|
||||
return queryStructReq;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user