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

duanzhengqiang 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 6aecf54e040 refactor encrypt configuration (#18080)
6aecf54e040 is described below

commit 6aecf54e040a97f52e92840bcedb023e4bd8ac0e
Author: Chuxin Chen <[email protected]>
AuthorDate: Tue May 31 11:12:48 2022 +0800

    refactor encrypt configuration (#18080)
---
 .../rule/EncryptColumnRuleConfiguration.java       | 13 ----
 .../encrypt/spi/context/EncryptColumnDataType.java | 59 ---------------
 .../encrypt/spi/context/EncryptContext.java        | 46 -----------
 .../encrypt/context/EncryptContextBuilder.java     | 16 +---
 .../merge/dql/EncryptAlgorithmMetaData.java        |  2 +-
 .../metadata/EncryptSchemaMetaDataDecorator.java   | 10 +--
 ...OnDuplicateKeyUpdateValueParameterRewriter.java |  2 +-
 .../EncryptInsertValueParameterRewriter.java       |  2 +-
 .../generator/EncryptAlterTableTokenGenerator.java | 70 ++---------------
 .../EncryptCreateTableTokenGenerator.java          | 52 +------------
 .../EncryptInsertValuesTokenGenerator.java         |  2 +-
 .../token/pojo/EncryptConfigDataTypeToken.java     | 57 --------------
 .../shardingsphere/encrypt/rule/EncryptColumn.java |  9 ---
 .../shardingsphere/encrypt/rule/EncryptRule.java   | 49 ++----------
 .../shardingsphere/encrypt/rule/EncryptTable.java  | 23 +-----
 .../AlgorithmProvidedEncryptRuleBuilder.java       |  2 +-
 .../encrypt/rule/builder/EncryptRuleBuilder.java   |  2 +-
 .../encrypt/context/EncryptContextBuilderTest.java | 64 +---------------
 .../encrypt/merge/dql/EncryptMergedResultTest.java |  9 +--
 .../EncryptSchemaMetaDataDecoratorTest.java        | 33 --------
 .../impl/EncryptAlterTableTokenGeneratorTest.java  | 88 ++++++++--------------
 .../impl/EncryptCreateTableTokenGeneratorTest.java | 39 ++++------
 .../impl/EncryptProjectionTokenGeneratorTest.java  |  2 +-
 .../encrypt/rule/EncryptColumnDataTypeTest.java    | 41 ----------
 .../encrypt/rule/EncryptColumnTest.java            |  4 +-
 .../encrypt/rule/EncryptRuleTest.java              | 50 ++++++------
 .../encrypt/rule/EncryptTableTest.java             |  6 +-
 .../converter/EncryptRuleStatementConverter.java   |  5 +-
 .../handler/query/EncryptRuleQueryResultSet.java   |  8 +-
 .../query/EncryptRuleQueryResultSetTest.java       |  4 +-
 30 files changed, 121 insertions(+), 648 deletions(-)

diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-api/src/main/java/org/apache/shardingsphere/encrypt/api/config/rule/EncryptColumnRuleConfiguration.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-api/src/main/java/org/apache/shardingsphere/encrypt/api/config/rule/EncryptColumnRuleConfiguration.java
index f591a6a4648..ee60d721edb 100644
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-api/src/main/java/org/apache/shardingsphere/encrypt/api/config/rule/EncryptColumnRuleConfiguration.java
+++ 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-api/src/main/java/org/apache/shardingsphere/encrypt/api/config/rule/EncryptColumnRuleConfiguration.java
@@ -29,26 +29,13 @@ public final class EncryptColumnRuleConfiguration {
     
     private final String logicColumn;
     
-    private final String logicDataType;
-    
     private final String cipherColumn;
     
-    private final String cipherDataType;
-    
     private final String assistedQueryColumn;
     
-    private final String assistedQueryDataType;
-    
     private final String plainColumn;
     
-    private final String plainDataType;
-    
     private final String encryptorName;
     
     private final Boolean queryWithCipherColumn;
-    
-    public EncryptColumnRuleConfiguration(final String logicColumn, final 
String cipherColumn, final String assistedQueryColumn, final String 
plainColumn, final String encryptorName,
-                                          final Boolean queryWithCipherColumn) 
{
-        this(logicColumn, null, cipherColumn, null, assistedQueryColumn, null, 
plainColumn, null, encryptorName, queryWithCipherColumn);
-    }
 }
diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-api/src/main/java/org/apache/shardingsphere/encrypt/spi/context/EncryptColumnDataType.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-api/src/main/java/org/apache/shardingsphere/encrypt/spi/context/EncryptColumnDataType.java
deleted file mode 100644
index bce89a6a6dc..00000000000
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-api/src/main/java/org/apache/shardingsphere/encrypt/spi/context/EncryptColumnDataType.java
+++ /dev/null
@@ -1,59 +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.
- */
-
-package org.apache.shardingsphere.encrypt.spi.context;
-
-import lombok.Getter;
-import 
org.apache.shardingsphere.infra.config.exception.ShardingSphereConfigurationException;
-
-import java.util.Map;
-
-/**
- * Encrypt column data type.
- */
-@Getter
-public final class EncryptColumnDataType {
-    
-    private final String typeName;
-    
-    private final int dataType;
-    
-    public EncryptColumnDataType(final String typeName, final Map<String, 
Integer> dataTypes) {
-        this.typeName = typeName;
-        this.dataType = getDataTypeByTypeName(typeName, dataTypes);
-    }
-    
-    private static Integer getDataTypeByTypeName(final String typeName, final 
Map<String, Integer> dataTypes) {
-        Integer result = dataTypes.get(getExactlyTypeName(typeName));
-        if (null == result) {
-            throw new ShardingSphereConfigurationException("Can not get data 
types, please check config: %s", typeName);
-        }
-        return result;
-    }
-    
-    private static String getExactlyTypeName(final String dataTypeName) {
-        String dataType = dataTypeName.trim().toLowerCase();
-        if (dataType.contains("(")) {
-            return dataType.substring(0, dataType.indexOf("("));
-        } else if (dataType.contains(" ")) {
-            return dataType.substring(0, dataType.indexOf(" "));
-        } else {
-            return dataType;
-        }
-        // TODO refactor as dialect config extractor
-    }
-}
diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-api/src/main/java/org/apache/shardingsphere/encrypt/spi/context/EncryptContext.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-api/src/main/java/org/apache/shardingsphere/encrypt/spi/context/EncryptContext.java
index c6e32ae736d..cad5f7d5904 100644
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-api/src/main/java/org/apache/shardingsphere/encrypt/spi/context/EncryptContext.java
+++ 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-api/src/main/java/org/apache/shardingsphere/encrypt/spi/context/EncryptContext.java
@@ -21,8 +21,6 @@ import lombok.Getter;
 import lombok.RequiredArgsConstructor;
 import lombok.Setter;
 
-import java.util.Optional;
-
 /**
  * Encrypt context.
  */
@@ -38,48 +36,4 @@ public final class EncryptContext {
     private final String tableName;
     
     private final String columnName;
-    
-    private EncryptColumnDataType logicDataType;
-    
-    private EncryptColumnDataType plainDataType;
-    
-    private EncryptColumnDataType cipherDataType;
-    
-    private EncryptColumnDataType assistedQueryDataType;
-    
-    /**
-     * Get logic data type.
-     * 
-     * @return logic data type
-     */
-    public Optional<EncryptColumnDataType> getLogicDataType() {
-        return Optional.ofNullable(logicDataType);
-    }
-    
-    /**
-     * Get plain data type.
-     *
-     * @return plain data type
-     */
-    public Optional<EncryptColumnDataType> getPlainDataType() {
-        return Optional.ofNullable(plainDataType);
-    }
-    
-    /**
-     * Get cipher data type.
-     *
-     * @return cipher data type
-     */
-    public Optional<EncryptColumnDataType> getCipherDataType() {
-        return Optional.ofNullable(cipherDataType);
-    }
-    
-    /**
-     * Get assisted query data type.
-     *
-     * @return assisted query data type
-     */
-    public Optional<EncryptColumnDataType> getAssistedQueryDataType() {
-        return Optional.ofNullable(assistedQueryDataType);
-    }
 }
diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/context/EncryptContextBuilder.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/context/EncryptContextBuilder.java
index d3f11ac7f77..2432b26f7f8 100644
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/context/EncryptContextBuilder.java
+++ 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/context/EncryptContextBuilder.java
@@ -19,8 +19,6 @@ package org.apache.shardingsphere.encrypt.context;
 
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.encrypt.rule.EncryptColumn;
-import org.apache.shardingsphere.encrypt.rule.EncryptRule;
 import org.apache.shardingsphere.encrypt.spi.context.EncryptContext;
 
 /**
@@ -36,19 +34,9 @@ public final class EncryptContextBuilder {
      * @param schemaName schema name
      * @param tableName table name
      * @param columnName column name
-     * @param encryptRule encrypt rule
      * @return encrypt context
      */
-    public static EncryptContext build(final String databaseName, final String 
schemaName, final String tableName, final String columnName, final EncryptRule 
encryptRule) {
-        EncryptContext result = new EncryptContext(databaseName, schemaName, 
tableName, columnName);
-        encryptRule.findEncryptTable(tableName).flatMap(optional -> 
optional.findEncryptColumn(columnName)).ifPresent(optional -> 
setEncryptDataType(result, optional));
-        return result;
-    }
-    
-    private static void setEncryptDataType(final EncryptContext result, final 
EncryptColumn encryptColumn) {
-        result.setLogicDataType(encryptColumn.getLogicDataType());
-        result.setPlainDataType(encryptColumn.getPlainDataType());
-        result.setCipherDataType(encryptColumn.getCipherDataType());
-        
result.setAssistedQueryDataType(encryptColumn.getAssistedQueryDataType());
+    public static EncryptContext build(final String databaseName, final String 
schemaName, final String tableName, final String columnName) {
+        return new EncryptContext(databaseName, schemaName, tableName, 
columnName);
     }
 }
diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/merge/dql/EncryptAlgorithmMetaData.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/merge/dql/EncryptAlgorithmMetaData.java
index 9b8d8381cf6..303a500c81d 100644
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/merge/dql/EncryptAlgorithmMetaData.java
+++ 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/merge/dql/EncryptAlgorithmMetaData.java
@@ -84,7 +84,7 @@ public final class EncryptAlgorithmMetaData {
         Map<String, String> expressionTableNames = 
tablesContext.findTableNamesByColumnProjection(
                 Collections.singletonList(columnProjection.get()), 
database.getSchemas().get(schemaName));
         Optional<String> tableName = findTableName(columnProjection.get(), 
expressionTableNames);
-        return tableName.map(optional -> 
EncryptContextBuilder.build(database.getName(), schemaName, optional, 
columnProjection.get().getName(), encryptRule));
+        return tableName.map(optional -> 
EncryptContextBuilder.build(database.getName(), schemaName, optional, 
columnProjection.get().getName()));
     }
     
     private Optional<ColumnProjection> findColumnProjection(final int 
columnIndex) {
diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/metadata/EncryptSchemaMetaDataDecorator.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/metadata/EncryptSchemaMetaDataDecorator.java
index ad4783bfe29..c176a8ea371 100644
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/metadata/EncryptSchemaMetaDataDecorator.java
+++ 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/metadata/EncryptSchemaMetaDataDecorator.java
@@ -18,7 +18,6 @@
 package org.apache.shardingsphere.encrypt.metadata;
 
 import org.apache.shardingsphere.encrypt.constant.EncryptOrder;
-import org.apache.shardingsphere.encrypt.rule.EncryptColumn;
 import org.apache.shardingsphere.encrypt.rule.EncryptRule;
 import org.apache.shardingsphere.encrypt.rule.EncryptTable;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.builder.GenericSchemaBuilderMaterials;
@@ -32,7 +31,6 @@ import java.util.LinkedHashMap;
 import java.util.LinkedList;
 import java.util.Map;
 import java.util.Map.Entry;
-import java.util.Optional;
 
 /**
  * Schema meta data decorator for encrypt.
@@ -64,7 +62,7 @@ public final class EncryptSchemaMetaDataDecorator implements 
RuleBasedSchemaMeta
         for (ColumnMetaData each : originalColumnMetaDataList) {
             String columnName = each.getName();
             if (encryptTable.isCipherColumn(columnName)) {
-                
result.add(createColumnMetaData(encryptTable.getLogicColumn(columnName), each, 
encryptTable));
+                
result.add(createColumnMetaData(encryptTable.getLogicColumn(columnName), each));
                 continue;
             }
             if (!plainColumns.contains(columnName) && 
!assistedQueryColumns.contains(columnName)) {
@@ -74,11 +72,7 @@ public final class EncryptSchemaMetaDataDecorator implements 
RuleBasedSchemaMeta
         return result;
     }
     
-    private ColumnMetaData createColumnMetaData(final String columnName, final 
ColumnMetaData columnMetaData, final EncryptTable encryptTable) {
-        Optional<EncryptColumn> encryptColumn = 
encryptTable.findEncryptColumn(columnName);
-        if (encryptColumn.isPresent() && null != 
encryptColumn.get().getLogicDataType()) {
-            return new ColumnMetaData(columnName, 
encryptColumn.get().getLogicDataType().getDataType(), 
columnMetaData.isPrimaryKey(), columnMetaData.isGenerated(), 
columnMetaData.isCaseSensitive());
-        }
+    private ColumnMetaData createColumnMetaData(final String columnName, final 
ColumnMetaData columnMetaData) {
         return new ColumnMetaData(columnName, columnMetaData.getDataType(), 
columnMetaData.isPrimaryKey(), columnMetaData.isGenerated(), 
columnMetaData.isCaseSensitive());
     }
     
diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/parameter/rewriter/EncryptInsertOnDuplicateKeyUpdateValueParameterRewriter.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/parameter/rewriter/EncryptInsertOnDuplicateKeyUpdateValueParameterRewriter.java
index 39639a96aa7..2fe6be47338 100644
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/parameter/rewriter/EncryptInsertOnDuplicateKeyUpdateValueParameterRewriter.java
+++ 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/parameter/rewriter/EncryptInsertOnDuplicateKeyUpdateValueParameterRewriter.java
@@ -67,7 +67,7 @@ public final class 
EncryptInsertOnDuplicateKeyUpdateValueParameterRewriter imple
         for (int index = 0; index < 
onDuplicateKeyUpdateValueContext.getValueExpressions().size(); index++) {
             int columnIndex = index;
             String encryptLogicColumnName = 
onDuplicateKeyUpdateValueContext.getColumn(columnIndex).getIdentifier().getValue();
-            EncryptContext encryptContext = 
EncryptContextBuilder.build(databaseName, schemaName, tableName, 
encryptLogicColumnName, encryptRule);
+            EncryptContext encryptContext = 
EncryptContextBuilder.build(databaseName, schemaName, tableName, 
encryptLogicColumnName);
             Optional<EncryptAlgorithm> encryptor = 
encryptRule.findEncryptor(tableName, encryptLogicColumnName);
             encryptor.ifPresent(optional -> {
                 Object plainColumnValue = 
onDuplicateKeyUpdateValueContext.getValue(columnIndex);
diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/parameter/rewriter/EncryptInsertValueParameterRewriter.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/parameter/rewriter/EncryptInsertValueParameterRewriter.java
index 61dd14f22f9..9266f7c0e23 100644
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/parameter/rewriter/EncryptInsertValueParameterRewriter.java
+++ 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/parameter/rewriter/EncryptInsertValueParameterRewriter.java
@@ -68,7 +68,7 @@ public final class EncryptInsertValueParameterRewriter 
implements ParameterRewri
         String schemaName = 
insertStatementContext.getTablesContext().getSchemaName().orElseGet(() -> 
DatabaseTypeEngine.getDefaultSchemaName(insertStatementContext.getDatabaseType(),
 databaseName));
         while (descendingColumnNames.hasNext()) {
             String columnName = descendingColumnNames.next();
-            EncryptContext encryptContext = 
EncryptContextBuilder.build(databaseName, schemaName, tableName, columnName, 
encryptRule);
+            EncryptContext encryptContext = 
EncryptContextBuilder.build(databaseName, schemaName, tableName, columnName);
             encryptRule.findEncryptor(tableName, 
columnName).ifPresent(optional -> encryptInsertValues((GroupedParameterBuilder) 
parameterBuilder, insertStatementContext, optional, encryptContext));
         }
     }
diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptAlterTableTokenGenerator.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptAlterTableTokenGenerator.java
index 06e4e6799c8..c225ba39f17 100644
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptAlterTableTokenGenerator.java
+++ 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptAlterTableTokenGenerator.java
@@ -19,7 +19,6 @@ package 
org.apache.shardingsphere.encrypt.rewrite.token.generator;
 
 import lombok.Setter;
 import 
org.apache.shardingsphere.encrypt.rewrite.token.pojo.EncryptAlterTableToken;
-import 
org.apache.shardingsphere.encrypt.rewrite.token.pojo.EncryptConfigDataTypeToken;
 import org.apache.shardingsphere.encrypt.rule.EncryptColumn;
 import org.apache.shardingsphere.encrypt.rule.EncryptRule;
 import org.apache.shardingsphere.encrypt.rule.aware.EncryptRuleAware;
@@ -56,7 +55,7 @@ public final class EncryptAlterTableTokenGenerator implements 
CollectionSQLToken
     private EncryptRule encryptRule;
     
     @Override
-    public boolean isGenerateSQLToken(final SQLStatementContext 
sqlStatementContext) {
+    public boolean isGenerateSQLToken(final SQLStatementContext<?> 
sqlStatementContext) {
         return sqlStatementContext instanceof AlterTableStatementContext;
     }
     
@@ -83,7 +82,7 @@ public final class EncryptAlterTableTokenGenerator implements 
CollectionSQLToken
         List<String> dropColumns = new ArrayList<>();
         int lastStartIndex = -1;
         for (int i = 0; i < dropSQLTokens.size(); i++) {
-            SQLToken token = (SQLToken) ((List) dropSQLTokens).get(i);
+            SQLToken token = ((List<SQLToken>) dropSQLTokens).get(i);
             if (token instanceof RemoveToken) {
                 if (i != 0) {
                     result.add(new RemoveToken(lastStartIndex, ((RemoveToken) 
token).getStopIndex()));
@@ -110,6 +109,7 @@ public final class EncryptAlterTableTokenGenerator 
implements CollectionSQLToken
         return result;
     }
     
+    @SuppressWarnings("rawtypes")
     private Collection<SQLToken> getAddColumnTokens(final String tableName, 
final AddColumnDefinitionSegment addColumnDefinitionSegment) {
         Collection<SQLToken> result = new LinkedList<>();
         for (ColumnDefinitionSegment each : 
addColumnDefinitionSegment.getColumnDefinitions()) {
@@ -125,12 +125,6 @@ public final class EncryptAlterTableTokenGenerator 
implements CollectionSQLToken
     
     private Collection<SQLToken> getAddColumnTokens(final String tableName, 
final String columnName,
                                                     final 
AddColumnDefinitionSegment addColumnDefinitionSegment, final 
ColumnDefinitionSegment columnDefinitionSegment) {
-        return encryptRule.containsConfigDataType(tableName, columnName) ? 
getAddColumnTokensWithConfigDataType(tableName, columnName, 
addColumnDefinitionSegment, columnDefinitionSegment)
-                : getAddColumnTokensByDefault(tableName, columnName, 
addColumnDefinitionSegment, columnDefinitionSegment);
-    }
-    
-    private Collection<SQLToken> getAddColumnTokensByDefault(final String 
tableName, final String columnName, final AddColumnDefinitionSegment 
addColumnDefinitionSegment,
-                                                             final 
ColumnDefinitionSegment columnDefinitionSegment) {
         Collection<SQLToken> result = new LinkedList<>();
         result.add(new RemoveToken(columnDefinitionSegment.getStartIndex(), 
columnDefinitionSegment.getColumnName().getStopIndex()));
         result.add(new 
EncryptAlterTableToken(columnDefinitionSegment.getColumnName().getStopIndex() + 
1, columnDefinitionSegment.getColumnName().getStopIndex(),
@@ -144,26 +138,11 @@ public final class EncryptAlterTableTokenGenerator 
implements CollectionSQLToken
         return result;
     }
     
-    private Collection<SQLToken> getAddColumnTokensWithConfigDataType(final 
String tableName, final String columnName, final AddColumnDefinitionSegment 
addColumnDefinitionSegment,
-                                                                      final 
ColumnDefinitionSegment columnDefinitionSegment) {
-        Collection<SQLToken> result = new LinkedList<>();
-        EncryptColumn encryptColumn = getEncryptColumn(tableName, columnName);
-        result.add(new RemoveToken(columnDefinitionSegment.getStartIndex(), 
columnDefinitionSegment.getStopIndex()));
-        result.add(new 
EncryptConfigDataTypeToken(columnDefinitionSegment.getStopIndex() + 1, 
columnDefinitionSegment.getStopIndex(),
-                encryptRule.getCipherColumn(tableName, columnName), 
encryptColumn.getCipherDataType().getTypeName()));
-        Optional<String> assistedQueryColumn = 
encryptRule.findAssistedQueryColumn(tableName, columnName);
-        assistedQueryColumn.map(optional -> new 
EncryptConfigDataTypeToken(addColumnDefinitionSegment.getStopIndex() + 1,
-                addColumnDefinitionSegment.getStopIndex(), ", ADD COLUMN " + 
optional, 
encryptColumn.getAssistedQueryDataType().getTypeName())).ifPresent(result::add);
-        Optional<String> plainColumn = encryptRule.findPlainColumn(tableName, 
columnName);
-        plainColumn.map(optional -> new 
EncryptConfigDataTypeToken(addColumnDefinitionSegment.getStopIndex() + 1,
-                addColumnDefinitionSegment.getStopIndex(), ", ADD COLUMN " + 
optional, 
encryptColumn.getPlainDataType().getTypeName())).ifPresent(result::add);
-        return result;
-    }
-    
     private EncryptColumn getEncryptColumn(final String tableName, final 
String columnName) {
         return encryptRule.findEncryptColumn(tableName, 
columnName).orElseThrow(() -> new ShardingSphereConfigurationException("Failed 
finding encrypt column."));
     }
     
+    @SuppressWarnings("rawtypes")
     private Optional<SQLToken> getAddColumnPositionToken(final String 
tableName, final AddColumnDefinitionSegment addColumnDefinitionSegment) {
         Optional<EncryptAlgorithm> encryptor = 
addColumnDefinitionSegment.getColumnPosition().filter(optional -> null != 
optional.getColumnName())
                 .flatMap(optional -> encryptRule.findEncryptor(tableName, 
optional.getColumnName().getIdentifier().getValue()));
@@ -195,25 +174,6 @@ public final class EncryptAlterTableTokenGenerator 
implements CollectionSQLToken
     
     private Collection<SQLToken> getModifyColumnTokens(final String tableName, 
final String columnName,
                                                        final 
ModifyColumnDefinitionSegment modifyColumnDefinitionSegment) {
-        return encryptRule.containsConfigDataType(tableName, columnName) ? 
getModifyColumnTokensWithConfigDataType(tableName, columnName, 
modifyColumnDefinitionSegment)
-                : getModifyColumnTokensByDefault(tableName, columnName, 
modifyColumnDefinitionSegment);
-    }
-    
-    private Collection<SQLToken> getModifyColumnTokensWithConfigDataType(final 
String tableName, final String columnName, final ModifyColumnDefinitionSegment 
segment) {
-        Collection<SQLToken> result = new LinkedList<>();
-        ColumnDefinitionSegment columnDefinitionSegment = 
segment.getColumnDefinition();
-        EncryptColumn encryptColumn = getEncryptColumn(tableName, columnName);
-        result.add(new 
RemoveToken(columnDefinitionSegment.getColumnName().getStartIndex(), 
columnDefinitionSegment.getStopIndex()));
-        result.add(new 
EncryptConfigDataTypeToken(columnDefinitionSegment.getStopIndex() + 1, 
columnDefinitionSegment.getStopIndex(),
-                encryptRule.getCipherColumn(tableName, columnName), 
encryptColumn.getCipherDataType().getTypeName()));
-        encryptRule.findAssistedQueryColumn(tableName, 
columnName).map(optional -> new 
EncryptConfigDataTypeToken(segment.getStopIndex() + 1,
-                segment.getStopIndex(), ", MODIFY COLUMN " + optional, 
encryptColumn.getAssistedQueryDataType().getTypeName())).ifPresent(result::add);
-        encryptRule.findPlainColumn(tableName, columnName).map(optional -> new 
EncryptConfigDataTypeToken(segment.getStopIndex() + 1,
-                segment.getStopIndex(), ", MODIFY COLUMN " + optional, 
encryptColumn.getPlainDataType().getTypeName())).ifPresent(result::add);
-        return result;
-    }
-    
-    private Collection<SQLToken> getModifyColumnTokensByDefault(final String 
tableName, final String columnName, final ModifyColumnDefinitionSegment 
modifyColumnDefinitionSegment) {
         Collection<SQLToken> result = new LinkedList<>();
         ColumnDefinitionSegment columnDefinitionSegment = 
modifyColumnDefinitionSegment.getColumnDefinition();
         result.add(new 
RemoveToken(columnDefinitionSegment.getColumnName().getStartIndex(), 
columnDefinitionSegment.getColumnName().getStopIndex()));
@@ -226,6 +186,7 @@ public final class EncryptAlterTableTokenGenerator 
implements CollectionSQLToken
         return result;
     }
     
+    @SuppressWarnings("rawtypes")
     private Optional<SQLToken> getColumnPositionToken(final String tableName, 
final ColumnPositionSegment columnPositionSegment) {
         Optional<EncryptAlgorithm> encryptor = 
Optional.of(columnPositionSegment).filter(optional -> null != 
optional.getColumnName())
                 .flatMap(optional -> encryptRule.findEncryptor(tableName, 
optional.getColumnName().getIdentifier().getValue()));
@@ -253,6 +214,7 @@ public final class EncryptAlterTableTokenGenerator 
implements CollectionSQLToken
         return result;
     }
     
+    @SuppressWarnings("rawtypes")
     private void isSameEncryptColumn(final String tableName, final 
ChangeColumnDefinitionSegment segment) {
         Optional<EncryptAlgorithm> previousAlgorithm = 
encryptRule.findEncryptor(tableName, 
segment.getPreviousColumn().getIdentifier().getValue());
         Optional<EncryptAlgorithm> currentAlgorithm = 
encryptRule.findEncryptor(tableName, 
segment.getColumnDefinition().getColumnName().getIdentifier().getValue());
@@ -283,25 +245,6 @@ public final class EncryptAlterTableTokenGenerator 
implements CollectionSQLToken
     }
     
     private Collection<? extends SQLToken> getColumnTokens(final String 
tableName, final ChangeColumnDefinitionSegment segment) {
-        return encryptRule.containsConfigDataType(tableName, 
segment.getColumnDefinition().getColumnName().getIdentifier().getValue()) ? 
getChangeColumnTokensWithConfigDataType(tableName, segment)
-                : getChangeColumnTokensByDefault(tableName, segment);
-    }
-    
-    private Collection<? extends SQLToken> 
getChangeColumnTokensWithConfigDataType(final String tableName, final 
ChangeColumnDefinitionSegment segment) {
-        Collection<SQLToken> result = new LinkedList<>();
-        result.add(new 
RemoveToken(segment.getColumnDefinition().getColumnName().getStartIndex(), 
segment.getColumnDefinition().getStopIndex()));
-        EncryptColumn encryptColumn = getEncryptColumn(tableName, 
segment.getColumnDefinition().getColumnName().getIdentifier().getValue());
-        result.add(new 
EncryptConfigDataTypeToken(segment.getColumnDefinition().getStopIndex() + 1, 
segment.getColumnDefinition().getStopIndex(),
-                encryptColumn.getCipherColumn(), 
encryptColumn.getCipherDataType().getTypeName()));
-        String previousColumnName = 
segment.getPreviousColumn().getIdentifier().getValue();
-        encryptRule.findAssistedQueryColumn(tableName, 
previousColumnName).map(optional -> new 
EncryptConfigDataTypeToken(segment.getStopIndex() + 1, segment.getStopIndex(),
-                ", CHANGE COLUMN " + optional + " " + 
encryptColumn.getAssistedQueryColumn().orElse(""), 
encryptColumn.getAssistedQueryDataType().getTypeName())).ifPresent(result::add);
-        encryptRule.findPlainColumn(tableName, 
previousColumnName).map(optional -> new 
EncryptConfigDataTypeToken(segment.getStopIndex() + 1, segment.getStopIndex(),
-                ", CHANGE COLUMN " + optional + " " + 
encryptColumn.getPlainColumn().orElse(""), 
encryptColumn.getPlainDataType().getTypeName())).ifPresent(result::add);
-        return result;
-    }
-    
-    private Collection<SQLToken> getChangeColumnTokensByDefault(final String 
tableName, final ChangeColumnDefinitionSegment segment) {
         Collection<SQLToken> result = new LinkedList<>();
         result.add(new 
RemoveToken(segment.getColumnDefinition().getColumnName().getStartIndex(), 
segment.getColumnDefinition().getColumnName().getStopIndex()));
         result.add(new 
EncryptAlterTableToken(segment.getColumnDefinition().getColumnName().getStopIndex()
 + 1, segment.getColumnDefinition().getColumnName().getStopIndex(),
@@ -333,6 +276,7 @@ public final class EncryptAlterTableTokenGenerator 
implements CollectionSQLToken
         return result;
     }
     
+    @SuppressWarnings("rawtypes")
     private Collection<SQLToken> getDropColumnTokens(final String tableName, 
final DropColumnDefinitionSegment dropColumnDefinitionSegment) {
         Collection<SQLToken> result = new LinkedList<>();
         for (ColumnSegment each : dropColumnDefinitionSegment.getColumns()) {
diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptCreateTableTokenGenerator.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptCreateTableTokenGenerator.java
index e1478f0671c..a2089afb9c8 100644
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptCreateTableTokenGenerator.java
+++ 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptCreateTableTokenGenerator.java
@@ -20,8 +20,6 @@ package 
org.apache.shardingsphere.encrypt.rewrite.token.generator;
 import lombok.Setter;
 import org.apache.shardingsphere.encrypt.rule.EncryptRule;
 import org.apache.shardingsphere.encrypt.rule.aware.EncryptRuleAware;
-import 
org.apache.shardingsphere.encrypt.rewrite.token.pojo.EncryptConfigDataTypeToken;
-import org.apache.shardingsphere.encrypt.rule.EncryptColumn;
 import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
 import 
org.apache.shardingsphere.infra.binder.segment.select.projection.impl.ColumnProjection;
 import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
@@ -48,10 +46,11 @@ public final class EncryptCreateTableTokenGenerator 
implements CollectionSQLToke
     private EncryptRule encryptRule;
     
     @Override
-    public boolean isGenerateSQLToken(final SQLStatementContext 
sqlStatementContext) {
+    public boolean isGenerateSQLToken(final SQLStatementContext<?> 
sqlStatementContext) {
         return sqlStatementContext instanceof CreateTableStatementContext && 
!(((CreateTableStatementContext) 
sqlStatementContext).getSqlStatement()).getColumnDefinitions().isEmpty();
     }
     
+    @SuppressWarnings("rawtypes")
     @Override
     public Collection<SQLToken> generateSQLTokens(final 
CreateTableStatementContext createTableStatementContext) {
         Collection<SQLToken> result = new LinkedList<>();
@@ -81,66 +80,21 @@ public final class EncryptCreateTableTokenGenerator 
implements CollectionSQLToke
     }
     
     private SQLToken getCipherColumnToken(final String tableName, final String 
columnName, final ColumnDefinitionSegment column, final int stopIndex) {
-        Optional<EncryptConfigDataTypeToken> configDataTypeToken = 
findEncryptConfigDataTypeToken(tableName, columnName, column, stopIndex);
-        return configDataTypeToken.isPresent() ? configDataTypeToken.get()
-                : new SubstitutableColumnNameToken(stopIndex + 1, 
column.getColumnName().getStopIndex(),
-                        
getColumnProjections(encryptRule.getCipherColumn(tableName, columnName)));
-    }
-    
-    private Optional<EncryptConfigDataTypeToken> 
findEncryptConfigDataTypeToken(final String tableName, final String columnName, 
final ColumnDefinitionSegment column, final int stopIndex) {
-        Optional<EncryptColumn> encryptColumn = 
encryptRule.findEncryptTable(tableName).flatMap(optional -> 
optional.findEncryptColumn(columnName));
-        if (encryptColumn.isPresent() && null != 
encryptColumn.get().getCipherDataType()) {
-            return Optional.of(new EncryptConfigDataTypeToken(stopIndex + 1, 
column.getStopIndex(), encryptColumn.get().getCipherColumn(), 
encryptColumn.get().getCipherDataType().getTypeName()));
-        }
-        return Optional.empty();
+        return new SubstitutableColumnNameToken(stopIndex + 1, 
column.getColumnName().getStopIndex(), 
getColumnProjections(encryptRule.getCipherColumn(tableName, columnName)));
     }
     
     private Optional<? extends SQLToken> getAssistedQueryColumnToken(final 
String tableName, final String columnName, final ColumnDefinitionSegment column,
                                                                      final int 
stopIndex, final boolean lastColumn) {
-        Optional<EncryptConfigDataTypeToken> encryptConfigDataTypeToken = 
findAssistedConfigDataTypeToken(tableName, columnName, column, stopIndex, 
lastColumn);
-        if (encryptConfigDataTypeToken.isPresent()) {
-            return encryptConfigDataTypeToken;
-        }
         Optional<String> assistedQueryColumn = 
encryptRule.findAssistedQueryColumn(tableName, columnName);
         return assistedQueryColumn.map(optional -> new 
SubstitutableColumnNameToken(stopIndex + 1, 
column.getColumnName().getStopIndex(), getColumnProjections(optional), 
lastColumn));
     }
     
-    private Optional<EncryptConfigDataTypeToken> 
findAssistedConfigDataTypeToken(final String tableName, final String 
columnName, final ColumnDefinitionSegment column,
-                                                                               
  final int stopIndex, final boolean lastColumn) {
-        Optional<EncryptColumn> encryptColumn = 
encryptRule.findEncryptTable(tableName).flatMap(optional -> 
optional.findEncryptColumn(columnName));
-        Optional<String> assistedQueryColumn = 
encryptColumn.flatMap(EncryptColumn::getAssistedQueryColumn);
-        if (assistedQueryColumn.isPresent()) {
-            if (null != encryptColumn.get().getAssistedQueryDataType()) {
-                return Optional.of(new EncryptConfigDataTypeToken(stopIndex + 
1, column.getStopIndex(), assistedQueryColumn.get(),
-                        
encryptColumn.get().getAssistedQueryDataType().getTypeName(), lastColumn));
-            }
-        }
-        return Optional.empty();
-    }
-    
     private Optional<? extends SQLToken> getPlainColumnToken(final String 
tableName, final String columnName, final ColumnDefinitionSegment column,
                                                              final int 
stopIndex, final boolean lastColumn) {
-        Optional<EncryptConfigDataTypeToken> encryptConfigDataTypeToken = 
findPlainConfigDataTypeToken(tableName, columnName, column, stopIndex, 
lastColumn);
-        if (encryptConfigDataTypeToken.isPresent()) {
-            return encryptConfigDataTypeToken;
-        }
         Optional<String> plainColumn = encryptRule.findPlainColumn(tableName, 
columnName);
         return plainColumn.map(optional -> new 
SubstitutableColumnNameToken(stopIndex + 1, 
column.getColumnName().getStopIndex(), getColumnProjections(optional), 
lastColumn));
     }
     
-    private Optional<EncryptConfigDataTypeToken> 
findPlainConfigDataTypeToken(final String tableName, final String columnName, 
final ColumnDefinitionSegment column,
-                                                                              
final int stopIndex, final boolean lastColumn) {
-        Optional<EncryptColumn> encryptColumn = 
encryptRule.findEncryptTable(tableName).flatMap(optional -> 
optional.findEncryptColumn(columnName));
-        Optional<String> plainColumn = 
encryptColumn.flatMap(EncryptColumn::getPlainColumn);
-        if (plainColumn.isPresent()) {
-            if (null != encryptColumn.get().getPlainDataType()) {
-                return Optional.of(new EncryptConfigDataTypeToken(stopIndex + 
1, column.getStopIndex(), plainColumn.get(),
-                        encryptColumn.get().getPlainDataType().getTypeName(), 
lastColumn));
-            }
-        }
-        return Optional.empty();
-    }
-    
     private Collection<ColumnProjection> getColumnProjections(final String 
columnName) {
         return Collections.singletonList(new ColumnProjection(null, 
columnName, null));
     }
diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptInsertValuesTokenGenerator.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptInsertValuesTokenGenerator.java
index f00ab2171c8..d4b4102160e 100644
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptInsertValuesTokenGenerator.java
+++ 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptInsertValuesTokenGenerator.java
@@ -136,7 +136,7 @@ public final class EncryptInsertValuesTokenGenerator 
implements OptionalSQLToken
                 int columnIndex = useDefaultInsertColumnsToken.map(optional -> 
((UseDefaultInsertColumnsToken) optional).getColumns().indexOf(columnName))
                         .orElseGet(() -> 
insertStatementContext.getColumnNames().indexOf(columnName));
                 Object originalValue = 
insertValueContext.getValue(columnIndex).orElseThrow(() -> new 
ShardingSphereException("Not support for encrypt!"));
-                EncryptContext encryptContext = 
EncryptContextBuilder.build(databaseName, schemaName, tableName, columnName, 
encryptRule);
+                EncryptContext encryptContext = 
EncryptContextBuilder.build(databaseName, schemaName, tableName, columnName);
                 addPlainColumn(insertValueToken, columnIndex, encryptContext, 
insertValueContext, originalValue);
                 addAssistedQueryColumn(insertValueToken, encryptor.get(), 
columnIndex, encryptContext, insertValueContext, originalValue);
                 setCipherColumn(insertValueToken, encryptor.get(), 
columnIndex, encryptContext, 
insertValueContext.getValueExpressions().get(columnIndex), originalValue);
diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/pojo/EncryptConfigDataTypeToken.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/pojo/EncryptConfigDataTypeToken.java
deleted file mode 100644
index 09ecc5840ee..00000000000
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/pojo/EncryptConfigDataTypeToken.java
+++ /dev/null
@@ -1,57 +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.
- */
-
-package org.apache.shardingsphere.encrypt.rewrite.token.pojo;
-
-import lombok.Getter;
-import org.apache.shardingsphere.infra.rewrite.sql.token.pojo.SQLToken;
-import org.apache.shardingsphere.infra.rewrite.sql.token.pojo.Substitutable;
-
-/**
- * Config data type token for encrypt.
- */
-@Getter
-public final class EncryptConfigDataTypeToken extends SQLToken implements 
Substitutable {
-    
-    private final int stopIndex;
-    
-    private final String columnName;
-    
-    private final String configDataType;
-    
-    private final boolean lastColumn;
-    
-    public EncryptConfigDataTypeToken(final int startIndex, final int 
stopIndex, final String columnName, final String configDataType) {
-        this(startIndex, stopIndex, columnName, configDataType, false);
-    }
-    
-    public EncryptConfigDataTypeToken(final int startIndex, final int 
stopIndex, final String columnName, final String configDataType, final boolean 
lastColumn) {
-        super(startIndex);
-        this.stopIndex = stopIndex;
-        this.columnName = columnName;
-        this.configDataType = configDataType;
-        this.lastColumn = lastColumn;
-    }
-    
-    @Override
-    public String toString() {
-        if (lastColumn) {
-            return String.format(", %s %s", columnName, configDataType);
-        }
-        return String.format("%s %s", columnName, configDataType);
-    }
-}
diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptColumn.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptColumn.java
index 0c30c949f17..3b1ed08b7c9 100644
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptColumn.java
+++ 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptColumn.java
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.encrypt.rule;
 import com.google.common.base.Strings;
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.encrypt.spi.context.EncryptColumnDataType;
 
 import java.util.Optional;
 
@@ -31,20 +30,12 @@ import java.util.Optional;
 @Getter
 public final class EncryptColumn {
     
-    private final EncryptColumnDataType logicDataType;
-    
     private final String cipherColumn;
     
-    private final EncryptColumnDataType cipherDataType;
-    
     private final String assistedQueryColumn;
     
-    private final EncryptColumnDataType assistedQueryDataType;
-    
     private final String plainColumn;
     
-    private final EncryptColumnDataType plainDataType;
-    
     private final String encryptorName;
     
     private final Boolean queryWithCipherColumn;
diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptRule.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptRule.java
index ea4e380511d..c679561e255 100644
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptRule.java
+++ 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptRule.java
@@ -29,15 +29,11 @@ import 
org.apache.shardingsphere.encrypt.factory.EncryptAlgorithmFactory;
 import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
 import org.apache.shardingsphere.encrypt.spi.QueryAssistedEncryptAlgorithm;
 import org.apache.shardingsphere.encrypt.spi.context.EncryptContext;
-import 
org.apache.shardingsphere.infra.config.exception.ShardingSphereConfigurationException;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereSchema;
-import 
org.apache.shardingsphere.infra.metadata.database.schema.loader.common.DataTypeLoader;
 import 
org.apache.shardingsphere.infra.rewrite.sql.token.generator.aware.SchemaMetaDataAware;
 import org.apache.shardingsphere.infra.rule.identifier.scope.SchemaRule;
 import org.apache.shardingsphere.infra.rule.identifier.type.TableContainedRule;
 
-import javax.sql.DataSource;
-import java.sql.SQLException;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.LinkedHashMap;
@@ -59,19 +55,17 @@ public final class EncryptRule implements SchemaRule, 
TableContainedRule {
     @Getter
     private final boolean queryWithCipherColumn;
     
-    public EncryptRule(final EncryptRuleConfiguration config, final 
Map<String, DataSource> dataSourceMap) {
+    public EncryptRule(final EncryptRuleConfiguration config) {
         Preconditions.checkArgument(isValidRuleConfiguration(config), "Invalid 
encrypt column configurations in EncryptTableRuleConfigurations.");
         config.getEncryptors().forEach((key, value) -> encryptors.put(key, 
EncryptAlgorithmFactory.newInstance(value)));
-        Map<String, Integer> dataTypes = 
containsConfiguredDataType(config.getTables()) ? getDataTypes(dataSourceMap) : 
Collections.emptyMap();
-        config.getTables().forEach(each -> 
tables.put(each.getName().toLowerCase(), new EncryptTable(each, dataTypes)));
+        config.getTables().forEach(each -> 
tables.put(each.getName().toLowerCase(), new EncryptTable(each)));
         queryWithCipherColumn = config.isQueryWithCipherColumn();
     }
     
-    public EncryptRule(final AlgorithmProvidedEncryptRuleConfiguration config, 
final Map<String, DataSource> dataSourceMap) {
+    public EncryptRule(final AlgorithmProvidedEncryptRuleConfiguration config) 
{
         
Preconditions.checkArgument(isValidRuleConfigurationWithAlgorithmProvided(config),
 "Invalid encrypt column configurations in EncryptTableRuleConfigurations.");
         encryptors.putAll(config.getEncryptors());
-        Map<String, Integer> dataTypes = 
containsConfiguredDataType(config.getTables()) ? getDataTypes(dataSourceMap) : 
Collections.emptyMap();
-        config.getTables().forEach(each -> 
tables.put(each.getName().toLowerCase(), new EncryptTable(each, dataTypes)));
+        config.getTables().forEach(each -> 
tables.put(each.getName().toLowerCase(), new EncryptTable(each)));
         queryWithCipherColumn = config.isQueryWithCipherColumn();
     }
     
@@ -118,26 +112,6 @@ public final class EncryptRule implements SchemaRule, 
TableContainedRule {
                 && 
encryptRuleConfig.getEncryptors().containsKey(column.getEncryptorName());
     }
     
-    private Map<String, Integer> getDataTypes(final Map<String, DataSource> 
dataSourceMap) {
-        Optional<DataSource> dataSource = 
dataSourceMap.values().stream().findAny();
-        if (dataSource.isPresent()) {
-            try {
-                return 
DataTypeLoader.load(dataSource.get().getConnection().getMetaData());
-            } catch (SQLException ex) {
-                throw new ShardingSphereConfigurationException("Can not load 
data types: %s", ex.getMessage());
-            }
-        }
-        return Collections.emptyMap();
-    }
-    
-    private boolean containsConfiguredDataType(final 
Collection<EncryptTableRuleConfiguration> tableRuleConfigs) {
-        return 
tableRuleConfigs.stream().anyMatch(this::containsConfiguredDataType);
-    }
-    
-    private boolean containsConfiguredDataType(final 
EncryptTableRuleConfiguration tableConfig) {
-        return tableConfig.getColumns().stream().anyMatch(each -> 
!Strings.isNullOrEmpty(each.getLogicDataType()));
-    }
-    
     /**
      * Find encrypt table.
      * 
@@ -185,7 +159,7 @@ public final class EncryptRule implements SchemaRule, 
TableContainedRule {
     @SuppressWarnings("rawtypes")
     public List<Object> getEncryptValues(final String databaseName, final 
String schemaName, final String logicTable, final String logicColumn, final 
List<Object> originalValues) {
         Optional<EncryptAlgorithm> encryptor = findEncryptor(logicTable, 
logicColumn);
-        EncryptContext encryptContext = 
EncryptContextBuilder.build(databaseName, schemaName, logicTable, logicColumn, 
this);
+        EncryptContext encryptContext = 
EncryptContextBuilder.build(databaseName, schemaName, logicTable, logicColumn);
         Preconditions.checkArgument(encryptor.isPresent(), "Can not find 
EncryptAlgorithm by %s.%s.", logicTable, logicColumn);
         return getEncryptValues(encryptor.get(), originalValues, 
encryptContext);
     }
@@ -257,7 +231,7 @@ public final class EncryptRule implements SchemaRule, 
TableContainedRule {
     @SuppressWarnings("rawtypes")
     public List<Object> getEncryptAssistedQueryValues(final String 
databaseName, final String schemaName, final String logicTable, final String 
logicColumn, final List<Object> originalValues) {
         Optional<EncryptAlgorithm> encryptor = findEncryptor(logicTable, 
logicColumn);
-        EncryptContext encryptContext = 
EncryptContextBuilder.build(databaseName, schemaName, logicTable, logicColumn, 
this);
+        EncryptContext encryptContext = 
EncryptContextBuilder.build(databaseName, schemaName, logicTable, logicColumn);
         Preconditions.checkArgument(encryptor.isPresent() && encryptor.get() 
instanceof QueryAssistedEncryptAlgorithm,
                 "Can not find QueryAssistedEncryptAlgorithm by %s.%s.", 
logicTable, logicColumn);
         return getEncryptAssistedQueryValues((QueryAssistedEncryptAlgorithm) 
encryptor.get(), originalValues, encryptContext);
@@ -328,15 +302,4 @@ public final class EncryptRule implements SchemaRule, 
TableContainedRule {
             }
         }
     }
-    
-    /**
-     * Check whether contains config data type or not.
-     * 
-     * @param tableName table name
-     * @param columnName column name
-     * @return boolean whether contains config data type or not
-     */
-    public boolean containsConfigDataType(final String tableName, final String 
columnName) {
-        return findEncryptTable(tableName).flatMap(optional -> 
optional.findEncryptColumn(columnName).filter(encryptColumn -> null != 
encryptColumn.getLogicDataType())).isPresent();
-    }
 }
diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptTable.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptTable.java
index 8b360127457..3a53c838154 100644
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptTable.java
+++ 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptTable.java
@@ -17,11 +17,8 @@
 
 package org.apache.shardingsphere.encrypt.rule;
 
-import com.google.common.base.Preconditions;
-import com.google.common.base.Strings;
 import 
org.apache.shardingsphere.encrypt.api.config.rule.EncryptColumnRuleConfiguration;
 import 
org.apache.shardingsphere.encrypt.api.config.rule.EncryptTableRuleConfiguration;
-import org.apache.shardingsphere.encrypt.spi.context.EncryptColumnDataType;
 import org.apache.shardingsphere.infra.exception.ShardingSphereException;
 
 import java.util.Collection;
@@ -41,29 +38,15 @@ public final class EncryptTable {
     
     private final Boolean queryWithCipherColumn;
     
-    public EncryptTable(final EncryptTableRuleConfiguration config, final 
Map<String, Integer> dataTypes) {
+    public EncryptTable(final EncryptTableRuleConfiguration config) {
         columns = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
         for (EncryptColumnRuleConfiguration each : config.getColumns()) {
-            checkColumnConfig(each);
-            columns.put(each.getLogicColumn(), new 
EncryptColumn(getEncryptColumnDataType(each.getLogicDataType(), dataTypes), 
each.getCipherColumn(),
-                    getEncryptColumnDataType(each.getCipherDataType(), 
dataTypes), each.getAssistedQueryColumn(), 
getEncryptColumnDataType(each.getAssistedQueryDataType(), dataTypes),
-                    each.getPlainColumn(), 
getEncryptColumnDataType(each.getPlainDataType(), dataTypes), 
each.getEncryptorName(), each.getQueryWithCipherColumn()));
+            columns.put(each.getLogicColumn(), new 
EncryptColumn(each.getCipherColumn(), each.getAssistedQueryColumn(), 
each.getPlainColumn(), each.getEncryptorName(),
+                    each.getQueryWithCipherColumn()));
         }
         queryWithCipherColumn = config.getQueryWithCipherColumn();
     }
     
-    private EncryptColumnDataType getEncryptColumnDataType(final String 
dataTypeName, final Map<String, Integer> dataTypes) {
-        return Strings.isNullOrEmpty(dataTypeName) ? null : new 
EncryptColumnDataType(dataTypeName, dataTypes);
-    }
-    
-    private void checkColumnConfig(final EncryptColumnRuleConfiguration 
columnRuleConfig) {
-        if (!Strings.isNullOrEmpty(columnRuleConfig.getLogicDataType())) {
-            
Preconditions.checkState(!Strings.isNullOrEmpty(columnRuleConfig.getCipherDataType()));
-            
Preconditions.checkState(Strings.isNullOrEmpty(columnRuleConfig.getPlainColumn())
 || !Strings.isNullOrEmpty(columnRuleConfig.getPlainDataType()));
-            
Preconditions.checkState(Strings.isNullOrEmpty(columnRuleConfig.getAssistedQueryColumn())
 || !Strings.isNullOrEmpty(columnRuleConfig.getAssistedQueryDataType()));
-        }
-    }
-    
     /**
      * Find encrypt algorithm name.
      *
diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/builder/AlgorithmProvidedEncryptRuleBuilder.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/builder/AlgorithmProvidedEncryptRuleBuilder.java
index 14d3c6b5d9a..a400c79fd69 100644
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/builder/AlgorithmProvidedEncryptRuleBuilder.java
+++ 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/builder/AlgorithmProvidedEncryptRuleBuilder.java
@@ -36,7 +36,7 @@ public final class AlgorithmProvidedEncryptRuleBuilder 
implements SchemaRuleBuil
     @Override
     public EncryptRule build(final AlgorithmProvidedEncryptRuleConfiguration 
config, final String databaseName,
                              final Map<String, DataSource> dataSources, final 
Collection<ShardingSphereRule> builtRules, final ConfigurationProperties props) 
{
-        return new EncryptRule(config, dataSources);
+        return new EncryptRule(config);
     }
     
     @Override
diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/builder/EncryptRuleBuilder.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/builder/EncryptRuleBuilder.java
index 427fa16b508..7ca7f745708 100644
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/builder/EncryptRuleBuilder.java
+++ 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/builder/EncryptRuleBuilder.java
@@ -36,7 +36,7 @@ public final class EncryptRuleBuilder implements 
SchemaRuleBuilder<EncryptRuleCo
     @Override
     public EncryptRule build(final EncryptRuleConfiguration config, final 
String databaseName,
                              final Map<String, DataSource> dataSources, final 
Collection<ShardingSphereRule> builtRules, final ConfigurationProperties props) 
{
-        return new EncryptRule(config, dataSources);
+        return new EncryptRule(config);
     }
     
     @Override
diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/context/EncryptContextBuilderTest.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/context/EncryptContextBuilderTest.java
index 0c45bd89cb6..38fbaf23ae5 100644
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/context/EncryptContextBuilderTest.java
+++ 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/context/EncryptContextBuilderTest.java
@@ -17,81 +17,19 @@
 
 package org.apache.shardingsphere.encrypt.context;
 
-import org.apache.shardingsphere.encrypt.rule.EncryptColumn;
-import org.apache.shardingsphere.encrypt.rule.EncryptRule;
-import org.apache.shardingsphere.encrypt.rule.EncryptTable;
-import org.apache.shardingsphere.encrypt.spi.context.EncryptColumnDataType;
 import org.apache.shardingsphere.encrypt.spi.context.EncryptContext;
 import org.junit.Test;
 
-import java.sql.Types;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Optional;
-
 import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
 
 public final class EncryptContextBuilderTest {
     
-    @Test
-    public void assertBuildWhenConfigDateType() {
-        EncryptContext actual = EncryptContextBuilder.build("encrypt_db", 
"encrypt_db", "test", "cipher", mockEncryptRule());
-        assertThat(actual.getDatabaseName(), is("encrypt_db"));
-        assertThat(actual.getTableName(), is("test"));
-        assertThat(actual.getColumnName(), is("cipher"));
-        assertTrue(actual.getLogicDataType().isPresent());
-        assertThat(actual.getLogicDataType().get().getTypeName(), is("int(20) 
unsigned not null default 0"));
-        assertThat(actual.getLogicDataType().get().getDataType(), 
is(Types.INTEGER));
-        assertTrue(actual.getCipherDataType().isPresent());
-        assertThat(actual.getCipherDataType().get().getTypeName(), 
is("varchar(200) not null default ''"));
-        assertThat(actual.getCipherDataType().get().getDataType(), 
is(Types.VARCHAR));
-        assertTrue(actual.getAssistedQueryDataType().isPresent());
-        assertThat(actual.getAssistedQueryDataType().get().getTypeName(), 
is("varchar(200) not null"));
-        assertThat(actual.getAssistedQueryDataType().get().getDataType(), 
is(Types.VARCHAR));
-        assertTrue(actual.getPlainDataType().isPresent());
-        assertThat(actual.getPlainDataType().get().getTypeName(), is("int(20) 
unsigned not null default 0"));
-        assertThat(actual.getPlainDataType().get().getDataType(), 
is(Types.INTEGER));
-    }
-    
     @Test
     public void assertBuildWhenNotConfigDateType() {
-        EncryptContext actual = EncryptContextBuilder.build("encrypt_db", 
"encrypt_db", "test", "cipher", mock(EncryptRule.class));
+        EncryptContext actual = EncryptContextBuilder.build("encrypt_db", 
"encrypt_db", "test", "cipher");
         assertThat(actual.getDatabaseName(), is("encrypt_db"));
         assertThat(actual.getTableName(), is("test"));
         assertThat(actual.getColumnName(), is("cipher"));
-        assertFalse(actual.getLogicDataType().isPresent());
-        assertFalse(actual.getCipherDataType().isPresent());
-        assertFalse(actual.getAssistedQueryDataType().isPresent());
-        assertFalse(actual.getPlainDataType().isPresent());
-    }
-    
-    private EncryptRule mockEncryptRule() {
-        EncryptRule result = mock(EncryptRule.class);
-        EncryptTable encryptTable = mockEncryptTable();
-        
when(result.findEncryptTable("test")).thenReturn(Optional.of(encryptTable));
-        return result;
-    }
-    
-    private EncryptTable mockEncryptTable() {
-        EncryptTable result = mock(EncryptTable.class);
-        
when(result.findEncryptColumn("cipher")).thenReturn(Optional.of(mockEncryptColumn()));
-        return result;
-    }
-    
-    private EncryptColumn mockEncryptColumn() {
-        Map<String, Integer> dataTypes = new LinkedHashMap<>();
-        dataTypes.put("int", Types.INTEGER);
-        dataTypes.put("varchar", Types.VARCHAR);
-        EncryptColumnDataType logicDataType = new 
EncryptColumnDataType("int(20) unsigned not null default 0", dataTypes);
-        EncryptColumnDataType cipherDataType = new 
EncryptColumnDataType("varchar(200) not null default ''", dataTypes);
-        EncryptColumnDataType assistedQueryDataType = new 
EncryptColumnDataType("varchar(200) not null", dataTypes);
-        EncryptColumnDataType plainDataType = new 
EncryptColumnDataType("int(20) unsigned not null default 0", dataTypes);
-        return new EncryptColumn(logicDataType, "cipher_certificate_number", 
cipherDataType, "assisted_certificate_number",
-                assistedQueryDataType, "certificate_number_plain", 
plainDataType, "test", null);
     }
 }
diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/merge/dql/EncryptMergedResultTest.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/merge/dql/EncryptMergedResultTest.java
index 11d76658657..bb99854f48a 100644
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/merge/dql/EncryptMergedResultTest.java
+++ 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/merge/dql/EncryptMergedResultTest.java
@@ -18,7 +18,6 @@
 package org.apache.shardingsphere.encrypt.merge.dql;
 
 import org.apache.shardingsphere.encrypt.context.EncryptContextBuilder;
-import org.apache.shardingsphere.encrypt.rule.EncryptRule;
 import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
 import org.apache.shardingsphere.encrypt.spi.context.EncryptContext;
 import org.apache.shardingsphere.infra.database.DefaultDatabase;
@@ -65,7 +64,7 @@ public final class EncryptMergedResultTest {
     @Test
     public void assertGetValueWithQueryWithPlainColumn() throws SQLException {
         when(mergedResult.getValue(1, String.class)).thenReturn("VALUE");
-        EncryptContext encryptContext = 
EncryptContextBuilder.build(DefaultDatabase.LOGIC_NAME, 
DefaultDatabase.LOGIC_NAME, "t_encrypt", "order_id", mock(EncryptRule.class));
+        EncryptContext encryptContext = 
EncryptContextBuilder.build(DefaultDatabase.LOGIC_NAME, 
DefaultDatabase.LOGIC_NAME, "t_encrypt", "order_id");
         
when(metaData.findEncryptContext(1)).thenReturn(Optional.of(encryptContext));
         assertThat(new EncryptMergedResult(metaData, mergedResult).getValue(1, 
String.class), is("VALUE"));
     }
@@ -73,7 +72,7 @@ public final class EncryptMergedResultTest {
     @Test
     public void 
assertGetValueWithQueryWithCipherColumnAndMismatchedEncryptor() throws 
SQLException {
         when(mergedResult.getValue(1, String.class)).thenReturn("VALUE");
-        EncryptContext encryptContext = 
EncryptContextBuilder.build(DefaultDatabase.LOGIC_NAME, 
DefaultDatabase.LOGIC_NAME, "t_encrypt", "order_id", mock(EncryptRule.class));
+        EncryptContext encryptContext = 
EncryptContextBuilder.build(DefaultDatabase.LOGIC_NAME, 
DefaultDatabase.LOGIC_NAME, "t_encrypt", "order_id");
         
when(metaData.findEncryptContext(1)).thenReturn(Optional.of(encryptContext));
         when(metaData.isQueryWithCipherColumn("t_encrypt", 
"order_id")).thenReturn(true);
         when(metaData.findEncryptor("t_encrypt", 
"order_id")).thenReturn(Optional.empty());
@@ -85,7 +84,7 @@ public final class EncryptMergedResultTest {
     public void 
assertGetValueWithQueryWithCipherColumnAndMatchedEncryptorWithNotNullCiphertext()
 throws SQLException {
         when(mergedResult.getValue(1, Object.class)).thenReturn("VALUE");
         EncryptAlgorithm<String, String> encryptAlgorithm = 
mock(EncryptAlgorithm.class);
-        EncryptContext encryptContext = 
EncryptContextBuilder.build(DefaultDatabase.LOGIC_NAME, 
DefaultDatabase.LOGIC_NAME, "t_encrypt", "order_id", mock(EncryptRule.class));
+        EncryptContext encryptContext = 
EncryptContextBuilder.build(DefaultDatabase.LOGIC_NAME, 
DefaultDatabase.LOGIC_NAME, "t_encrypt", "order_id");
         when(encryptAlgorithm.decrypt("VALUE", 
encryptContext)).thenReturn("ORIGINAL_VALUE");
         
when(metaData.findEncryptContext(1)).thenReturn(Optional.of(encryptContext));
         when(metaData.isQueryWithCipherColumn("t_encrypt", 
"order_id")).thenReturn(true);
@@ -97,7 +96,7 @@ public final class EncryptMergedResultTest {
     @Test
     public void 
assertGetValueWithQueryWithCipherColumnAndMatchedEncryptorWithNullCiphertext() 
throws SQLException {
         EncryptAlgorithm<String, String> encryptAlgorithm = 
mock(EncryptAlgorithm.class);
-        EncryptContext encryptContext = 
EncryptContextBuilder.build(DefaultDatabase.LOGIC_NAME, 
DefaultDatabase.LOGIC_NAME, "t_encrypt", "order_id", mock(EncryptRule.class));
+        EncryptContext encryptContext = 
EncryptContextBuilder.build(DefaultDatabase.LOGIC_NAME, 
DefaultDatabase.LOGIC_NAME, "t_encrypt", "order_id");
         
when(metaData.findEncryptContext(1)).thenReturn(Optional.of(encryptContext));
         when(metaData.isQueryWithCipherColumn("t_encrypt", 
"order_id")).thenReturn(true);
         when(metaData.findEncryptor("t_encrypt", 
"order_id")).thenReturn(Optional.of(encryptAlgorithm));
diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/metadata/EncryptSchemaMetaDataDecoratorTest.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/metadata/EncryptSchemaMetaDataDecoratorTest.java
index 34062d1503a..e3357bd3488 100644
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/metadata/EncryptSchemaMetaDataDecoratorTest.java
+++ 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/metadata/EncryptSchemaMetaDataDecoratorTest.java
@@ -17,10 +17,8 @@
 
 package org.apache.shardingsphere.encrypt.metadata;
 
-import org.apache.shardingsphere.encrypt.rule.EncryptColumn;
 import org.apache.shardingsphere.encrypt.rule.EncryptRule;
 import org.apache.shardingsphere.encrypt.rule.EncryptTable;
-import org.apache.shardingsphere.encrypt.spi.context.EncryptColumnDataType;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.builder.GenericSchemaBuilderMaterials;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.decorator.spi.RuleBasedSchemaMetaDataDecoratorFactory;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.loader.model.ColumnMetaData;
@@ -38,8 +36,6 @@ import java.util.Optional;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -61,35 +57,6 @@ public final class EncryptSchemaMetaDataDecoratorTest {
         assertThat(columnsIterator.next().getName(), is("pwd"));
     }
     
-    @Test
-    public void assertDecorateWithConfigDataType() {
-        EncryptRule rule = createEncryptRuleWithDataTypeConfig();
-        EncryptSchemaMetaDataDecorator loader = 
getEncryptMetaDataBuilder(rule, Collections.singleton(rule));
-        Collection<TableMetaData> tableMetaDataList = new LinkedList<>();
-        tableMetaDataList.add(createTableMetaData());
-        GenericSchemaBuilderMaterials materials = 
mock(GenericSchemaBuilderMaterials.class, RETURNS_DEEP_STUBS);
-        TableMetaData actual = 
loader.decorate(Collections.singletonMap("logic_db",
-                new SchemaMetaData("logic_db", tableMetaDataList)), rule, 
materials).get("logic_db").getTables().iterator().next();
-        assertThat(actual.getColumns().size(), is(2));
-        Iterator<ColumnMetaData> columnsIterator = 
actual.getColumns().iterator();
-        assertThat(columnsIterator.next().getName(), is("id"));
-        ColumnMetaData columnMetaData = columnsIterator.next();
-        assertThat(columnMetaData.getName(), is("pwd"));
-        assertThat(columnMetaData.getDataType(), is(12));
-    }
-    
-    private EncryptRule createEncryptRuleWithDataTypeConfig() {
-        EncryptRule result = createEncryptRule();
-        assertTrue(result.findEncryptTable(TABLE_NAME).isPresent());
-        EncryptTable encryptTable = result.findEncryptTable(TABLE_NAME).get();
-        EncryptColumn encryptColumn = mock(EncryptColumn.class);
-        EncryptColumnDataType encryptColumnDataType = 
mock(EncryptColumnDataType.class);
-        when(encryptColumnDataType.getDataType()).thenReturn(12);
-        
when(encryptColumn.getLogicDataType()).thenReturn(encryptColumnDataType);
-        
when(encryptTable.findEncryptColumn("pwd")).thenReturn(Optional.of(encryptColumn));
-        return result;
-    }
-    
     private EncryptRule createEncryptRule() {
         EncryptRule result = mock(EncryptRule.class);
         EncryptTable encryptTable = mock(EncryptTable.class);
diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/impl/EncryptAlterTableTokenGeneratorTest.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/impl/EncryptAlterTableTokenGeneratorTest.java
index 0f58e1024ce..c2be5f1d576 100644
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/impl/EncryptAlterTableTokenGeneratorTest.java
+++ 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/impl/EncryptAlterTableTokenGeneratorTest.java
@@ -19,12 +19,10 @@ package org.apache.shardingsphere.encrypt.rewrite.impl;
 
 import 
org.apache.shardingsphere.encrypt.rewrite.token.generator.EncryptAlterTableTokenGenerator;
 import 
org.apache.shardingsphere.encrypt.rewrite.token.pojo.EncryptAlterTableToken;
-import 
org.apache.shardingsphere.encrypt.rewrite.token.pojo.EncryptConfigDataTypeToken;
 import org.apache.shardingsphere.encrypt.rule.EncryptColumn;
 import org.apache.shardingsphere.encrypt.rule.EncryptRule;
 import org.apache.shardingsphere.encrypt.rule.EncryptTable;
 import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
-import org.apache.shardingsphere.encrypt.spi.context.EncryptColumnDataType;
 import 
org.apache.shardingsphere.infra.binder.statement.ddl.AlterTableStatementContext;
 import org.apache.shardingsphere.infra.rewrite.sql.token.pojo.SQLToken;
 import 
org.apache.shardingsphere.infra.rewrite.sql.token.pojo.generic.RemoveToken;
@@ -38,12 +36,9 @@ import 
org.apache.shardingsphere.sql.parser.sql.common.value.identifier.Identifi
 import org.junit.Before;
 import org.junit.Test;
 
-import java.sql.Types;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.Iterator;
-import java.util.Map;
 import java.util.Optional;
 
 import static org.hamcrest.CoreMatchers.instanceOf;
@@ -74,35 +69,18 @@ public final class EncryptAlterTableTokenGeneratorTest {
         when(result.findEncryptor("t_encrypt", 
"certificate_number")).thenReturn(Optional.of(encryptAlgorithm));
         when(result.findEncryptor("t_encrypt", 
"certificate_number_new")).thenReturn(Optional.of(encryptAlgorithm));
         
when(result.findEncryptTable("t_encrypt")).thenReturn(Optional.of(encryptTable));
-        when(result.containsConfigDataType("t_encrypt", 
"certificate_number")).thenReturn(true);
-        when(result.containsConfigDataType("t_encrypt", 
"certificate_number_new")).thenReturn(true);
         when(result.findEncryptColumn("t_encrypt", 
"certificate_number")).thenReturn(Optional.of(mockEncryptColumn()));
         when(result.findEncryptColumn("t_encrypt", 
"certificate_number_new")).thenReturn(Optional.of(mockNewEncryptColumn()));
+        when(result.getCipherColumn("t_encrypt", 
"certificate_number_new")).thenReturn("cipher_certificate_number_new");
         return result;
     }
     
     private EncryptColumn mockEncryptColumn() {
-        Map<String, Integer> dataTypes = new HashMap<>(2, 1);
-        dataTypes.put("int", Types.INTEGER);
-        dataTypes.put("varchar", Types.VARCHAR);
-        EncryptColumnDataType logicDataType = new 
EncryptColumnDataType("int(20) unsigned not null default 0", dataTypes);
-        EncryptColumnDataType cipherDataType = new 
EncryptColumnDataType("varchar(200) not null default ''", dataTypes);
-        EncryptColumnDataType assistedQueryDataType = new 
EncryptColumnDataType("varchar(200) not null", dataTypes);
-        EncryptColumnDataType plainDataType = new 
EncryptColumnDataType("int(20) unsigned not null default 0", dataTypes);
-        return new EncryptColumn(logicDataType, "cipher_certificate_number", 
cipherDataType, "assisted_certificate_number", assistedQueryDataType, 
"certificate_number_plain", plainDataType,
-                "test", null);
+        return new EncryptColumn("cipher_certificate_number", 
"assisted_certificate_number", "certificate_number_plain", "test", null);
     }
     
     private EncryptColumn mockNewEncryptColumn() {
-        Map<String, Integer> dataTypes = new HashMap<>(2, 1);
-        dataTypes.put("int", Types.INTEGER);
-        dataTypes.put("varchar", Types.VARCHAR);
-        EncryptColumnDataType logicDataType = new 
EncryptColumnDataType("int(20) unsigned not null default 0", dataTypes);
-        EncryptColumnDataType cipherDataType = new 
EncryptColumnDataType("varchar(500) not null", dataTypes);
-        EncryptColumnDataType assistedQueryDataType = new 
EncryptColumnDataType("varchar(200) not null", dataTypes);
-        EncryptColumnDataType plainDataType = new 
EncryptColumnDataType("int(20) unsigned not null default 0", dataTypes);
-        return new EncryptColumn(logicDataType, 
"cipher_certificate_number_new", cipherDataType,
-                "assisted_certificate_number_new", assistedQueryDataType, 
"certificate_number_new_plain", plainDataType, "test", null);
+        return new EncryptColumn("cipher_certificate_number_new", 
"assisted_certificate_number_new", "certificate_number_new_plain", "test", 
null);
     }
     
     @Test
@@ -111,18 +89,18 @@ public final class EncryptAlterTableTokenGeneratorTest {
         assertThat(sqlTokens.size(), is(4));
         Iterator<SQLToken> iterator = sqlTokens.iterator();
         assertThat(iterator.next(), instanceOf(RemoveToken.class));
-        EncryptConfigDataTypeToken cipherToken = (EncryptConfigDataTypeToken) 
iterator.next();
-        assertThat(cipherToken.toString(), is("cipher_certificate_number 
varchar(200) not null default ''"));
-        assertThat(cipherToken.getStartIndex(), is(68));
-        assertThat(cipherToken.getStopIndex(), is(67));
-        EncryptConfigDataTypeToken assistedToken = 
(EncryptConfigDataTypeToken) iterator.next();
-        assertThat(assistedToken.toString(), is(", ADD COLUMN 
assisted_certificate_number varchar(200) not null"));
+        EncryptAlterTableToken cipherToken = (EncryptAlterTableToken) 
iterator.next();
+        assertThat(cipherToken.toString(), is("cipher_certificate_number"));
+        assertThat(cipherToken.getStartIndex(), is(51));
+        assertThat(cipherToken.getStopIndex(), is(50));
+        EncryptAlterTableToken assistedToken = (EncryptAlterTableToken) 
iterator.next();
+        assertThat(assistedToken.toString(), is(", ADD COLUMN 
assisted_certificate_number"));
         assertThat(assistedToken.getStartIndex(), is(68));
-        assertThat(assistedToken.getStopIndex(), is(67));
-        EncryptConfigDataTypeToken plainToken = (EncryptConfigDataTypeToken) 
iterator.next();
-        assertThat(plainToken.toString(), is(", ADD COLUMN 
certificate_number_plain int(20) unsigned not null default 0"));
+        assertThat(assistedToken.getStopIndex(), is(50));
+        EncryptAlterTableToken plainToken = (EncryptAlterTableToken) 
iterator.next();
+        assertThat(plainToken.toString(), is(", ADD COLUMN 
certificate_number_plain"));
         assertThat(plainToken.getStartIndex(), is(68));
-        assertThat(plainToken.getStopIndex(), is(67));
+        assertThat(plainToken.getStopIndex(), is(50));
     }
     
     private AlterTableStatementContext buildAddColumnStatementContext() {
@@ -140,18 +118,18 @@ public final class EncryptAlterTableTokenGeneratorTest {
         assertThat(sqlTokens.size(), is(4));
         Iterator<SQLToken> iterator = sqlTokens.iterator();
         assertThat(iterator.next(), instanceOf(RemoveToken.class));
-        EncryptConfigDataTypeToken cipherToken = (EncryptConfigDataTypeToken) 
iterator.next();
-        assertThat(cipherToken.toString(), is("cipher_certificate_number 
varchar(200) not null default ''"));
-        assertThat(cipherToken.getStartIndex(), is(71));
-        assertThat(cipherToken.getStopIndex(), is(70));
-        EncryptConfigDataTypeToken assistedToken = 
(EncryptConfigDataTypeToken) iterator.next();
-        assertThat(assistedToken.toString(), is(", MODIFY COLUMN 
assisted_certificate_number varchar(200) not null"));
+        EncryptAlterTableToken cipherToken = (EncryptAlterTableToken) 
iterator.next();
+        assertThat(cipherToken.toString(), is("cipher_certificate_number"));
+        assertThat(cipherToken.getStartIndex(), is(54));
+        assertThat(cipherToken.getStopIndex(), is(53));
+        EncryptAlterTableToken assistedToken = (EncryptAlterTableToken) 
iterator.next();
+        assertThat(assistedToken.toString(), is(", MODIFY COLUMN 
assisted_certificate_number"));
         assertThat(assistedToken.getStartIndex(), is(71));
-        assertThat(assistedToken.getStopIndex(), is(70));
-        EncryptConfigDataTypeToken plainToken = (EncryptConfigDataTypeToken) 
iterator.next();
-        assertThat(plainToken.toString(), is(", MODIFY COLUMN 
certificate_number_plain int(20) unsigned not null default 0"));
+        assertThat(assistedToken.getStopIndex(), is(53));
+        EncryptAlterTableToken plainToken = (EncryptAlterTableToken) 
iterator.next();
+        assertThat(plainToken.toString(), is(", MODIFY COLUMN 
certificate_number_plain"));
         assertThat(plainToken.getStartIndex(), is(71));
-        assertThat(plainToken.getStopIndex(), is(70));
+        assertThat(plainToken.getStopIndex(), is(53));
     }
     
     private AlterTableStatementContext buildModifyColumnStatementContext() {
@@ -172,18 +150,18 @@ public final class EncryptAlterTableTokenGeneratorTest {
         EncryptAlterTableToken previous = (EncryptAlterTableToken) 
iterator.next();
         assertThat(previous.toString(), is("cipher_certificate_number"));
         assertThat(iterator.next(), instanceOf(RemoveToken.class));
-        EncryptConfigDataTypeToken cipherToken = (EncryptConfigDataTypeToken) 
iterator.next();
-        assertThat(cipherToken.toString(), is("cipher_certificate_number_new 
varchar(500) not null"));
-        assertThat(cipherToken.getStartIndex(), is(94));
-        assertThat(cipherToken.getStopIndex(), is(93));
-        EncryptConfigDataTypeToken assistedToken = 
(EncryptConfigDataTypeToken) iterator.next();
-        assertThat(assistedToken.toString(), is(", CHANGE COLUMN 
assisted_certificate_number assisted_certificate_number_new varchar(200) not 
null"));
+        EncryptAlterTableToken cipherToken = (EncryptAlterTableToken) 
iterator.next();
+        assertThat(cipherToken.toString(), 
is("cipher_certificate_number_new"));
+        assertThat(cipherToken.getStartIndex(), is(77));
+        assertThat(cipherToken.getStopIndex(), is(76));
+        EncryptAlterTableToken assistedToken = (EncryptAlterTableToken) 
iterator.next();
+        assertThat(assistedToken.toString(), is(", CHANGE COLUMN 
assisted_certificate_number assisted_certificate_number_new"));
         assertThat(assistedToken.getStartIndex(), is(94));
-        assertThat(assistedToken.getStopIndex(), is(93));
-        EncryptConfigDataTypeToken plainToken = (EncryptConfigDataTypeToken) 
iterator.next();
-        assertThat(plainToken.toString(), is(", CHANGE COLUMN 
certificate_number_plain certificate_number_new_plain int(20) unsigned not null 
default 0"));
+        assertThat(assistedToken.getStopIndex(), is(76));
+        EncryptAlterTableToken plainToken = (EncryptAlterTableToken) 
iterator.next();
+        assertThat(plainToken.toString(), is(", CHANGE COLUMN 
certificate_number_plain certificate_number_new_plain"));
         assertThat(plainToken.getStartIndex(), is(94));
-        assertThat(plainToken.getStopIndex(), is(93));
+        assertThat(plainToken.getStopIndex(), is(76));
     }
     
     private AlterTableStatementContext buildChangeColumnStatementContext() {
diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/impl/EncryptCreateTableTokenGeneratorTest.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/impl/EncryptCreateTableTokenGeneratorTest.java
index 0eb8f60bb79..a5f1c5e9ea7 100644
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/impl/EncryptCreateTableTokenGeneratorTest.java
+++ 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/impl/EncryptCreateTableTokenGeneratorTest.java
@@ -18,15 +18,16 @@
 package org.apache.shardingsphere.encrypt.rewrite.impl;
 
 import 
org.apache.shardingsphere.encrypt.rewrite.token.generator.EncryptCreateTableTokenGenerator;
-import 
org.apache.shardingsphere.encrypt.rewrite.token.pojo.EncryptConfigDataTypeToken;
 import org.apache.shardingsphere.encrypt.rule.EncryptColumn;
 import org.apache.shardingsphere.encrypt.rule.EncryptRule;
 import org.apache.shardingsphere.encrypt.rule.EncryptTable;
 import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
-import org.apache.shardingsphere.encrypt.spi.context.EncryptColumnDataType;
+
 import 
org.apache.shardingsphere.infra.binder.statement.ddl.CreateTableStatementContext;
 import org.apache.shardingsphere.infra.rewrite.sql.token.pojo.SQLToken;
 import 
org.apache.shardingsphere.infra.rewrite.sql.token.pojo.generic.RemoveToken;
+import 
org.apache.shardingsphere.infra.rewrite.sql.token.pojo.generic.SubstitutableColumnNameToken;
+import org.apache.shardingsphere.infra.route.context.RouteUnit;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.column.ColumnDefinitionSegment;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.column.ColumnSegment;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.DataTypeSegment;
@@ -34,12 +35,9 @@ import 
org.apache.shardingsphere.sql.parser.sql.common.value.identifier.Identifi
 import org.junit.Before;
 import org.junit.Test;
 
-import java.sql.Types;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.Iterator;
-import java.util.Map;
 import java.util.Optional;
 
 import static org.hamcrest.CoreMatchers.instanceOf;
@@ -65,18 +63,18 @@ public final class EncryptCreateTableTokenGeneratorTest {
         assertThat(sqlTokens.size(), is(4));
         Iterator<SQLToken> iterator = sqlTokens.iterator();
         assertThat(iterator.next(), instanceOf(RemoveToken.class));
-        EncryptConfigDataTypeToken cipherToken = (EncryptConfigDataTypeToken) 
iterator.next();
-        assertThat(cipherToken.toString(), is("cipher_certificate_number 
varchar(200) not null default ''"));
+        SubstitutableColumnNameToken cipherToken = 
(SubstitutableColumnNameToken) iterator.next();
+        assertThat(cipherToken.toString(mock(RouteUnit.class)), 
is("cipher_certificate_number"));
         assertThat(cipherToken.getStartIndex(), is(79));
-        assertThat(cipherToken.getStopIndex(), is(78));
-        EncryptConfigDataTypeToken assistedToken = 
(EncryptConfigDataTypeToken) iterator.next();
-        assertThat(assistedToken.toString(), is(", assisted_certificate_number 
varchar(200) not null"));
+        assertThat(cipherToken.getStopIndex(), is(42));
+        SubstitutableColumnNameToken assistedToken = 
(SubstitutableColumnNameToken) iterator.next();
+        assertThat(assistedToken.toString(mock(RouteUnit.class)), is(", 
assisted_certificate_number"));
         assertThat(assistedToken.getStartIndex(), is(79));
-        assertThat(assistedToken.getStopIndex(), is(78));
-        EncryptConfigDataTypeToken plainToken = (EncryptConfigDataTypeToken) 
iterator.next();
-        assertThat(plainToken.toString(), is(", certificate_number_plain 
int(20) unsigned not null default 0"));
+        assertThat(assistedToken.getStopIndex(), is(42));
+        SubstitutableColumnNameToken plainToken = 
(SubstitutableColumnNameToken) iterator.next();
+        assertThat(plainToken.toString(mock(RouteUnit.class)), is(", 
certificate_number_plain"));
         assertThat(plainToken.getStartIndex(), is(79));
-        assertThat(plainToken.getStopIndex(), is(78));
+        assertThat(plainToken.getStopIndex(), is(42));
     }
     
     private CreateTableStatementContext buildCreateTableStatementContext() {
@@ -95,19 +93,14 @@ public final class EncryptCreateTableTokenGeneratorTest {
         when(result.findEncryptor("t_encrypt", 
"certificate_number")).thenReturn(Optional.of(mock(EncryptAlgorithm.class)));
         
when(result.findEncryptTable("t_encrypt")).thenReturn(Optional.of(encryptTable));
         EncryptColumn column = mockEncryptColumn();
+        when(result.getCipherColumn("t_encrypt", 
"certificate_number")).thenReturn(column.getCipherColumn());
+        when(result.findPlainColumn("t_encrypt", 
"certificate_number")).thenReturn(column.getPlainColumn());
+        when(result.findAssistedQueryColumn("t_encrypt", 
"certificate_number")).thenReturn(column.getAssistedQueryColumn());
         
when(encryptTable.findEncryptColumn("certificate_number")).thenReturn(Optional.of(column));
         return result;
     }
     
     private EncryptColumn mockEncryptColumn() {
-        Map<String, Integer> dataTypes = new HashMap<>();
-        dataTypes.put("int", Types.INTEGER);
-        dataTypes.put("varchar", Types.VARCHAR);
-        EncryptColumnDataType logicDataType = new 
EncryptColumnDataType("int(20) unsigned not null default 0", dataTypes);
-        EncryptColumnDataType cipherDataType = new 
EncryptColumnDataType("varchar(200) not null default ''", dataTypes);
-        EncryptColumnDataType assistedQueryDataType = new 
EncryptColumnDataType("varchar(200) not null", dataTypes);
-        EncryptColumnDataType plainDataType = new 
EncryptColumnDataType("int(20) unsigned not null default 0", dataTypes);
-        return new EncryptColumn(logicDataType, "cipher_certificate_number", 
cipherDataType,
-                "assisted_certificate_number", assistedQueryDataType, 
"certificate_number_plain", plainDataType, "test", null);
+        return new EncryptColumn("cipher_certificate_number", 
"assisted_certificate_number", "certificate_number_plain", "test", null);
     }
 }
diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/impl/EncryptProjectionTokenGeneratorTest.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/impl/EncryptProjectionTokenGeneratorTest.java
index bd8e5405cec..b444fbbc39f 100644
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/impl/EncryptProjectionTokenGeneratorTest.java
+++ 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/impl/EncryptProjectionTokenGeneratorTest.java
@@ -70,7 +70,7 @@ public final class EncryptProjectionTokenGeneratorTest {
         when(result.findPlainColumn("doctor1", 
"mobile")).thenReturn(Optional.of("Mobile"));
         
when(result.findEncryptTable("doctor")).thenReturn(Optional.of(encryptTable1));
         
when(result.findEncryptTable("doctor1")).thenReturn(Optional.of(encryptTable2));
-        EncryptColumn column = new EncryptColumn(null, "mobile", null, null, 
null, "mobile", null, null, null);
+        EncryptColumn column = new EncryptColumn("mobile", null, "mobile", 
null, null);
         when(result.findEncryptColumn("doctor", 
"mobile")).thenReturn(Optional.of(column));
         return result;
     }
diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptColumnDataTypeTest.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptColumnDataTypeTest.java
deleted file mode 100644
index f89e63d5ba4..00000000000
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptColumnDataTypeTest.java
+++ /dev/null
@@ -1,41 +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.
- */
-
-package org.apache.shardingsphere.encrypt.rule;
-
-import org.apache.shardingsphere.encrypt.spi.context.EncryptColumnDataType;
-import org.junit.Test;
-
-import java.util.Map;
-import java.util.TreeMap;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-public final class EncryptColumnDataTypeTest {
-    
-    @Test
-    public void assertEncryptColumnDataType() {
-        Map<String, Integer> dataTypes = new 
TreeMap<>(String.CASE_INSENSITIVE_ORDER);
-        dataTypes.put("BIT", -7);
-        dataTypes.put("TINYINT", -6);
-        dataTypes.put("DATE", 91);
-        assertThat(new EncryptColumnDataType("BIT(5)", 
dataTypes).getDataType(), is(-7));
-        assertThat(new EncryptColumnDataType("TINYINT(5) UNSIGNED ZEROFILL", 
dataTypes).getDataType(), is(-6));
-        assertThat(new EncryptColumnDataType("DATE", dataTypes).getDataType(), 
is(91));
-    }
-}
diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptColumnTest.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptColumnTest.java
index b3b13be3ce5..94d34ae7194 100644
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptColumnTest.java
+++ 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptColumnTest.java
@@ -25,11 +25,11 @@ public final class EncryptColumnTest {
     
     @Test
     public void assertGetAssistedQueryColumn() {
-        assertTrue(new EncryptColumn(null, "cipherColumn", null, 
"assistedQueryColumn", null, "plainColumn", null, "encryptorName", 
null).getAssistedQueryColumn().isPresent());
+        assertTrue(new EncryptColumn("cipherColumn", "assistedQueryColumn", 
"plainColumn", "encryptorName", null).getAssistedQueryColumn().isPresent());
     }
     
     @Test
     public void assertGetPlainColumn() {
-        assertTrue(new EncryptColumn(null, "cipherColumn", null, 
"assistedQueryColumn", null, "plainColumn", null, "encryptorName", 
null).getPlainColumn().isPresent());
+        assertTrue(new EncryptColumn("cipherColumn", "assistedQueryColumn", 
"plainColumn", "encryptorName", null).getPlainColumn().isPresent());
     }
 }
diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptRuleTest.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptRuleTest.java
index d5a147fb603..60e25e510f1 100644
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptRuleTest.java
+++ 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptRuleTest.java
@@ -54,7 +54,7 @@ public final class EncryptRuleTest {
         EncryptTableRuleConfiguration tableConfig = new 
EncryptTableRuleConfiguration("t_encrypt", 
Collections.singletonList(encryptColumnConfig), null);
         AlgorithmProvidedEncryptRuleConfiguration ruleConfig = new 
AlgorithmProvidedEncryptRuleConfiguration(
                 Collections.singleton(tableConfig), 
Collections.singletonMap("test_encryptor", new CoreEncryptAlgorithmFixture()), 
true);
-        EncryptRule actual = new EncryptRule(ruleConfig, 
Collections.emptyMap());
+        EncryptRule actual = new EncryptRule(ruleConfig);
         assertTrue(actual.findEncryptTable("t_encrypt").isPresent());
     }
     
@@ -64,7 +64,7 @@ public final class EncryptRuleTest {
         EncryptColumnRuleConfiguration encryptColumnConfig = new 
EncryptColumnRuleConfiguration("encrypt_column", "encrypt_cipher", "", "", 
"test_encryptor", null);
         EncryptTableRuleConfiguration tableConfig = new 
EncryptTableRuleConfiguration("t_encrypt", 
Collections.singletonList(encryptColumnConfig), null);
         EncryptRuleConfiguration ruleConfig = new 
EncryptRuleConfiguration(Collections.singleton(tableConfig), 
Collections.singletonMap("invalid_encryptor", encryptAlgorithmConfig));
-        new EncryptRule(ruleConfig, Collections.emptyMap());
+        new EncryptRule(ruleConfig);
     }
     
     @Test(expected = IllegalArgumentException.class)
@@ -73,27 +73,27 @@ public final class EncryptRuleTest {
         EncryptTableRuleConfiguration tableConfig = new 
EncryptTableRuleConfiguration("t_encrypt", 
Collections.singletonList(encryptColumnConfig), null);
         AlgorithmProvidedEncryptRuleConfiguration ruleConfig = new 
AlgorithmProvidedEncryptRuleConfiguration(
                 Collections.singleton(tableConfig), 
Collections.singletonMap("invalid_encryptor", new 
CoreEncryptAlgorithmFixture()), true);
-        new EncryptRule(ruleConfig, Collections.emptyMap());
+        new EncryptRule(ruleConfig);
     }
     
     @Test
     public void assertFindEncryptTable() {
-        assertTrue(new EncryptRule(createEncryptRuleConfiguration(), 
Collections.emptyMap()).findEncryptTable("t_encrypt").isPresent());
+        assertTrue(new 
EncryptRule(createEncryptRuleConfiguration()).findEncryptTable("t_encrypt").isPresent());
     }
     
     @Test
     public void assertFindEncryptor() {
-        assertTrue(new EncryptRule(createEncryptRuleConfiguration(), 
Collections.emptyMap()).findEncryptor("t_encrypt", "pwd").isPresent());
+        assertTrue(new 
EncryptRule(createEncryptRuleConfiguration()).findEncryptor("t_encrypt", 
"pwd").isPresent());
     }
     
     @Test
     public void assertNotFindEncryptor() {
-        assertFalse(new EncryptRule(createEncryptRuleConfiguration(), 
Collections.emptyMap()).findEncryptor("t_encrypt", "other_column").isPresent());
+        assertFalse(new 
EncryptRule(createEncryptRuleConfiguration()).findEncryptor("t_encrypt", 
"other_column").isPresent());
     }
     
     @Test
     public void assertGetEncryptValues() {
-        List<Object> encryptAssistedQueryValues = new 
EncryptRule(createEncryptRuleConfiguration(), Collections.emptyMap())
+        List<Object> encryptAssistedQueryValues = new 
EncryptRule(createEncryptRuleConfiguration())
                 .getEncryptValues(DefaultDatabase.LOGIC_NAME, 
DefaultDatabase.LOGIC_NAME, "t_encrypt", "pwd", 
Collections.singletonList(null));
         for (final Object value : encryptAssistedQueryValues) {
             assertNull(value);
@@ -102,27 +102,27 @@ public final class EncryptRuleTest {
     
     @Test
     public void assertGetCipherColumnWhenEncryptColumnExist() {
-        assertThat(new EncryptRule(createEncryptRuleConfiguration(), 
Collections.emptyMap()).getCipherColumn("t_encrypt", "pwd"), is("pwd_cipher"));
+        assertThat(new 
EncryptRule(createEncryptRuleConfiguration()).getCipherColumn("t_encrypt", 
"pwd"), is("pwd_cipher"));
     }
     
     @Test(expected = NullPointerException.class)
     public void assertGetCipherColumnWhenNoEncryptColumn() {
-        new EncryptRule(createEncryptRuleConfiguration(), 
Collections.emptyMap()).getCipherColumn("t_encrypt", "pwd_cipher");
+        new 
EncryptRule(createEncryptRuleConfiguration()).getCipherColumn("t_encrypt", 
"pwd_cipher");
     }
     
     @Test
     public void assertGetLogicAndCipherColumns() {
-        assertFalse(new EncryptRule(createEncryptRuleConfiguration(), 
Collections.emptyMap()).getLogicAndCipherColumns("t_encrypt").isEmpty());
+        assertFalse(new 
EncryptRule(createEncryptRuleConfiguration()).getLogicAndCipherColumns("t_encrypt").isEmpty());
     }
     
     @Test
     public void assertFindAssistedQueryColumn() {
-        assertFalse(new EncryptRule(createEncryptRuleConfiguration(), 
Collections.emptyMap()).findAssistedQueryColumn("t_encrypt", 
"pwd_cipher").isPresent());
+        assertFalse(new 
EncryptRule(createEncryptRuleConfiguration()).findAssistedQueryColumn("t_encrypt",
 "pwd_cipher").isPresent());
     }
     
     @Test
     public void assertGetEncryptAssistedQueryValues() {
-        List<Object> encryptAssistedQueryValues = new 
EncryptRule(createEncryptRuleConfiguration(), Collections.emptyMap())
+        List<Object> encryptAssistedQueryValues = new 
EncryptRule(createEncryptRuleConfiguration())
                 .getEncryptAssistedQueryValues(DefaultDatabase.LOGIC_NAME, 
DefaultDatabase.LOGIC_NAME, "t_encrypt", "pwd", 
Collections.singletonList(null));
         for (final Object value : encryptAssistedQueryValues) {
             assertNull(value);
@@ -131,14 +131,14 @@ public final class EncryptRuleTest {
     
     @Test
     public void assertGetAssistedQueryColumns() {
-        assertTrue(new EncryptRule(createEncryptRuleConfiguration(), 
Collections.emptyMap()).getAssistedQueryColumns("t_encrypt").isEmpty());
+        assertTrue(new 
EncryptRule(createEncryptRuleConfiguration()).getAssistedQueryColumns("t_encrypt").isEmpty());
     }
     
     @Test
     public void assertFindPlainColumn() {
-        assertTrue(new EncryptRule(createEncryptRuleConfiguration(), 
Collections.emptyMap()).findPlainColumn("t_encrypt", "pwd").isPresent());
-        assertTrue(new EncryptRule(createEncryptRuleConfiguration(), 
Collections.emptyMap()).findPlainColumn("t_encrypt", 
"credit_card".toLowerCase()).isPresent());
-        assertFalse(new EncryptRule(createEncryptRuleConfiguration(), 
Collections.emptyMap()).findPlainColumn("t_encrypt", 
"notExistLogicColumn").isPresent());
+        assertTrue(new 
EncryptRule(createEncryptRuleConfiguration()).findPlainColumn("t_encrypt", 
"pwd").isPresent());
+        assertTrue(new 
EncryptRule(createEncryptRuleConfiguration()).findPlainColumn("t_encrypt", 
"credit_card".toLowerCase()).isPresent());
+        assertFalse(new 
EncryptRule(createEncryptRuleConfiguration()).findPlainColumn("t_encrypt", 
"notExistLogicColumn").isPresent());
     }
     
     @Test
@@ -147,49 +147,49 @@ public final class EncryptRuleTest {
         EncryptTableRuleConfiguration tableConfig = new 
EncryptTableRuleConfiguration("t_encrypt", 
Collections.singletonList(encryptColumnConfig), null);
         AlgorithmProvidedEncryptRuleConfiguration ruleConfig = new 
AlgorithmProvidedEncryptRuleConfiguration(
                 Collections.singleton(tableConfig), 
Collections.singletonMap("test_encryptor", new CoreEncryptAlgorithmFixture()), 
true);
-        EncryptRule actual = new EncryptRule(ruleConfig, 
Collections.emptyMap());
+        EncryptRule actual = new EncryptRule(ruleConfig);
         assertTrue(actual.isQueryWithCipherColumn("t_encrypt", 
"encrypt_column"));
         
         encryptColumnConfig = new 
EncryptColumnRuleConfiguration("encrypt_column", "encrypt_cipher", "", "", 
"test_encryptor", null);
         tableConfig = new EncryptTableRuleConfiguration("t_encrypt", 
Collections.singletonList(encryptColumnConfig), false);
         ruleConfig = new 
AlgorithmProvidedEncryptRuleConfiguration(Collections.singleton(tableConfig), 
Collections.singletonMap("test_encryptor", new CoreEncryptAlgorithmFixture()), 
true);
-        actual = new EncryptRule(ruleConfig, Collections.emptyMap());
+        actual = new EncryptRule(ruleConfig);
         assertFalse(actual.isQueryWithCipherColumn("t_encrypt", 
"encrypt_column"));
         
         encryptColumnConfig = new 
EncryptColumnRuleConfiguration("encrypt_column", "encrypt_cipher", "", "", 
"test_encryptor", true);
         tableConfig = new EncryptTableRuleConfiguration("t_encrypt", 
Collections.singletonList(encryptColumnConfig), false);
         ruleConfig = new 
AlgorithmProvidedEncryptRuleConfiguration(Collections.singleton(tableConfig), 
Collections.singletonMap("test_encryptor", new CoreEncryptAlgorithmFixture()), 
true);
-        actual = new EncryptRule(ruleConfig, Collections.emptyMap());
+        actual = new EncryptRule(ruleConfig);
         assertTrue(actual.isQueryWithCipherColumn("t_encrypt", 
"encrypt_column"));
         
         encryptColumnConfig = new 
EncryptColumnRuleConfiguration("encrypt_column", "encrypt_cipher", "", "", 
"test_encryptor", false);
         tableConfig = new EncryptTableRuleConfiguration("t_encrypt", 
Collections.singletonList(encryptColumnConfig), null);
         ruleConfig = new 
AlgorithmProvidedEncryptRuleConfiguration(Collections.singleton(tableConfig), 
Collections.singletonMap("test_encryptor", new CoreEncryptAlgorithmFixture()), 
true);
-        actual = new EncryptRule(ruleConfig, Collections.emptyMap());
+        actual = new EncryptRule(ruleConfig);
         assertFalse(actual.isQueryWithCipherColumn("t_encrypt", 
"encrypt_column"));
     }
     
     @Test
     public void assertGetTables() {
-        assertThat(new EncryptRule(createEncryptRuleConfiguration(), 
Collections.emptyMap()).getTables(), is(Collections.singleton("t_encrypt")));
+        assertThat(new 
EncryptRule(createEncryptRuleConfiguration()).getTables(), 
is(Collections.singleton("t_encrypt")));
     }
     
     @Test
     public void assertGetTableWithLowercase() {
-        assertThat(new 
EncryptRule(createEncryptRuleConfigurationWithUpperCaseLogicTable(), 
Collections.emptyMap()).getTables(), is(Collections.singleton("t_encrypt")));
+        assertThat(new 
EncryptRule(createEncryptRuleConfigurationWithUpperCaseLogicTable()).getTables(),
 is(Collections.singleton("t_encrypt")));
     }
     
     @Test
     public void assertTheSameLogicTable() {
-        Collection<String> logicTables = new 
EncryptRule(createEncryptRuleConfiguration(), 
Collections.emptyMap()).getTables();
-        Collection<String> theSameLogicTables = new 
EncryptRule(createEncryptRuleConfigurationWithUpperCaseLogicTable(), 
Collections.emptyMap()).getTables();
+        Collection<String> logicTables = new 
EncryptRule(createEncryptRuleConfiguration()).getTables();
+        Collection<String> theSameLogicTables = new 
EncryptRule(createEncryptRuleConfigurationWithUpperCaseLogicTable()).getTables();
         assertThat(logicTables, is(theSameLogicTables));
     }
     
     @SuppressWarnings("rawtypes")
     @Test
     public void assertGetSchemaMetaData() {
-        EncryptRule encryptRule = new 
EncryptRule(createEncryptRuleConfiguration(), Collections.emptyMap());
+        EncryptRule encryptRule = new 
EncryptRule(createEncryptRuleConfiguration());
         ShardingSphereSchema schema = mock(ShardingSphereSchema.class);
         encryptRule.setSchemaMetaData("foo_db", 
Collections.singletonMap("foo_schema", schema));
         Optional<EncryptAlgorithm> actual = 
encryptRule.findEncryptor("t_encrypt", "name");
diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptTableTest.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptTableTest.java
index 3d4513b4c19..064f2acf7b6 100644
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptTableTest.java
+++ 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptTableTest.java
@@ -39,7 +39,7 @@ public final class EncryptTableTest {
     @Before
     public void setUp() {
         encryptTable = new EncryptTable(new 
EncryptTableRuleConfiguration("t_encrypt",
-                Collections.singleton(new 
EncryptColumnRuleConfiguration("logicColumn", "cipherColumn", 
"assistedQueryColumn", "plainColumn", "myEncryptor", null)), null), 
Collections.emptyMap());
+                Collections.singleton(new 
EncryptColumnRuleConfiguration("logicColumn", "cipherColumn", 
"assistedQueryColumn", "plainColumn", "myEncryptor", null)), null));
     }
     
     @Test
@@ -127,13 +127,13 @@ public final class EncryptTableTest {
         assertFalse(actual.isPresent());
         
         encryptTable = new EncryptTable(new 
EncryptTableRuleConfiguration("t_encrypt",
-                Collections.singleton(new 
EncryptColumnRuleConfiguration("logicColumn", "cipherColumn", 
"assistedQueryColumn", "plainColumn", "myEncryptor", null)), true), 
Collections.emptyMap());
+                Collections.singleton(new 
EncryptColumnRuleConfiguration("logicColumn", "cipherColumn", 
"assistedQueryColumn", "plainColumn", "myEncryptor", null)), true));
         actual = encryptTable.getQueryWithCipherColumn("logicColumn");
         assertTrue(actual.isPresent());
         assertTrue(actual.get());
         
         encryptTable = new EncryptTable(new 
EncryptTableRuleConfiguration("t_encrypt",
-                Collections.singleton(new 
EncryptColumnRuleConfiguration("logicColumn", "cipherColumn", 
"assistedQueryColumn", "plainColumn", "myEncryptor", false)), true), 
Collections.emptyMap());
+                Collections.singleton(new 
EncryptColumnRuleConfiguration("logicColumn", "cipherColumn", 
"assistedQueryColumn", "plainColumn", "myEncryptor", false)), true));
         actual = encryptTable.getQueryWithCipherColumn("logicColumn");
         assertTrue(actual.isPresent());
         assertFalse(actual.get());
diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/converter/EncryptRuleStatementConverter.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/converter/EncryptRuleStatementConverter.java
index 84321f98f51..446d9ac403a 100644
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/converter/EncryptRuleStatementConverter.java
+++ 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/converter/EncryptRuleStatementConverter.java
@@ -60,9 +60,8 @@ public final class EncryptRuleStatementConverter {
     }
     
     private static EncryptColumnRuleConfiguration 
createEncryptColumnRuleConfiguration(final String tableName, final 
EncryptColumnSegment columnSegment) {
-        return new EncryptColumnRuleConfiguration(columnSegment.getName(), 
columnSegment.getDataType(), columnSegment.getCipherColumn(),
-                columnSegment.getCipherDataType(), 
columnSegment.getAssistedQueryColumn(), 
columnSegment.getAssistedQueryDataType(),
-                columnSegment.getPlainColumn(), 
columnSegment.getPlainDataType(), getEncryptorName(tableName, 
columnSegment.getName()), null);
+        return new EncryptColumnRuleConfiguration(columnSegment.getName(), 
columnSegment.getCipherColumn(), columnSegment.getAssistedQueryColumn(),
+                columnSegment.getPlainColumn(), getEncryptorName(tableName, 
columnSegment.getName()), null);
     }
     
     private static Map<String, ShardingSphereAlgorithmConfiguration> 
createEncryptorConfigurations(final EncryptRuleSegment ruleSegment) {
diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/query/EncryptRuleQueryResultSet.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/query/EncryptRuleQueryResultSet.java
index 3729080c56e..9d5b4f633a8 100644
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/query/EncryptRuleQueryResultSet.java
+++ 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/query/EncryptRuleQueryResultSet.java
@@ -58,10 +58,10 @@ public final class EncryptRuleQueryResultSet implements 
DistSQLResultSet {
         Collection<Collection<Object>> result = new LinkedList<>();
         tableRuleConfig.getColumns().forEach(each -> {
             ShardingSphereAlgorithmConfiguration algorithmConfig = 
algorithmMap.get(each.getEncryptorName());
-            result.add(Arrays.asList(tableRuleConfig.getName(), 
each.getLogicColumn(), nullToEmptyString(each.getLogicDataType()),
-                    each.getCipherColumn(), 
nullToEmptyString(each.getCipherDataType()),
-                    nullToEmptyString(each.getPlainColumn()), 
nullToEmptyString(each.getPlainDataType()),
-                    nullToEmptyString(each.getAssistedQueryColumn()), 
nullToEmptyString(each.getAssistedQueryDataType()),
+            result.add(Arrays.asList(tableRuleConfig.getName(), 
each.getLogicColumn(), nullToEmptyString(null),
+                    each.getCipherColumn(), nullToEmptyString(null),
+                    nullToEmptyString(each.getPlainColumn()), 
nullToEmptyString(null),
+                    nullToEmptyString(each.getAssistedQueryColumn()), 
nullToEmptyString(null),
                     algorithmConfig.getType(), 
PropertiesConverter.convert(algorithmConfig.getProps()),
                     Objects.isNull(tableRuleConfig.getQueryWithCipherColumn()) 
? Boolean.TRUE.toString() : 
tableRuleConfig.getQueryWithCipherColumn().toString()));
         });
diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/query/EncryptRuleQueryResultSetTest.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/query/EncryptRuleQueryResultSetTest.java
index 1fe7edc6f24..1806e3f5573 100644
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/query/EncryptRuleQueryResultSetTest.java
+++ 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/query/EncryptRuleQueryResultSetTest.java
@@ -54,12 +54,10 @@ public final class EncryptRuleQueryResultSetTest {
         assertTrue(actual.contains("user_cipher"));
         assertTrue(actual.contains("user_plain"));
         assertTrue(actual.contains("md5"));
-        assertTrue(actual.contains("varchar(10)"));
     }
     
     private RuleConfiguration getRuleConfiguration() {
-        EncryptColumnRuleConfiguration encryptColumnRuleConfig = new 
EncryptColumnRuleConfiguration("user_id", "varchar(10)", "user_cipher", 
"varchar(10)", null, null,
-                "user_plain", "varchar(10)", "test", null);
+        EncryptColumnRuleConfiguration encryptColumnRuleConfig = new 
EncryptColumnRuleConfiguration("user_id", "user_cipher", null, "user_plain", 
"test", null);
         EncryptTableRuleConfiguration encryptTableRuleConfig = new 
EncryptTableRuleConfiguration("t_encrypt", 
Collections.singleton(encryptColumnRuleConfig), null);
         ShardingSphereAlgorithmConfiguration shardingSphereAlgorithmConfig = 
new ShardingSphereAlgorithmConfiguration("md5", new Properties());
         return new 
EncryptRuleConfiguration(Collections.singleton(encryptTableRuleConfig), 
Collections.singletonMap("test", shardingSphereAlgorithmConfig));

Reply via email to