mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-12 04:27:39 +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) {
|
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();
|
SemanticSchemaResp semanticSchemaResp = queryStatement.getSemanticSchema();
|
||||||
DatabaseResp database = semanticSchemaResp.getDatabaseResp();
|
DatabaseResp database = semanticSchemaResp.getDatabaseResp();
|
||||||
String sql = queryStatement.getSql();
|
String sql = queryStatement.getSql();
|
||||||
DbAdaptor engineAdaptor =
|
DbAdaptor engineAdaptor = DbAdaptorFactory.getEngineAdaptor(database.getType());
|
||||||
DbAdaptorFactory.getEngineAdaptor(database.getType().toLowerCase());
|
|
||||||
if (Objects.nonNull(engineAdaptor)) {
|
if (Objects.nonNull(engineAdaptor)) {
|
||||||
String adaptedSql = engineAdaptor.rewriteSql(sql);
|
String adaptedSql = engineAdaptor.rewriteSql(sql);
|
||||||
queryStatement.setSql(adaptedSql);
|
queryStatement.setSql(adaptedSql);
|
||||||
|
|||||||
@@ -202,8 +202,7 @@ public class DatabaseServiceImpl extends ServiceImpl<DatabaseDOMapper, DatabaseD
|
|||||||
@Override
|
@Override
|
||||||
public List<String> getDbNames(Long id) throws SQLException {
|
public List<String> getDbNames(Long id) throws SQLException {
|
||||||
DatabaseResp databaseResp = getDatabase(id);
|
DatabaseResp databaseResp = getDatabase(id);
|
||||||
DbAdaptor dbAdaptor =
|
DbAdaptor dbAdaptor = DbAdaptorFactory.getEngineAdaptor(databaseResp.getType());
|
||||||
DbAdaptorFactory.getEngineAdaptor(databaseResp.getType().toUpperCase());
|
|
||||||
return dbAdaptor.getDBs(DatabaseConverter.getConnectInfo(databaseResp));
|
return dbAdaptor.getDBs(DatabaseConverter.getConnectInfo(databaseResp));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -271,26 +271,24 @@ public class ModelConverter {
|
|||||||
|
|
||||||
if (measures != null) {
|
if (measures != null) {
|
||||||
for (Measure measure : measures) {
|
for (Measure measure : measures) {
|
||||||
if (StringUtils.isBlank(measure.getBizName())) {
|
if (StringUtils.isNotBlank(measure.getBizName())
|
||||||
continue;
|
&& StringUtils.isBlank(measure.getExpr())) {
|
||||||
|
measure.setExpr(measure.getBizName());
|
||||||
}
|
}
|
||||||
measure.setExpr(measure.getBizName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dimensions != null) {
|
if (dimensions != null) {
|
||||||
for (Dimension dimension : dimensions) {
|
for (Dimension dimension : dimensions) {
|
||||||
if (StringUtils.isBlank(dimension.getBizName())) {
|
if (StringUtils.isNotBlank(dimension.getBizName())
|
||||||
continue;
|
&& StringUtils.isBlank(dimension.getExpr())) {
|
||||||
|
dimension.setExpr(dimension.getBizName());
|
||||||
}
|
}
|
||||||
dimension.setExpr(dimension.getBizName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (identifiers != null) {
|
if (identifiers != null) {
|
||||||
for (Identify identify : identifiers) {
|
for (Identify identify : identifiers) {
|
||||||
if (StringUtils.isBlank(identify.getBizName())) {
|
if (StringUtils.isNotBlank(identify.getBizName())
|
||||||
continue;
|
&& StringUtils.isBlank(identify.getName())) {
|
||||||
}
|
|
||||||
if (StringUtils.isBlank(identify.getName())) {
|
|
||||||
identify.setName(identify.getBizName());
|
identify.setName(identify.getBizName());
|
||||||
}
|
}
|
||||||
identify.setIsCreateDimension(1);
|
identify.setIsCreateDimension(1);
|
||||||
|
|||||||
Reference in New Issue
Block a user