mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-12 04:27:39 +00:00
(improvement)(headless) Query metric/dimension by id in SchemaController and update api header check (#608)
* (improvement)(headless) Query metric/dimension by id in SchemaController and update api header check * (improvement)(headless) Fix the issue where metrics were not recognized when the result field contained an aggregate function. --------- Co-authored-by: jolunoluo
This commit is contained in:
@@ -3,18 +3,25 @@ package com.tencent.supersonic.headless.api.request;
|
||||
import com.tencent.supersonic.common.pojo.DateConf;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class QueryItemReq {
|
||||
|
||||
@NotEmpty(message = "ids不可为空")
|
||||
@Size(max = 5, min = 1)
|
||||
private List<Long> ids;
|
||||
|
||||
private DateConf dateConf = new DateConf();
|
||||
|
||||
//result size of single id
|
||||
private Long limit;
|
||||
private Long limit = 1000L;
|
||||
|
||||
public Long getLimit() {
|
||||
if (limit > 10000) {
|
||||
return 10000L;
|
||||
}
|
||||
return limit;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.tencent.supersonic.headless.api.request;
|
||||
|
||||
import com.tencent.supersonic.common.pojo.enums.TypeEnums;
|
||||
import lombok.Data;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SchemaItemQueryReq {
|
||||
|
||||
@NotEmpty(message = "id个数不可为空")
|
||||
private List<Long> ids;
|
||||
|
||||
//METRIC, DIMENSION
|
||||
@NotNull(message = "type不可为空")
|
||||
private TypeEnums type;
|
||||
|
||||
}
|
||||
@@ -20,8 +20,6 @@ public class DimensionResp extends SchemaItem {
|
||||
|
||||
private String expr;
|
||||
|
||||
private String fullPath;
|
||||
|
||||
private String modelName;
|
||||
|
||||
private String modelBizName;
|
||||
|
||||
@@ -5,7 +5,6 @@ import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.tencent.supersonic.common.pojo.DataFormat;
|
||||
import com.tencent.supersonic.headless.api.pojo.DrillDownDimension;
|
||||
import com.tencent.supersonic.headless.api.pojo.Measure;
|
||||
import com.tencent.supersonic.headless.api.pojo.MetricTypeParams;
|
||||
import com.tencent.supersonic.headless.api.pojo.RelateDimension;
|
||||
import com.tencent.supersonic.headless.api.pojo.SchemaItem;
|
||||
@@ -78,13 +77,6 @@ public class MetricResp extends SchemaItem {
|
||||
.collect(Collectors.joining(","));
|
||||
}
|
||||
|
||||
public List<Measure> getMeasures() {
|
||||
if (typeParams == null) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return typeParams.getMeasures();
|
||||
}
|
||||
|
||||
public String getDefaultAgg() {
|
||||
return typeParams.getMeasures().get(0).getAgg();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user