[improvement][headless]Set default query limits of DataSet.

This commit is contained in:
jerryjzhang
2024-09-27 16:07:25 +08:00
parent c8ac5a3ba2
commit 764d3d24aa
11 changed files with 26 additions and 24 deletions

View File

@@ -1,5 +1,6 @@
package com.tencent.supersonic.headless.api.pojo;
import com.tencent.supersonic.common.pojo.Constants;
import com.tencent.supersonic.common.pojo.enums.DatePeriodEnum;
import com.tencent.supersonic.common.pojo.enums.TimeMode;
import lombok.Data;
@@ -10,5 +11,5 @@ public class AggregateTypeDefaultConfig {
private TimeDefaultConfig timeDefaultConfig =
new TimeDefaultConfig(7, DatePeriodEnum.DAY, TimeMode.RECENT);
private Long limit;
private long limit = Constants.DEFAULT_METRIC_LIMIT;
}

View File

@@ -1,5 +1,6 @@
package com.tencent.supersonic.headless.api.pojo;
import com.tencent.supersonic.common.pojo.Constants;
import lombok.Data;
@Data
@@ -10,5 +11,5 @@ public class DetailTypeDefaultConfig {
// default time to filter tag selection results
private TimeDefaultConfig timeDefaultConfig = new TimeDefaultConfig();
private Long limit;
private long limit = Constants.DEFAULT_DETAIL_LIMIT;
}

View File

@@ -14,6 +14,6 @@ public class ItemValueConfig {
private List<String> blackList = new ArrayList<>();
private List<String> whiteList = new ArrayList<>();
private List<String> ruleList = new ArrayList<>();
private Long limit;
private int limit;
private DateConf dateConf;
}

View File

@@ -36,7 +36,7 @@ public class SemanticParseInfo {
private Set<QueryFilter> metricFilters = Sets.newHashSet();
private Set<Order> orders = Sets.newHashSet();
private DateConf dateInfo;
private Long limit;
private long limit = DEFAULT_DETAIL_LIMIT;
private double score;
private List<SchemaElementMatch> elementMatches = Lists.newArrayList();
private SqlInfo sqlInfo = new SqlInfo();
@@ -74,8 +74,8 @@ public class SemanticParseInfo {
return dataSet.getDataSetId();
}
public Long getDetailLimit() {
Long limit = DEFAULT_DETAIL_LIMIT;
public long getDetailLimit() {
long limit = DEFAULT_DETAIL_LIMIT;
if (Objects.nonNull(queryConfig)
&& Objects.nonNull(queryConfig.getDetailTypeDefaultConfig())
&& Objects.nonNull(queryConfig.getDetailTypeDefaultConfig().getLimit())) {
@@ -84,8 +84,8 @@ public class SemanticParseInfo {
return limit;
}
public Long getMetricLimit() {
Long limit = DEFAULT_METRIC_LIMIT;
public long getMetricLimit() {
long limit = DEFAULT_METRIC_LIMIT;
if (Objects.nonNull(queryConfig)
&& Objects.nonNull(queryConfig.getAggregateTypeDefaultConfig())
&& Objects.nonNull(queryConfig.getAggregateTypeDefaultConfig().getLimit())) {

View File

@@ -1,6 +1,7 @@
package com.tencent.supersonic.headless.api.pojo.request;
import com.google.common.collect.Lists;
import com.tencent.supersonic.common.pojo.Constants;
import com.tencent.supersonic.common.pojo.DateConf;
import com.tencent.supersonic.common.pojo.Filter;
import lombok.Data;
@@ -26,7 +27,7 @@ public class QueryMetricReq {
private DateConf dateInfo = new DateConf();
private Long limit = 2000L;
private long limit = Constants.DEFAULT_METRIC_LIMIT;
private boolean innerLayerNative = false;
}

View File

@@ -48,7 +48,7 @@ public class QueryStructReq extends SemanticQueryReq {
private List<Filter> dimensionFilters = new ArrayList<>();
private List<Filter> metricFilters = new ArrayList<>();
private DateConf dateInfo;
private Long limit = 2000L;
private long limit = Constants.DEFAULT_DETAIL_LIMIT;
private QueryType queryType = QueryType.ID;
private boolean convertToSql = true;