From 1f4e4f3f2fa1b9ac3147193780bdfe3cb97f889c Mon Sep 17 00:00:00 2001 From: duanzhengqiang Date: Thu, 19 Dec 2024 10:01:48 +0800 Subject: [PATCH] Minor refactor for EncryptProjectionTokenGenerator --- .../encrypt/rewrite/token/EncryptTokenGenerateBuilder.java | 2 +- .../generator/projection/EncryptProjectionTokenGenerator.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/EncryptTokenGenerateBuilder.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/EncryptTokenGenerateBuilder.java index 35b742671646f..eaaaee9c05e51 100644 --- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/EncryptTokenGenerateBuilder.java +++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/EncryptTokenGenerateBuilder.java @@ -18,7 +18,6 @@ package org.apache.shardingsphere.encrypt.rewrite.token; import lombok.RequiredArgsConstructor; -import org.apache.shardingsphere.infra.rewrite.sql.token.common.generator.aware.DatabaseAware; import org.apache.shardingsphere.encrypt.rewrite.aware.EncryptConditionsAware; import org.apache.shardingsphere.encrypt.rewrite.condition.EncryptCondition; import org.apache.shardingsphere.encrypt.rewrite.token.generator.assignment.EncryptInsertAssignmentTokenGenerator; @@ -42,6 +41,7 @@ import org.apache.shardingsphere.infra.binder.context.statement.SQLStatementContext; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.rewrite.sql.token.common.generator.SQLTokenGenerator; +import org.apache.shardingsphere.infra.rewrite.sql.token.common.generator.aware.DatabaseAware; import org.apache.shardingsphere.infra.rewrite.sql.token.common.generator.builder.SQLTokenGeneratorBuilder; import java.util.Collection; diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/projection/EncryptProjectionTokenGenerator.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/projection/EncryptProjectionTokenGenerator.java index b21c0a186bee0..03bde3d645dd0 100644 --- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/projection/EncryptProjectionTokenGenerator.java +++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/projection/EncryptProjectionTokenGenerator.java @@ -68,8 +68,9 @@ public final class EncryptProjectionTokenGenerator { * @return generated SQL tokens */ public Collection generateSQLTokens(final SelectStatementContext selectStatementContext) { - Collection result = new LinkedList<>(generateSelectSQLTokens(selectStatementContext)); + Collection result = new LinkedList<>(); selectStatementContext.getSubqueryContexts().values().stream().map(this::generateSQLTokens).forEach(result::addAll); + result.addAll(generateSelectSQLTokens(selectStatementContext)); return result; }