strongduanmu commented on a change in pull request #12504:
URL: https://github.com/apache/shardingsphere/pull/12504#discussion_r715720601
##########
File path:
shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/impl/EncryptProjectionTokenGenerator.java
##########
@@ -63,10 +75,19 @@ protected boolean isGenerateSQLTokenForEncrypt(final
SQLStatementContext sqlStat
@Override
public Collection<SubstitutableColumnNameToken> generateSQLTokens(final
SelectStatementContext selectStatementContext) {
ProjectionsSegment projectionsSegment =
selectStatementContext.getSqlStatement().getProjections();
- // TODO process multiple tables
- String tableName =
selectStatementContext.getAllTables().iterator().next().getTableName().getIdentifier().getValue();
- return getEncryptRule().findEncryptTable(tableName).map(
- encryptTable -> generateSQLTokens(projectionsSegment, tableName,
selectStatementContext, encryptTable)).orElseGet(Collections::emptyList);
+ Collection<SubstitutableColumnNameToken> result = new HashSet<>();
+ Collection<String> tableNames =
selectStatementContext.getTablesContext().getTableNames();
+ for (String each : tableNames) {
+ Optional<EncryptTable> encryptTable =
getEncryptRule().findEncryptTable(each);
+ if (encryptTable.isPresent()) {
+ Collection<SubstitutableColumnNameToken> sqlTokens =
generateSQLTokens(projectionsSegment, each, selectStatementContext,
encryptTable.get());
+ result.addAll(sqlTokens);
+ }
+ }
+ if (selectStatementContext.isContainsJoinQuery()) {
Review comment:
If it is to deal with the rewriting in the join condition, please move
it to `EncryptPredicateColumnTokenGenerator`.
--
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]