strongduanmu commented on a change in pull request #14197:
URL: https://github.com/apache/shardingsphere/pull/14197#discussion_r773144253
##########
File path:
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/ShowTablesExecutor.java
##########
@@ -78,7 +78,7 @@ private QueryResult getQueryResult(final String schemaName) {
private Collection<String> getAllTableNames(final String schemaName) {
Collection<String> allTableNames =
ProxyContext.getInstance().getMetaData(schemaName).getSchema().getAllTableNames();
if (showTablesStatement.getFilter().isPresent()) {
- Optional<String> pattern =
showTablesStatement.getFilter().get().getLike().map(each ->
SQLUtil.convertLikePatternToRegex(each.getPattern()));
+ Optional<String> pattern =
showTablesStatement.getFilter().get().getLike().map(each ->
SQLUtil.convertLikePatternToRegex(each.getPattern().toLowerCase()));
return pattern.isPresent() ? allTableNames.stream().filter(each ->
each.matches(pattern.get())).collect(Collectors.toList()) : allTableNames;
Review comment:
> In addition,In the implement of ShardingSphere, treat all table names
in lower case.
>
> ```java
> public final class ShardingSphereSchema {
>
> private final Map<String, TableMetaData> tables;
>
> @SuppressWarnings("CollectionWithoutInitialCapacity")
> public ShardingSphereSchema() {
> tables = new ConcurrentHashMap<>();
> }
>
> public ShardingSphereSchema(final Map<String, TableMetaData> tables) {
> this.tables = new ConcurrentHashMap<>(tables.size(), 1);
> tables.forEach((key, value) -> this.tables.put(key.toLowerCase(),
value));
> }
> ```
@MingxingLAI Only the key is lowercase, and all the real information is
stored in the values. So, I think we can use values to handle show tables logic.
--
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]