(improvement) (semantic) query dimension value support specifying time range (#343)

Co-authored-by: jolunoluo
This commit is contained in:
LXW
2023-11-09 11:50:19 +08:00
committed by GitHub
parent 41aa6ff8e4
commit 2aeeb1a14e
5 changed files with 27 additions and 4 deletions

View File

@@ -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;
}

View File

@@ -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) {

View File

@@ -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();

View File

@@ -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,

View File

@@ -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;
}