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

jianglongtao 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 8b107d3cd9d Disallow DDL of cipher column, except ADD (#27336)
8b107d3cd9d is described below

commit 8b107d3cd9d205614229b012d9cef0d83fac0941
Author: ChenJiaHao <[email protected]>
AuthorDate: Fri Jul 21 14:22:42 2023 +0800

    Disallow DDL of cipher column, except ADD (#27336)
    
    * Disallow DDL of cipher column, except ADD
    
    * Remove invalid IT cases
    
    * Fix code style
    
    * Fix code style
---
 .../generator/EncryptAlterTableTokenGenerator.java | 36 +++----------------
 .../EncryptAlterTableTokenGeneratorTest.java       | 42 +++-------------------
 .../alter_change.xml                               | 25 -------------
 .../alter_drop.xml                                 | 24 -------------
 .../alter_modify_encrypt_column.xml                | 25 -------------
 .../cases/ddl/dataset/encrypt/alter_change.xml     | 25 -------------
 .../cases/ddl/dataset/encrypt/alter_drop.xml       | 24 -------------
 .../encrypt/alter_modify_encrypt_column.xml        | 25 -------------
 .../alter_change.xml                               | 25 -------------
 .../encrypt_and_readwrite_splitting/alter_drop.xml | 24 -------------
 .../alter_modify_encrypt_column.xml                | 25 -------------
 .../dataset/sharding_and_encrypt/alter_change.xml  | 25 -------------
 .../dataset/sharding_and_encrypt/alter_drop.xml    | 24 -------------
 .../alter_modify_encrypt_column.xml                | 25 -------------
 .../cases/ddl/ddl-integration-alter-table.xml      | 20 -----------
 .../query-with-cipher/ddl/alter/alter-table.xml    | 37 +------------------
 16 files changed, 11 insertions(+), 420 deletions(-)

diff --git 
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptAlterTableTokenGenerator.java
 
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptAlterTableTokenGenerator.java
index d91bdd7b3f9..7dc561d3d11 100644
--- 
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptAlterTableTokenGenerator.java
+++ 
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptAlterTableTokenGenerator.java
@@ -133,27 +133,12 @@ public final class EncryptAlterTableTokenGenerator 
implements CollectionSQLToken
         Collection<SQLToken> result = new LinkedList<>();
         for (ModifyColumnDefinitionSegment each : segments) {
             String columnName = 
each.getColumnDefinition().getColumnName().getIdentifier().getValue();
-            if (encryptTable.isEncryptColumn(columnName)) {
-                
result.addAll(getModifyColumnTokens(encryptTable.getEncryptColumn(columnName), 
each));
-            }
+            
ShardingSpherePreconditions.checkState(!encryptTable.isEncryptColumn(columnName),
 () -> new UnsupportedOperationException("Unsupported operation 'modify' for 
the cipher column"));
             each.getColumnPosition().flatMap(optional -> 
getColumnPositionToken(encryptTable, optional)).ifPresent(result::add);
         }
         return result;
     }
     
-    private Collection<SQLToken> getModifyColumnTokens(final EncryptColumn 
encryptColumn, final ModifyColumnDefinitionSegment segment) {
-        Collection<SQLToken> result = new LinkedList<>();
-        ColumnDefinitionSegment columnDefinitionSegment = 
segment.getColumnDefinition();
-        result.add(new 
RemoveToken(columnDefinitionSegment.getColumnName().getStartIndex(), 
columnDefinitionSegment.getColumnName().getStopIndex()));
-        result.add(new 
EncryptAlterTableToken(columnDefinitionSegment.getColumnName().getStopIndex() + 
1, columnDefinitionSegment.getColumnName().getStopIndex(),
-                encryptColumn.getCipher().getName(), null));
-        encryptColumn.getAssistedQuery().map(optional -> new 
EncryptAlterTableToken(segment.getStopIndex() + 1,
-                columnDefinitionSegment.getColumnName().getStopIndex(), 
optional.getName(), ", MODIFY COLUMN")).ifPresent(result::add);
-        encryptColumn.getLikeQuery().map(optional -> new 
EncryptAlterTableToken(segment.getStopIndex() + 1,
-                columnDefinitionSegment.getColumnName().getStopIndex(), 
optional.getName(), ", MODIFY COLUMN")).ifPresent(result::add);
-        return result;
-    }
-    
     private Optional<SQLToken> getColumnPositionToken(final EncryptTable 
encryptTable, final ColumnPositionSegment segment) {
         if (null == segment.getColumnName()) {
             return Optional.empty();
@@ -165,6 +150,8 @@ public final class EncryptAlterTableTokenGenerator 
implements CollectionSQLToken
     private Collection<SQLToken> getChangeColumnTokens(final EncryptTable 
encryptTable, final Collection<ChangeColumnDefinitionSegment> segments) {
         Collection<SQLToken> result = new LinkedList<>();
         for (ChangeColumnDefinitionSegment each : segments) {
+            String columnName = 
each.getPreviousColumn().getIdentifier().getValue();
+            
ShardingSpherePreconditions.checkState(!encryptTable.isEncryptColumn(columnName),
 () -> new UnsupportedOperationException("Unsupported operation 'change' for 
the cipher column"));
             result.addAll(getChangeColumnTokens(encryptTable, each));
             each.getColumnPosition().flatMap(optional -> 
getColumnPositionToken(encryptTable, optional)).ifPresent(result::add);
         }
@@ -238,25 +225,12 @@ public final class EncryptAlterTableTokenGenerator 
implements CollectionSQLToken
     private Collection<SQLToken> getDropColumnTokens(final EncryptTable 
encryptTable, final DropColumnDefinitionSegment segment) {
         Collection<SQLToken> result = new LinkedList<>();
         for (ColumnSegment each : segment.getColumns()) {
-            String columnName = each.getQualifiedName();
-            if (encryptTable.isEncryptColumn(columnName)) {
-                
result.addAll(getDropColumnTokens(encryptTable.getEncryptColumn(columnName), 
each, segment));
-            }
+            
ShardingSpherePreconditions.checkState(!encryptTable.isEncryptColumn(each.getQualifiedName()),
+                    () -> new UnsupportedOperationException("Unsupported 
operation 'drop' for the cipher column"));
         }
         return result;
     }
     
-    private Collection<SQLToken> getDropColumnTokens(final EncryptColumn 
encryptColumn, final ColumnSegment columnSegment, final 
DropColumnDefinitionSegment dropColumnDefinitionSegment) {
-        Collection<SQLToken> result = new LinkedList<>();
-        result.add(new RemoveToken(columnSegment.getStartIndex(), 
columnSegment.getStopIndex()));
-        result.add(new EncryptAlterTableToken(columnSegment.getStopIndex() + 
1, columnSegment.getStopIndex(), encryptColumn.getCipher().getName(), null));
-        encryptColumn.getAssistedQuery().map(optional -> new 
EncryptAlterTableToken(dropColumnDefinitionSegment.getStopIndex() + 1,
-                dropColumnDefinitionSegment.getStopIndex(), 
optional.getName(), ", DROP COLUMN")).ifPresent(result::add);
-        encryptColumn.getLikeQuery().map(optional -> new 
EncryptAlterTableToken(dropColumnDefinitionSegment.getStopIndex() + 1,
-                dropColumnDefinitionSegment.getStopIndex(), 
optional.getName(), ", DROP COLUMN")).ifPresent(result::add);
-        return result;
-    }
-    
     private Collection<SQLToken> mergeDropColumnStatement(final List<SQLToken> 
dropSQLTokens, final String leftJoiner, final String rightJoiner) {
         Collection<SQLToken> result = new LinkedList<>();
         Collection<String> dropColumns = new LinkedList<>();
diff --git 
a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptAlterTableTokenGeneratorTest.java
 
b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptAlterTableTokenGeneratorTest.java
index 98beb5f2b1e..43d0a8340a4 100644
--- 
a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptAlterTableTokenGeneratorTest.java
+++ 
b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptAlterTableTokenGeneratorTest.java
@@ -47,6 +47,7 @@ import java.util.Iterator;
 import static org.hamcrest.CoreMatchers.instanceOf;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
@@ -122,23 +123,8 @@ class EncryptAlterTableTokenGeneratorTest {
     }
     
     @Test
-    void assertModifyColumnGenerateSQLTokens() {
-        Collection<SQLToken> actual = 
generator.generateSQLTokens(mockModifyColumnStatementContext());
-        assertThat(actual.size(), is(4));
-        Iterator<SQLToken> actualIterator = actual.iterator();
-        assertThat(actualIterator.next(), instanceOf(RemoveToken.class));
-        EncryptAlterTableToken cipherToken = (EncryptAlterTableToken) 
actualIterator.next();
-        assertThat(cipherToken.toString(), is("cipher_certificate_number"));
-        assertThat(cipherToken.getStartIndex(), is(54));
-        assertThat(cipherToken.getStopIndex(), is(53));
-        EncryptAlterTableToken assistedToken = (EncryptAlterTableToken) 
actualIterator.next();
-        assertThat(assistedToken.toString(), is(", MODIFY COLUMN 
assisted_certificate_number"));
-        assertThat(assistedToken.getStartIndex(), is(71));
-        assertThat(assistedToken.getStopIndex(), is(53));
-        EncryptAlterTableToken likeToken = (EncryptAlterTableToken) 
actualIterator.next();
-        assertThat(likeToken.toString(), is(", MODIFY COLUMN 
like_certificate_number"));
-        assertThat(likeToken.getStartIndex(), is(71));
-        assertThat(likeToken.getStopIndex(), is(53));
+    void assertModifyEncryptColumnGenerateSQLTokens() {
+        assertThrows(UnsupportedOperationException.class, () -> 
generator.generateSQLTokens(mockModifyColumnStatementContext()));
     }
     
     private AlterTableStatementContext mockModifyColumnStatementContext() {
@@ -151,26 +137,8 @@ class EncryptAlterTableTokenGeneratorTest {
     }
     
     @Test
-    void assertChangeColumnGenerateSQLTokens() {
-        Collection<SQLToken> actual = 
generator.generateSQLTokens(mockChangeColumnStatementContext());
-        assertThat(actual.size(), is(6));
-        Iterator<SQLToken> actualIterator = actual.iterator();
-        assertThat(actualIterator.next(), instanceOf(RemoveToken.class));
-        EncryptAlterTableToken previous = (EncryptAlterTableToken) 
actualIterator.next();
-        assertThat(previous.toString(), is("cipher_certificate_number"));
-        assertThat(actualIterator.next(), instanceOf(RemoveToken.class));
-        EncryptAlterTableToken cipherToken = (EncryptAlterTableToken) 
actualIterator.next();
-        assertThat(cipherToken.toString(), 
is("cipher_certificate_number_new"));
-        assertThat(cipherToken.getStartIndex(), is(77));
-        assertThat(cipherToken.getStopIndex(), is(76));
-        EncryptAlterTableToken assistedToken = (EncryptAlterTableToken) 
actualIterator.next();
-        assertThat(assistedToken.toString(), is(", CHANGE COLUMN 
assisted_certificate_number assisted_certificate_number_new"));
-        assertThat(assistedToken.getStartIndex(), is(94));
-        assertThat(assistedToken.getStopIndex(), is(76));
-        EncryptAlterTableToken likeToken = (EncryptAlterTableToken) 
actualIterator.next();
-        assertThat(likeToken.toString(), is(", CHANGE COLUMN 
like_certificate_number like_certificate_number_new"));
-        assertThat(likeToken.getStartIndex(), is(94));
-        assertThat(likeToken.getStopIndex(), is(76));
+    void assertChangeEncryptColumnGenerateSQLTokens() {
+        assertThrows(UnsupportedOperationException.class, () -> 
generator.generateSQLTokens(mockChangeColumnStatementContext()));
     }
     
     private AlterTableStatementContext mockChangeColumnStatementContext() {
diff --git 
a/test/e2e/sql/src/test/resources/cases/ddl/dataset/dbtbl_with_readwrite_splitting_and_encrypt/alter_change.xml
 
b/test/e2e/sql/src/test/resources/cases/ddl/dataset/dbtbl_with_readwrite_splitting_and_encrypt/alter_change.xml
deleted file mode 100644
index 9ddaf350819..00000000000
--- 
a/test/e2e/sql/src/test/resources/cases/ddl/dataset/dbtbl_with_readwrite_splitting_and_encrypt/alter_change.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~     http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-
-<dataset>
-    <metadata table-name="t_user_details" 
data-nodes="encrypt_write_ds_${0..9}.t_user_details_${0..9},encrypt_read_ds_${0..9}.t_user_details_${0..9}">
-        <column name="user_id" type="integer" />
-        <column name="address_id" type="integer" />
-        <column name="number_new_cipher" type="varchar" />
-        <column name="description" type="varchar" />
-    </metadata>
-</dataset>
diff --git 
a/test/e2e/sql/src/test/resources/cases/ddl/dataset/dbtbl_with_readwrite_splitting_and_encrypt/alter_drop.xml
 
b/test/e2e/sql/src/test/resources/cases/ddl/dataset/dbtbl_with_readwrite_splitting_and_encrypt/alter_drop.xml
deleted file mode 100644
index e6824dfce6c..00000000000
--- 
a/test/e2e/sql/src/test/resources/cases/ddl/dataset/dbtbl_with_readwrite_splitting_and_encrypt/alter_drop.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~     http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-
-<dataset>
-    <metadata table-name="t_user_details" 
data-nodes="encrypt_write_ds_${0..9}.t_user_details_${0..9},encrypt_read_ds_${0..9}.t_user_details_${0..9}">
-        <column name="user_id" type="integer" />
-        <column name="address_id" type="integer" />
-        <column name="description" type="varchar" />
-    </metadata>
-</dataset>
diff --git 
a/test/e2e/sql/src/test/resources/cases/ddl/dataset/dbtbl_with_readwrite_splitting_and_encrypt/alter_modify_encrypt_column.xml
 
b/test/e2e/sql/src/test/resources/cases/ddl/dataset/dbtbl_with_readwrite_splitting_and_encrypt/alter_modify_encrypt_column.xml
deleted file mode 100644
index b7eba95c91e..00000000000
--- 
a/test/e2e/sql/src/test/resources/cases/ddl/dataset/dbtbl_with_readwrite_splitting_and_encrypt/alter_modify_encrypt_column.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~     http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-
-<dataset>
-    <metadata table-name="t_user_details" 
data-nodes="encrypt_write_ds_${0..9}.t_user_details_${0..9},encrypt_read_ds_${0..9}.t_user_details_${0..9}">
-        <column name="user_id" type="integer" />
-        <column name="address_id" type="integer" />
-        <column name="description" type="varchar" />
-        <column name="number_cipher" type="integer" />
-    </metadata>
-</dataset>
diff --git 
a/test/e2e/sql/src/test/resources/cases/ddl/dataset/encrypt/alter_change.xml 
b/test/e2e/sql/src/test/resources/cases/ddl/dataset/encrypt/alter_change.xml
deleted file mode 100644
index e86b0b5cd85..00000000000
--- a/test/e2e/sql/src/test/resources/cases/ddl/dataset/encrypt/alter_change.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~     http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-
-<dataset>
-    <metadata table-name="t_user_details" data-nodes="encrypt.t_user_details">
-        <column name="user_id" type="integer" />
-        <column name="address_id" type="integer" />
-        <column name="number_new_cipher" type="varchar" />
-        <column name="description" type="varchar" />
-    </metadata>
-</dataset>
diff --git 
a/test/e2e/sql/src/test/resources/cases/ddl/dataset/encrypt/alter_drop.xml 
b/test/e2e/sql/src/test/resources/cases/ddl/dataset/encrypt/alter_drop.xml
deleted file mode 100644
index 6cebdc90d26..00000000000
--- a/test/e2e/sql/src/test/resources/cases/ddl/dataset/encrypt/alter_drop.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~     http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-
-<dataset>
-    <metadata table-name="t_user_details" data-nodes="encrypt.t_user_details">
-        <column name="user_id" type="integer" />
-        <column name="address_id" type="integer" />
-        <column name="description" type="varchar" />
-    </metadata>
-</dataset>
diff --git 
a/test/e2e/sql/src/test/resources/cases/ddl/dataset/encrypt/alter_modify_encrypt_column.xml
 
b/test/e2e/sql/src/test/resources/cases/ddl/dataset/encrypt/alter_modify_encrypt_column.xml
deleted file mode 100644
index 54899320367..00000000000
--- 
a/test/e2e/sql/src/test/resources/cases/ddl/dataset/encrypt/alter_modify_encrypt_column.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~     http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-
-<dataset>
-    <metadata table-name="t_user_details" data-nodes="encrypt.t_user_details">
-        <column name="user_id" type="integer" />
-        <column name="address_id" type="integer" />
-        <column name="description" type="varchar" />
-        <column name="number_cipher" type="integer" />
-    </metadata>
-</dataset>
diff --git 
a/test/e2e/sql/src/test/resources/cases/ddl/dataset/encrypt_and_readwrite_splitting/alter_change.xml
 
b/test/e2e/sql/src/test/resources/cases/ddl/dataset/encrypt_and_readwrite_splitting/alter_change.xml
deleted file mode 100644
index 0b03fb6bed6..00000000000
--- 
a/test/e2e/sql/src/test/resources/cases/ddl/dataset/encrypt_and_readwrite_splitting/alter_change.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~     http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-
-<dataset>
-    <metadata table-name="t_user_details" 
data-nodes="encrypt_write_ds.t_user_details,encrypt_read_ds.t_user_details">
-        <column name="user_id" type="integer" />
-        <column name="address_id" type="integer" />
-        <column name="number_new_cipher" type="varchar" />
-        <column name="description" type="varchar" />
-    </metadata>
-</dataset>
diff --git 
a/test/e2e/sql/src/test/resources/cases/ddl/dataset/encrypt_and_readwrite_splitting/alter_drop.xml
 
b/test/e2e/sql/src/test/resources/cases/ddl/dataset/encrypt_and_readwrite_splitting/alter_drop.xml
deleted file mode 100644
index 0a71ed90d28..00000000000
--- 
a/test/e2e/sql/src/test/resources/cases/ddl/dataset/encrypt_and_readwrite_splitting/alter_drop.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~     http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-
-<dataset>
-    <metadata table-name="t_user_details" 
data-nodes="encrypt_write_ds.t_user_details,encrypt_read_ds.t_user_details">
-        <column name="user_id" type="integer" />
-        <column name="address_id" type="integer" />
-        <column name="description" type="varchar" />
-    </metadata>
-</dataset>
diff --git 
a/test/e2e/sql/src/test/resources/cases/ddl/dataset/encrypt_and_readwrite_splitting/alter_modify_encrypt_column.xml
 
b/test/e2e/sql/src/test/resources/cases/ddl/dataset/encrypt_and_readwrite_splitting/alter_modify_encrypt_column.xml
deleted file mode 100644
index a327bfbcc85..00000000000
--- 
a/test/e2e/sql/src/test/resources/cases/ddl/dataset/encrypt_and_readwrite_splitting/alter_modify_encrypt_column.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~     http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-
-<dataset>
-    <metadata table-name="t_user_details" 
data-nodes="encrypt_write_ds.t_user_details,encrypt_read_ds.t_user_details">
-        <column name="user_id" type="integer" />
-        <column name="address_id" type="integer" />
-        <column name="description" type="varchar" />
-        <column name="number_cipher" type="integer" />
-    </metadata>
-</dataset>
diff --git 
a/test/e2e/sql/src/test/resources/cases/ddl/dataset/sharding_and_encrypt/alter_change.xml
 
b/test/e2e/sql/src/test/resources/cases/ddl/dataset/sharding_and_encrypt/alter_change.xml
deleted file mode 100644
index 76861ee0a2f..00000000000
--- 
a/test/e2e/sql/src/test/resources/cases/ddl/dataset/sharding_and_encrypt/alter_change.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~     http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-
-<dataset>
-    <metadata table-name="t_user_details" 
data-nodes="encrypt_ds_${0..9}.t_user_details_${0..9}">
-        <column name="user_id" type="integer" />
-        <column name="address_id" type="integer" />
-        <column name="number_new_cipher" type="varchar" />
-        <column name="description" type="varchar" />
-    </metadata>
-</dataset>
diff --git 
a/test/e2e/sql/src/test/resources/cases/ddl/dataset/sharding_and_encrypt/alter_drop.xml
 
b/test/e2e/sql/src/test/resources/cases/ddl/dataset/sharding_and_encrypt/alter_drop.xml
deleted file mode 100644
index 39807b3c4e9..00000000000
--- 
a/test/e2e/sql/src/test/resources/cases/ddl/dataset/sharding_and_encrypt/alter_drop.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~     http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-
-<dataset>
-    <metadata table-name="t_user_details" 
data-nodes="encrypt_ds_${0..9}.t_user_details_${0..9}">
-        <column name="user_id" type="integer" />
-        <column name="address_id" type="integer" />
-        <column name="description" type="varchar" />
-    </metadata>
-</dataset>
diff --git 
a/test/e2e/sql/src/test/resources/cases/ddl/dataset/sharding_and_encrypt/alter_modify_encrypt_column.xml
 
b/test/e2e/sql/src/test/resources/cases/ddl/dataset/sharding_and_encrypt/alter_modify_encrypt_column.xml
deleted file mode 100644
index dff9eac33ff..00000000000
--- 
a/test/e2e/sql/src/test/resources/cases/ddl/dataset/sharding_and_encrypt/alter_modify_encrypt_column.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~     http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-
-<dataset>
-    <metadata table-name="t_user_details" 
data-nodes="encrypt_ds_${0..9}.t_user_details_${0..9}">
-        <column name="user_id" type="integer" />
-        <column name="address_id" type="integer" />
-        <column name="description" type="varchar" />
-        <column name="number_cipher" type="integer" />
-    </metadata>
-</dataset>
diff --git 
a/test/e2e/sql/src/test/resources/cases/ddl/ddl-integration-alter-table.xml 
b/test/e2e/sql/src/test/resources/cases/ddl/ddl-integration-alter-table.xml
index 68aa8d0c737..f778fd73b2d 100644
--- a/test/e2e/sql/src/test/resources/cases/ddl/ddl-integration-alter-table.xml
+++ b/test/e2e/sql/src/test/resources/cases/ddl/ddl-integration-alter-table.xml
@@ -87,30 +87,10 @@
         </assertion>
     </test-case>
     
-    <test-case sql="ALTER TABLE t_user_details MODIFY number INT NOT NULL 
AFTER description" 
scenario-types="encrypt,dbtbl_with_readwrite_splitting_and_encrypt,sharding_and_encrypt,encrypt_and_readwrite_splitting"
 db-types="MySQL">
-        <assertion expected-data-file="alter_modify_encrypt_column.xml">
-            <initial-sql sql="CREATE TABLE t_user_details (user_id INT NOT 
NULL, address_id INT NOT NULL, number_cipher VARCHAR(45) NULL, description 
varchar(10))" affected-table="t_user_details" />
-            <destroy-sql sql="DROP TABLE t_user_details" />
-        </assertion>
-    </test-case>
-    
-    <test-case sql="ALTER TABLE t_user_details CHANGE number number_new 
VARCHAR(50)" db-types="MySQL" 
scenario-types="encrypt,dbtbl_with_readwrite_splitting_and_encrypt,sharding_and_encrypt,encrypt_and_readwrite_splitting">
-        <assertion expected-data-file="alter_change.xml">
-            <initial-sql sql="CREATE TABLE t_user_details (user_id INT NOT 
NULL, address_id INT NOT NULL, number_cipher VARCHAR(45) NULL, description 
varchar(10))" affected-table="t_user_details" />
-            <destroy-sql sql="DROP TABLE t_user_details" />
-        </assertion>
-    </test-case>
-    
     <!--    <test-case sql="ALTER TABLE t_user_details RENAME number TO 
number_new" db-types="PostgreSQL" 
scenario-types="encrypt,dbtbl_with_readwrite_splitting_and_encrypt">-->
     <!--        <assertion expected-data-file="alter_change.xml">-->
     <!--            <initial-sql sql="CREATE TABLE t_user_details (user_id INT 
NOT NULL, address_id INT NOT NULL, number_cipher VARCHAR(45) NULL, description 
varchar(10))" affected-table="t_user_details" />-->
     <!--        </assertion>-->
     <!--    </test-case>-->
     
-    <test-case sql="ALTER TABLE t_user_details DROP COLUMN number" 
db-types="MySQL,SQLServer,PostgreSQL,Oracle" 
scenario-types="encrypt,dbtbl_with_readwrite_splitting_and_encrypt,sharding_and_encrypt,encrypt_and_readwrite_splitting">
-        <assertion expected-data-file="alter_drop.xml">
-            <initial-sql sql="CREATE TABLE t_user_details (user_id INT NOT 
NULL, address_id INT NOT NULL, number_cipher VARCHAR(45) NULL, description 
varchar(10))" affected-table="t_user_details" />
-            <destroy-sql sql="DROP TABLE t_user_details" />
-        </assertion>
-    </test-case>
 </integration-test-cases>
diff --git 
a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-cipher/ddl/alter/alter-table.xml
 
b/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-cipher/ddl/alter/alter-table.xml
index 68cfc5d19f3..ea4701f39e5 100644
--- 
a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-cipher/ddl/alter/alter-table.xml
+++ 
b/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-cipher/ddl/alter/alter-table.xml
@@ -17,16 +17,6 @@
   -->
 
 <rewrite-assertions yaml-rule="scenario/encrypt/config/query-with-cipher.yaml">
-    <rewrite-assertion id="alter_table_modify_column_amount_for_cipher" 
db-types="MySQL">
-        <input sql="ALTER TABLE t_account MODIFY COLUMN amount text" />
-        <output sql="ALTER TABLE t_account MODIFY COLUMN cipher_amount text" />
-    </rewrite-assertion>
-
-    <rewrite-assertion id="alter_table_change_column_amount_for_cipher" 
db-types="MySQL">
-        <input sql="ALTER TABLE t_account CHANGE COLUMN amount amount_new 
text" />
-        <output sql="ALTER TABLE t_account CHANGE COLUMN cipher_amount 
amount_new_cipher text" />
-    </rewrite-assertion>
-
     <rewrite-assertion id="alter_table_add_column_with_position_cipher" 
db-types="MySQL">
         <input sql="ALTER TABLE t_account ADD COLUMN status text AFTER amount" 
/>
         <output sql="ALTER TABLE t_account ADD COLUMN status text AFTER 
cipher_amount" />
@@ -46,32 +36,7 @@
         <input sql="ALTER TABLE t_account_bak ADD COLUMN id int not null, ADD 
COLUMN password varchar(255) not null default ''" />
         <output sql="ALTER TABLE t_account_bak ADD COLUMN id int not null, ADD 
COLUMN cipher_password varchar(255) not null default '', ADD COLUMN 
assisted_query_password varchar(255) not null default '', ADD COLUMN 
like_query_password varchar(255) not null default ''" />
     </rewrite-assertion>
-
-    <rewrite-assertion id="alter_table_modify_column_for_cipher" 
db-types="MySQL">
-        <input sql="ALTER TABLE t_account_bak MODIFY COLUMN password 
varchar(255) not null default ''" />
-        <output sql="ALTER TABLE t_account_bak MODIFY COLUMN cipher_password 
varchar(255) not null default '', MODIFY COLUMN assisted_query_password 
varchar(255) not null default '', MODIFY COLUMN like_query_password 
varchar(255) not null default ''" />
-    </rewrite-assertion>
-
-    <rewrite-assertion id="alter_table_change_column_for_cipher" 
db-types="MySQL">
-        <input sql="ALTER TABLE t_account_bak CHANGE COLUMN password 
password_new varchar(255) not null default ''" />
-        <output sql="ALTER TABLE t_account_bak CHANGE COLUMN cipher_password 
password_new_cipher varchar(255) not null default '', CHANGE COLUMN 
assisted_query_password password_new_assisted varchar(255) not null default '', 
CHANGE COLUMN like_query_password password_new_like varchar(255) not null 
default ''" />
-    </rewrite-assertion>
-
-    <rewrite-assertion id="alter_table_drop_column_for_cipher" 
db-types="MySQL">
-        <input sql="ALTER TABLE t_account_bak DROP COLUMN password" />
-        <output sql="ALTER TABLE t_account_bak DROP COLUMN cipher_password, 
DROP COLUMN assisted_query_password, DROP COLUMN like_query_password" />
-    </rewrite-assertion>
-
-    <rewrite-assertion id="alter_table_drop_columns_for_cipher" 
db-types="MySQL">
-        <input sql="ALTER TABLE t_account_bak DROP COLUMN password, DROP 
COLUMN amount" />
-        <output sql="ALTER TABLE t_account_bak DROP COLUMN cipher_password, 
DROP COLUMN assisted_query_password, DROP COLUMN like_query_password, DROP 
COLUMN cipher_amount" />
-    </rewrite-assertion>
-
-    <rewrite-assertion id="alter_table_drop_mix_columns_for_cipher" 
db-types="MySQL">
-        <input sql="ALTER TABLE t_account_bak DROP COLUMN password, DROP 
COLUMN id" />
-        <output sql="ALTER TABLE t_account_bak DROP COLUMN cipher_password, 
DROP COLUMN assisted_query_password, DROP COLUMN like_query_password, DROP 
COLUMN id" />
-    </rewrite-assertion>
-
+    
     <rewrite-assertion id="alter_table_add_index_for_cipher" db-types="MySQL">
         <input sql="ALTER TABLE t_account_bak ADD INDEX 
t_account_bak_amount(`amount`)" />
         <output sql="ALTER TABLE t_account_bak ADD INDEX 
t_account_bak_amount(`cipher_amount`)" />


Reply via email to