This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new c43e2b1ac5a Code format for DropEncryptRuleExecutor (#34014)
c43e2b1ac5a is described below
commit c43e2b1ac5a531473cf20acbb9b4606c8c66145c
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Dec 12 00:07:47 2024 +0800
Code format for DropEncryptRuleExecutor (#34014)
---
.../encrypt/distsql/handler/update/DropEncryptRuleExecutor.java | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git
a/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleExecutor.java
b/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleExecutor.java
index 62b15525ef9..b130a7214fe 100644
---
a/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleExecutor.java
+++
b/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleExecutor.java
@@ -68,7 +68,7 @@ public final class DropEncryptRuleExecutor implements
DatabaseRuleDropExecutor<D
@Override
public EncryptRuleConfiguration buildToBeDroppedRuleConfiguration(final
DropEncryptRuleStatement sqlStatement) {
Collection<EncryptTableRuleConfiguration> toBeDroppedTables = new
LinkedList<>();
- Map<String, AlgorithmConfiguration> toBeDroppedEncryptors = new
HashMap<>();
+ Map<String, AlgorithmConfiguration> toBeDroppedEncryptors = new
HashMap<>(sqlStatement.getTables().size(), 1F);
for (String each : sqlStatement.getTables()) {
toBeDroppedTables.add(new EncryptTableRuleConfiguration(each,
Collections.emptyList()));
dropRule(each);
@@ -78,8 +78,7 @@ public final class DropEncryptRuleExecutor implements
DatabaseRuleDropExecutor<D
}
private void dropRule(final String ruleName) {
- Optional<EncryptTableRuleConfiguration> encryptTableRuleConfig =
rule.getConfiguration().getTables().stream()
- .filter(each ->
each.getName().equalsIgnoreCase(ruleName)).findAny();
+ Optional<EncryptTableRuleConfiguration> encryptTableRuleConfig =
rule.getConfiguration().getTables().stream().filter(each ->
each.getName().equalsIgnoreCase(ruleName)).findAny();
encryptTableRuleConfig.ifPresent(optional ->
rule.getConfiguration().getTables().remove(encryptTableRuleConfig.get()));
}