mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-10 11:07:06 +00:00
[fix][heaadless]bizName of ModelResp is not necessarily equal to table name.
This commit is contained in:
@@ -274,6 +274,8 @@ public class DictUtils {
|
|||||||
private QuerySqlReq constructQuerySqlReq(DictItemResp dictItemResp) {
|
private QuerySqlReq constructQuerySqlReq(DictItemResp dictItemResp) {
|
||||||
|
|
||||||
ModelResp model = modelService.getModel(dictItemResp.getModelId());
|
ModelResp model = modelService.getModel(dictItemResp.getModelId());
|
||||||
|
String tableStr = model.getModelDetail().getTableQuery() != null ? model.getModelDetail().getTableQuery()
|
||||||
|
: "(" + model.getModelDetail().getSqlQuery() + ")";
|
||||||
String sqlPattern =
|
String sqlPattern =
|
||||||
"select %s,count(1) from %s %s group by %s order by count(1) desc limit %d";
|
"select %s,count(1) from %s %s group by %s order by count(1) desc limit %d";
|
||||||
String dimBizName = dictItemResp.getBizName();
|
String dimBizName = dictItemResp.getBizName();
|
||||||
@@ -288,7 +290,7 @@ public class DictUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String sql =
|
String sql =
|
||||||
String.format(sqlPattern, dimBizName, model.getBizName(), where, dimBizName, limit);
|
String.format(sqlPattern, dimBizName, tableStr, where, dimBizName, limit);
|
||||||
Set<Long> modelIds = new HashSet<>();
|
Set<Long> modelIds = new HashSet<>();
|
||||||
modelIds.add(dictItemResp.getModelId());
|
modelIds.add(dictItemResp.getModelId());
|
||||||
QuerySqlReq querySqlReq = new QuerySqlReq();
|
QuerySqlReq querySqlReq = new QuerySqlReq();
|
||||||
|
|||||||
Reference in New Issue
Block a user