Merge pull request #13580 from dataease/pr@dev-v2@fixds

Pr@dev v2@fixds
This commit is contained in:
xuwei-fit2cloud 2024-11-26 18:51:35 +08:00 committed by GitHub
commit f6b4c0ea45
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 25 additions and 13 deletions

View File

@ -157,10 +157,22 @@ public class SqlparserUtils {
for (Join join : joins) {
FromItem rightItem = join.getRightItem();
if (rightItem instanceof ParenthesedSelect) {
PlainSelect selectBody = ((ParenthesedSelect) rightItem).getPlainSelect();
Select subSelectTmp = (Select) CCJSqlParserUtil.parse(removeVariables(selectBody.toString(), dsType));
PlainSelect subPlainSelect = ((PlainSelect) subSelectTmp.getSelectBody());
((ParenthesedSelect) rightItem).setSelect(subPlainSelect);
try {
PlainSelect selectBody = ((ParenthesedSelect) rightItem).getPlainSelect();
Select subSelectTmp = (Select) CCJSqlParserUtil.parse(removeVariables(selectBody.toString(), dsType));
PlainSelect subPlainSelect = ((PlainSelect) subSelectTmp.getSelectBody());
((ParenthesedSelect) rightItem).setSelect(subPlainSelect);
}catch ( Exception e ){
SetOperationList select = ((ParenthesedSelect) rightItem).getSetOperationList();
SetOperationList setOperationList = new SetOperationList();
setOperationList.setSelects(new ArrayList<>());
setOperationList.setOperations(select.getOperations());
for (Select selectSelect : select.getSelects()) {
Select subSelectTmp = (Select) CCJSqlParserUtil.parse(removeVariables(selectSelect.toString(), dsType));
setOperationList.getSelects().add(subSelectTmp);
}
((ParenthesedSelect) rightItem).setSelect(setOperationList);
}
if (dsType.equals(DatasourceConfiguration.DatasourceType.oracle.getType())) {
rightItem.setAlias(new Alias(rightItem.getAlias().toString(), false));
} else {

View File

@ -989,16 +989,16 @@ public class DatasourceServer implements DatasourceApi {
datasources.forEach(datasource -> {
if (!syncDsIds.contains(datasource.getId())) {
syncDsIds.add(datasource.getId());
commonThreadPool.addTask(() -> {
try {
LicenseUtil.validate();
validate(datasource);
} catch (Exception e) {
} finally {
syncDsIds.removeIf(id -> id.equals(datasource.getId()));
}
});
}
commonThreadPool.addTask(() -> {
try {
LicenseUtil.validate();
validate(datasource);
} catch (Exception e) {
} finally {
syncDsIds.removeIf(id -> id.equals(datasource.getId()));
}
});
});
}