1 Commits

Author SHA1 Message Date
mroldx
b83c623ec1 Merge 9db9718e88 into 320fcf04bd 2025-06-25 23:28:03 +00:00
5 changed files with 7 additions and 15 deletions

View File

@@ -1,6 +1,5 @@
package com.tencent.supersonic.headless.core.pojo;
import com.tencent.supersonic.common.pojo.User;
import com.tencent.supersonic.headless.api.pojo.response.QueryState;
import com.tencent.supersonic.headless.api.pojo.response.SemanticSchemaResp;
import lombok.Data;
@@ -25,7 +24,6 @@ public class QueryStatement {
private SemanticSchemaResp semanticSchema;
private Integer limit = 1000;
private Boolean isTranslated = false;
private User user;
public boolean isOk() {
return StringUtils.isBlank(errMsg) && StringUtils.isNotBlank(sql);

View File

@@ -296,9 +296,6 @@ public class S2SemanticLayerService implements SemanticLayerService {
queryStatement.setSql(semanticQueryReq.getSqlInfo().getQuerySQL());
queryStatement.setIsTranslated(true);
}
if (queryStatement != null) {
queryStatement.setUser(user);
}
return queryStatement;
}

View File

@@ -178,9 +178,8 @@ public class ChatWorkflowEngine {
// 如果物理SQL被修正了更新querySQL为修正后的版本
SemanticParseInfo parseInfo = semanticQuery.getParseInfo();
if (StringUtils.isNotBlank(parseInfo.getSqlInfo().getCorrectedQuerySQL())) {
parseInfo.getSqlInfo()
.setQuerySQL(parseInfo.getSqlInfo().getCorrectedQuerySQL());
log.info("Physical SQL corrected and updated querySQL: {}",
parseInfo.getSqlInfo().setQuerySQL(parseInfo.getSqlInfo().getCorrectedQuerySQL());
log.info("Physical SQL corrected and updated querySQL: {}",
parseInfo.getSqlInfo().getQuerySQL());
}
break;

View File

@@ -138,8 +138,7 @@ public class DictUtils {
semanticQueryReq.setNeedAuth(false);
String bizName = dictItemResp.getBizName();
try {
SemanticQueryResp semanticQueryResp =
queryService.queryByReq(semanticQueryReq, User.getDefaultUser());
SemanticQueryResp semanticQueryResp = queryService.queryByReq(semanticQueryReq, null);
if (Objects.isNull(semanticQueryResp)
|| CollectionUtils.isEmpty(semanticQueryResp.getResultList())) {
return lines;
@@ -275,8 +274,7 @@ public class DictUtils {
private QuerySqlReq constructQuerySqlReq(DictItemResp dictItemResp) {
ModelResp model = modelService.getModel(dictItemResp.getModelId());
String tableStr = StringUtils.isNotBlank(model.getModelDetail().getTableQuery())
? model.getModelDetail().getTableQuery()
String tableStr = model.getModelDetail().getTableQuery() != null ? model.getModelDetail().getTableQuery()
: "(" + model.getModelDetail().getSqlQuery() + ")";
String sqlPattern =
"select %s,count(1) from %s %s group by %s order by count(1) desc limit %d";
@@ -291,7 +289,8 @@ public class DictUtils {
limit = Integer.MAX_VALUE;
}
String sql = String.format(sqlPattern, dimBizName, tableStr, where, dimBizName, limit);
String sql =
String.format(sqlPattern, dimBizName, tableStr, where, dimBizName, limit);
Set<Long> modelIds = new HashSet<>();
modelIds.add(dictItemResp.getModelId());
QuerySqlReq querySqlReq = new QuerySqlReq();

View File

@@ -109,8 +109,7 @@ public class QueryUtils {
column.setModelId(metric.getModelId());
}
// if column nameEn contains metric alias, use metric dataFormatType
if (column.getDataFormatType() == null
&& StringUtils.isNotEmpty(metric.getAlias())) {
if (column.getDataFormatType() == null && StringUtils.isNotEmpty(metric.getAlias())) {
for (String alias : metric.getAlias().split(",")) {
if (nameEn.contains(alias)) {
column.setDataFormatType(metric.getDataFormatType());