lanchengx commented on a change in pull request #13692:
URL: https://github.com/apache/shardingsphere/pull/13692#discussion_r752826083
##########
File path:
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/postgresql/executor/SelectDatabaseExecutor.java
##########
@@ -41,24 +41,43 @@
private static final String DATABASE_NAME = "databasename";
+ private static final String DATNAME = "datname";
+
+ private static final String NAME = "name";
+
private final Set<String> columnNames = new LinkedHashSet<>();
private final SelectStatement sqlStatement;
private String databaseNameAlias = DATABASE_NAME;
+ private boolean isQueryDatabase;
+
public SelectDatabaseExecutor(final SelectStatement sqlStatement, final
String sql) {
super(sql);
this.sqlStatement = sqlStatement;
}
@Override
protected void createPreProcessing() {
+ removeDuplicatedRow();
+ addDefaultRow();
+ }
+
+ private void addDefaultRow() {
LinkedList<String> schemaWithoutDataSource =
ProxyContext.getInstance().getAllSchemaNames().stream()
.filter(each ->
!hasDatasource(each)).collect(Collectors.toCollection(LinkedList::new));
schemaWithoutDataSource.forEach(each ->
getRows().addLast(getDefaultRowData(each)));
}
+ private void removeDuplicatedRow() {
+ if (isQueryDatabase) {
+ List<Map<String, Object>> beRemovedRow =
getRows().stream().collect(Collectors.groupingBy(each ->
each.get(databaseNameAlias), Collectors.toCollection(LinkedList::new)))
Review comment:
copy that 🥷
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]