This is an automated email from the ASF dual-hosted git repository.

zhaojinchao 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 9bfb8c42978 Support encrypt column rewrite when combine statement 
contains same table (#30694)
9bfb8c42978 is described below

commit 9bfb8c42978ab067c36e886771fb704c83b045fe
Author: Zhengqiang Duan <[email protected]>
AuthorDate: Sat Mar 30 19:04:02 2024 +0800

    Support encrypt column rewrite when combine statement contains same table 
(#30694)
    
    * Support encrypt column rewrite when combine statement contains same table
    
    * fix unit test
    
    * fix checkstyle
---
 .../shardingsphere/sql/parser/sql/common/util/SubqueryExtractUtils.java | 2 ++
 .../sql/parser/sql/common/util/SubqueryExtractUtilsTest.java            | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/util/SubqueryExtractUtils.java
 
b/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/util/SubqueryExtractUtils.java
index 0df855ff77d..aae36cf8a17 100644
--- 
a/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/util/SubqueryExtractUtils.java
+++ 
b/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/util/SubqueryExtractUtils.java
@@ -161,6 +161,8 @@ public final class SubqueryExtractUtils {
     }
     
     private static void extractSubquerySegmentsFromCombine(final 
List<SubquerySegment> result, final CombineSegment combineSegment) {
+        result.add(combineSegment.getLeft());
+        result.add(combineSegment.getRight());
         extractSubquerySegments(result, combineSegment.getLeft().getSelect());
         extractSubquerySegments(result, combineSegment.getRight().getSelect());
     }
diff --git 
a/parser/sql/statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/common/util/SubqueryExtractUtilsTest.java
 
b/parser/sql/statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/common/util/SubqueryExtractUtilsTest.java
index 7b9fadcd595..c0fe12beaff 100644
--- 
a/parser/sql/statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/common/util/SubqueryExtractUtilsTest.java
+++ 
b/parser/sql/statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/common/util/SubqueryExtractUtilsTest.java
@@ -174,7 +174,7 @@ class SubqueryExtractUtilsTest {
         SubquerySegment left = new SubquerySegment(0, 0, new 
MySQLSelectStatement(), "");
         selectStatement.setCombine(new CombineSegment(0, 0, left, 
CombineType.UNION, createSelectStatementForCombineSegment()));
         Collection<SubquerySegment> actual = 
SubqueryExtractUtils.getSubquerySegments(selectStatement);
-        assertThat(actual.size(), is(1));
+        assertThat(actual.size(), is(3));
     }
     
     private SubquerySegment createSelectStatementForCombineSegment() {

Reply via email to