mirror of
https://github.com/tencentmusic/supersonic.git
synced 2026-04-27 02:44:19 +08:00
Compare commits
3 Commits
fc67411618
...
1e01f3ef60
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1e01f3ef60 | ||
|
|
1155ac10d8 | ||
|
|
5a22590661 |
@@ -303,8 +303,8 @@ public class S2SemanticLayerService implements SemanticLayerService {
|
||||
|
||||
QueryStatement queryStatement = new QueryStatement();
|
||||
queryStatement.setEnableOptimize(queryUtils.enableOptimize());
|
||||
queryStatement.setLimit(Integer.parseInt(translatorConfig.getParameterValue(
|
||||
TranslatorConfig.TRANSLATOR_RESULT_LIMIT)));
|
||||
queryStatement.setLimit(Integer.parseInt(
|
||||
translatorConfig.getParameterValue(TranslatorConfig.TRANSLATOR_RESULT_LIMIT)));
|
||||
queryStatement.setDataSetId(queryReq.getDataSetId());
|
||||
queryStatement.setDataSetName(queryReq.getDataSetName());
|
||||
queryStatement.setSemanticSchema(semanticSchemaResp);
|
||||
|
||||
@@ -145,8 +145,7 @@ public class ModelServiceImpl implements ModelService {
|
||||
// Comment out below checks for now, they seem unnecessary and
|
||||
// lead to unexpected exception in updating model
|
||||
/*
|
||||
checkParams(modelReq);
|
||||
checkRelations(modelReq);
|
||||
* checkParams(modelReq); checkRelations(modelReq);
|
||||
*/
|
||||
ModelDO modelDO = modelRepository.getModelById(modelReq.getId());
|
||||
ModelConverter.convert(modelDO, modelReq, user);
|
||||
|
||||
@@ -110,7 +110,8 @@ public class ModelConverter {
|
||||
dimensionReq.setExpr(dim.getExpr());
|
||||
dimensionReq.setType(dim.getType().name());
|
||||
dimensionReq
|
||||
.setDescription(Objects.isNull(dim.getDescription()) ? "" : dim.getDescription());
|
||||
.setDescription(Objects.isNull(dim.getDescription()) ? dimensionReq.getDescription()
|
||||
: dim.getDescription());
|
||||
dimensionReq.setTypeParams(dim.getTypeParams());
|
||||
return dimensionReq;
|
||||
}
|
||||
|
||||
@@ -100,7 +100,28 @@ public class QueryUtils {
|
||||
column.setDataFormatType(metricRespMap.get(nameEn).getDataFormatType());
|
||||
column.setDataFormat(metricRespMap.get(nameEn).getDataFormat());
|
||||
column.setModelId(metricRespMap.get(nameEn).getModelId());
|
||||
} else {
|
||||
// if column nameEn contains metric name, use metric dataFormatType
|
||||
metricRespMap.values().forEach(metric -> {
|
||||
if (nameEn.contains(metric.getName()) || nameEn.contains(metric.getBizName())) {
|
||||
column.setDataFormatType(metric.getDataFormatType());
|
||||
column.setDataFormat(metric.getDataFormat());
|
||||
column.setModelId(metric.getModelId());
|
||||
}
|
||||
// if column nameEn contains metric alias, use metric dataFormatType
|
||||
if (column.getDataFormatType() == null && metric.getAlias() != null) {
|
||||
for (String alias : metric.getAlias().split(",")) {
|
||||
if (nameEn.contains(alias)) {
|
||||
column.setDataFormatType(metric.getDataFormatType());
|
||||
column.setDataFormat(metric.getDataFormat());
|
||||
column.setModelId(metric.getModelId());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (dimensionRespMap.containsKey(nameEn)) {
|
||||
column.setModelId(dimensionRespMap.get(nameEn).getModelId());
|
||||
}
|
||||
@@ -119,7 +140,7 @@ public class QueryUtils {
|
||||
|| type.equalsIgnoreCase("float") || type.equalsIgnoreCase("double")
|
||||
|| type.equalsIgnoreCase("real") || type.equalsIgnoreCase("numeric")
|
||||
|| type.toLowerCase().startsWith("decimal") || type.toLowerCase().startsWith("uint")
|
||||
|| type.toLowerCase().startsWith("int");
|
||||
|| type.toLowerCase().startsWith("int") || type.toLowerCase().equalsIgnoreCase("decfloat");
|
||||
}
|
||||
|
||||
private String getName(String nameEn) {
|
||||
|
||||
@@ -18,23 +18,14 @@
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||
<version>2.1.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-expression</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-beans</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
|
||||
<version>4.5.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.xml.bind</groupId>
|
||||
<artifactId>jakarta.xml.bind-api</artifactId>
|
||||
<version>4.0.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.tencent.supersonic</groupId>
|
||||
|
||||
@@ -30,9 +30,29 @@ logging:
|
||||
springdoc:
|
||||
swagger-ui:
|
||||
path: /swagger-ui.html
|
||||
enabled: true
|
||||
tags-sorter: alpha
|
||||
operations-sorter: alpha
|
||||
api-docs:
|
||||
path: /v3/api-docs
|
||||
enabled: true
|
||||
group-configs:
|
||||
- group: 'default'
|
||||
paths-to-match: '/**'
|
||||
packages-to-scan: com.tencent.supersonic
|
||||
paths-to-match: /api/chat/**,/api/semantic/**
|
||||
paths-to-match: /api/chat/**,/api/semantic/**
|
||||
|
||||
knife4j:
|
||||
enable: true
|
||||
openapi:
|
||||
title: 'SuperSonic API Documentation'
|
||||
description: 'SuperSonic API Documentation'
|
||||
version: v1.0
|
||||
setting:
|
||||
language: zh-CN
|
||||
# basic:
|
||||
# enable: true
|
||||
# username: test
|
||||
# password: 123456#
|
||||
documents:
|
||||
default:
|
||||
title: ChatBI API Documents
|
||||
description: ChatBI API Documents
|
||||
1
pom.xml
1
pom.xml
@@ -78,7 +78,6 @@
|
||||
<spotless.version>2.27.1</spotless.version>
|
||||
<spotless.skip>false</spotless.skip>
|
||||
<stax2.version>4.2.1</stax2.version>
|
||||
<io.springfox.version>3.0.0</io.springfox.version>
|
||||
<aws-java-sdk.version>1.12.780</aws-java-sdk.version>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ const getCreateFieldName = (type: EnumDataSourceType) => {
|
||||
EnumDataSourceType.CATEGORICAL,
|
||||
EnumDataSourceType.TIME,
|
||||
EnumDataSourceType.PARTITION_TIME,
|
||||
EnumDataSourceType.FOREIGN,
|
||||
].includes(type as EnumDataSourceType)
|
||||
? 'isCreateDimension'
|
||||
: 'isCreateMetric';
|
||||
@@ -101,7 +102,7 @@ const ModelFieldForm: React.FC<Props> = ({
|
||||
value={selectTypeValue}
|
||||
allowClear
|
||||
onChange={(value) => {
|
||||
let defaultParams = {};
|
||||
let defaultParams:any = {};
|
||||
if (value === EnumDataSourceType.MEASURES) {
|
||||
defaultParams = {
|
||||
agg: AGG_OPTIONS[0].value,
|
||||
@@ -127,12 +128,13 @@ const ModelFieldForm: React.FC<Props> = ({
|
||||
};
|
||||
} else {
|
||||
defaultParams = {
|
||||
type: value,
|
||||
agg: undefined,
|
||||
dateFormat: undefined,
|
||||
timeGranularity: undefined,
|
||||
};
|
||||
}
|
||||
const isCreateName = getCreateFieldName(value);
|
||||
const isCreateName = getCreateFieldName(defaultParams.type);
|
||||
const editState = !isUndefined(record[isCreateName])
|
||||
? !!record[isCreateName]
|
||||
: true;
|
||||
|
||||
Reference in New Issue
Block a user