RaigorJiang commented on code in PR #24688:
URL: https://github.com/apache/shardingsphere/pull/24688#discussion_r1141774628
##########
features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleStatementUpdater.java:
##########
@@ -93,10 +94,13 @@ private Collection<String> getInvalidColumns(final String
tableName, final Colle
}
private void checkToBeCreatedEncryptors(final CreateEncryptRuleStatement
sqlStatement) {
- Collection<String> encryptors = new LinkedHashSet<>();
- sqlStatement.getRules().forEach(each ->
encryptors.addAll(each.getColumns().stream().map(column ->
column.getEncryptor().getName()).collect(Collectors.toSet())));
- Collection<String> notExistedEncryptors =
encryptors.stream().filter(each ->
!TypedSPILoader.contains(EncryptAlgorithm.class,
each)).collect(Collectors.toList());
- ShardingSpherePreconditions.checkState(notExistedEncryptors.isEmpty(),
() -> new InvalidAlgorithmConfigurationException("encryptor",
notExistedEncryptors));
+ Collection<AlgorithmSegment> encryptors = new LinkedHashSet<>();
+ sqlStatement.getRules().forEach(each ->
each.getColumns().forEach(column -> {
+ encryptors.add(column.getEncryptor());
+ encryptors.add(column.getAssistedQueryEncryptor());
+ encryptors.add(column.getLikeQueryEncryptor());
+ }));
+ encryptors.stream().filter(Objects::nonNull).forEach(each ->
TypedSPILoader.getService(EncryptAlgorithm.class, each.getName(),
each.getProps()));
Review Comment:
Maybe `TypedSPILoader.checkService` here.
--
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]