mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-10 11:07:06 +00:00
[fix][headless]Fix expr conversion issue.
This commit is contained in:
@@ -21,6 +21,6 @@ public class DbAdaptorFactory {
|
||||
}
|
||||
|
||||
public static DbAdaptor getEngineAdaptor(String engineType) {
|
||||
return dbAdaptorMap.get(engineType);
|
||||
return dbAdaptorMap.get(engineType.toUpperCase());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,8 +26,7 @@ public class DbDialectOptimizer implements QueryOptimizer {
|
||||
SemanticSchemaResp semanticSchemaResp = queryStatement.getSemanticSchema();
|
||||
DatabaseResp database = semanticSchemaResp.getDatabaseResp();
|
||||
String sql = queryStatement.getSql();
|
||||
DbAdaptor engineAdaptor =
|
||||
DbAdaptorFactory.getEngineAdaptor(database.getType().toLowerCase());
|
||||
DbAdaptor engineAdaptor = DbAdaptorFactory.getEngineAdaptor(database.getType());
|
||||
if (Objects.nonNull(engineAdaptor)) {
|
||||
String adaptedSql = engineAdaptor.rewriteSql(sql);
|
||||
queryStatement.setSql(adaptedSql);
|
||||
|
||||
@@ -202,8 +202,7 @@ public class DatabaseServiceImpl extends ServiceImpl<DatabaseDOMapper, DatabaseD
|
||||
@Override
|
||||
public List<String> getDbNames(Long id) throws SQLException {
|
||||
DatabaseResp databaseResp = getDatabase(id);
|
||||
DbAdaptor dbAdaptor =
|
||||
DbAdaptorFactory.getEngineAdaptor(databaseResp.getType().toUpperCase());
|
||||
DbAdaptor dbAdaptor = DbAdaptorFactory.getEngineAdaptor(databaseResp.getType());
|
||||
return dbAdaptor.getDBs(DatabaseConverter.getConnectInfo(databaseResp));
|
||||
}
|
||||
|
||||
|
||||
@@ -271,26 +271,24 @@ public class ModelConverter {
|
||||
|
||||
if (measures != null) {
|
||||
for (Measure measure : measures) {
|
||||
if (StringUtils.isBlank(measure.getBizName())) {
|
||||
continue;
|
||||
if (StringUtils.isNotBlank(measure.getBizName())
|
||||
&& StringUtils.isBlank(measure.getExpr())) {
|
||||
measure.setExpr(measure.getBizName());
|
||||
}
|
||||
measure.setExpr(measure.getBizName());
|
||||
}
|
||||
}
|
||||
if (dimensions != null) {
|
||||
for (Dimension dimension : dimensions) {
|
||||
if (StringUtils.isBlank(dimension.getBizName())) {
|
||||
continue;
|
||||
if (StringUtils.isNotBlank(dimension.getBizName())
|
||||
&& StringUtils.isBlank(dimension.getExpr())) {
|
||||
dimension.setExpr(dimension.getBizName());
|
||||
}
|
||||
dimension.setExpr(dimension.getBizName());
|
||||
}
|
||||
}
|
||||
if (identifiers != null) {
|
||||
for (Identify identify : identifiers) {
|
||||
if (StringUtils.isBlank(identify.getBizName())) {
|
||||
continue;
|
||||
}
|
||||
if (StringUtils.isBlank(identify.getName())) {
|
||||
if (StringUtils.isNotBlank(identify.getBizName())
|
||||
&& StringUtils.isBlank(identify.getName())) {
|
||||
identify.setName(identify.getBizName());
|
||||
}
|
||||
identify.setIsCreateDimension(1);
|
||||
|
||||
Reference in New Issue
Block a user