mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 12:07:42 +00:00
(improvement)(Headless) Support specifying metrics, tags, and dimensions query modes in the Map phase (#959)
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
package com.tencent.supersonic.headless.api.pojo;
|
||||
|
||||
public enum QueryDataType {
|
||||
METRIC,
|
||||
DIMENSION,
|
||||
TAG,
|
||||
ALL
|
||||
}
|
||||
@@ -31,6 +31,7 @@ public class SchemaElement implements Serializable {
|
||||
private String defaultAgg;
|
||||
private String dataFormatType;
|
||||
private double order;
|
||||
private int isTag;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.tencent.supersonic.headless.api.pojo;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -31,18 +30,4 @@ public class SchemaMapInfo {
|
||||
public void setMatchedElements(Long dataSet, List<SchemaElementMatch> elementMatches) {
|
||||
dataSetElementMatches.put(dataSet, elementMatches);
|
||||
}
|
||||
|
||||
public Map<Long, String> generateDataSetMap() {
|
||||
Map<Long, String> dataSetIdToName = new HashMap<>();
|
||||
for (Map.Entry<Long, List<SchemaElementMatch>> entry : dataSetElementMatches.entrySet()) {
|
||||
List<SchemaElementMatch> values = entry.getValue();
|
||||
if (CollectionUtils.isNotEmpty(values)) {
|
||||
SchemaElementMatch schemaElementMatch = values.get(0);
|
||||
String dataSetName = schemaElementMatch.getElement().getDataSetName();
|
||||
dataSetIdToName.put(entry.getKey(), dataSetName);
|
||||
}
|
||||
}
|
||||
return dataSetIdToName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.tencent.supersonic.headless.api.pojo.request;
|
||||
|
||||
import com.tencent.supersonic.auth.api.authentication.pojo.User;
|
||||
import com.tencent.supersonic.headless.api.pojo.QueryDataType;
|
||||
import com.tencent.supersonic.headless.api.pojo.enums.MapModeEnum;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
@@ -15,4 +16,5 @@ public class QueryMapReq {
|
||||
private User user;
|
||||
private Integer topN = 10;
|
||||
private MapModeEnum mapModeEnum = MapModeEnum.STRICT;
|
||||
private QueryDataType queryDataType = QueryDataType.ALL;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.tencent.supersonic.headless.api.pojo.request;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.tencent.supersonic.auth.api.authentication.pojo.User;
|
||||
import com.tencent.supersonic.common.pojo.enums.Text2SQLType;
|
||||
import com.tencent.supersonic.headless.api.pojo.QueryDataType;
|
||||
import com.tencent.supersonic.headless.api.pojo.SchemaMapInfo;
|
||||
import com.tencent.supersonic.headless.api.pojo.enums.MapModeEnum;
|
||||
import lombok.Data;
|
||||
@@ -20,4 +21,5 @@ public class QueryReq {
|
||||
private Text2SQLType text2SQLType = Text2SQLType.RULE_AND_LLM;
|
||||
private MapModeEnum mapModeEnum = MapModeEnum.STRICT;
|
||||
private SchemaMapInfo mapInfo = new SchemaMapInfo();
|
||||
private QueryDataType queryDataType = QueryDataType.ALL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user