You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2021/05/28 10:17:28 UTC

[shardingsphere] branch master updated: support pg drop multi index statement & add validator test (#10524)

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

panjuan 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 d27092c  support pg drop multi index statement & add validator test (#10524)
d27092c is described below

commit d27092c98e10f291fd154b875220c0bebe01c9e1
Author: Zhengqiang Duan <st...@gmail.com>
AuthorDate: Fri May 28 18:17:08 2021 +0800

    support pg drop multi index statement & add validator test (#10524)
    
    * support pg drop multi index statement & add validator test
    
    * fix checkstyle
    
    * fix checkstyle
    
    * fix rewrite test case
---
 .../token/generator/impl/IndexTokenGenerator.java  |   8 +-
 .../sharding/rewrite/token/pojo/IndexToken.java    |  29 ++-
 .../src/test/resources/sharding/index.xml          |  12 +-
 .../sharding/route/engine/ShardingSQLRouter.java   |   2 +-
 .../validator/ShardingStatementValidator.java      |   5 +-
 .../ShardingStatementValidatorFactory.java         |  15 ++
 .../ddl/ShardingDDLStatementValidator.java         |  11 ++
 ...a => ShardingAlterIndexStatementValidator.java} |  29 +--
 .../impl/ShardingAlterTableStatementValidator.java |  10 +-
 .../impl/ShardingAlterViewStatementValidator.java  |   3 +-
 .../ShardingCreateFunctionStatementValidator.java  |   3 +-
 ... => ShardingCreateIndexStatementValidator.java} |  23 ++-
 .../ShardingCreateProcedureStatementValidator.java |   3 +-
 .../ShardingCreateTableStatementValidator.java     |   7 +-
 .../impl/ShardingCreateViewStatementValidator.java |   3 +-
 ...va => ShardingDropIndexStatementValidator.java} |  36 ++--
 .../impl/ShardingDropTableStatementValidator.java  |   9 +-
 .../impl/ShardingPrepareStatementValidator.java    |   3 +-
 .../dml/impl/ShardingDeleteStatementValidator.java |   5 +-
 .../dml/impl/ShardingInsertStatementValidator.java |   6 +-
 .../dml/impl/ShardingSelectStatementValidator.java |   6 +-
 .../dml/impl/ShardingUpdateStatementValidator.java |   5 +-
 .../ShardingAlterIndexStatementValidatorTest.java  |  94 ++++++++++
 .../ShardingAlterTableStatementValidatorTest.java  |  12 +-
 .../ShardingCreateIndexStatementValidatorTest.java |  91 ++++++++++
 .../ShardingCreateTableStatementValidatorTest.java |  15 +-
 .../ShardingDropIndexStatementValidatorTest.java   | 202 +++++++++++++++++++++
 .../ShardingDropTableStatementValidatorTest.java   |  15 +-
 .../ddl/ShardingPrepareStatementValidatorTest.java |   8 +-
 29 files changed, 562 insertions(+), 108 deletions(-)

diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-rewrite/src/main/java/org/apache/shardingsphere/sharding/rewrite/token/generator/impl/IndexTokenGenerator.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-rewrite/src/main/java/org/apache/shardingsphere/sharding/rewrite/token/generator/impl/IndexTokenGenerator.java
index b7e30a3..3938ebd 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-rewrite/src/main/java/org/apache/shardingsphere/sharding/rewrite/token/generator/impl/IndexTokenGenerator.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-rewrite/src/main/java/org/apache/shardingsphere/sharding/rewrite/token/generator/impl/IndexTokenGenerator.java
@@ -18,6 +18,8 @@
 package org.apache.shardingsphere.sharding.rewrite.token.generator.impl;
 
 import lombok.Setter;
+import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
+import org.apache.shardingsphere.infra.rewrite.sql.token.generator.aware.SchemaMetaDataAware;
 import org.apache.shardingsphere.sharding.rule.ShardingRule;
 import org.apache.shardingsphere.sharding.rule.aware.ShardingRuleAware;
 import org.apache.shardingsphere.sharding.rewrite.token.pojo.IndexToken;
@@ -34,10 +36,12 @@ import java.util.LinkedList;
  * Index token generator.
  */
 @Setter
-public final class IndexTokenGenerator implements CollectionSQLTokenGenerator, ShardingRuleAware {
+public final class IndexTokenGenerator implements CollectionSQLTokenGenerator, ShardingRuleAware, SchemaMetaDataAware {
     
     private ShardingRule shardingRule;
     
+    private ShardingSphereSchema schema;
+    
     @Override
     public boolean isGenerateSQLToken(final SQLStatementContext sqlStatementContext) {
         return sqlStatementContext instanceof IndexAvailable && !((IndexAvailable) sqlStatementContext).getIndexes().isEmpty();
@@ -48,7 +52,7 @@ public final class IndexTokenGenerator implements CollectionSQLTokenGenerator, S
         Collection<IndexToken> result = new LinkedList<>();
         if (sqlStatementContext instanceof IndexAvailable) {
             for (SQLSegment each : ((IndexAvailable) sqlStatementContext).getIndexes()) {
-                result.add(new IndexToken(each.getStartIndex(), each.getStopIndex(), ((IndexSegment) each).getIdentifier(), sqlStatementContext, shardingRule));
+                result.add(new IndexToken(each.getStartIndex(), each.getStopIndex(), ((IndexSegment) each).getIdentifier(), sqlStatementContext, shardingRule, schema));
             }
         }
         return result;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-rewrite/src/main/java/org/apache/shardingsphere/sharding/rewrite/token/pojo/IndexToken.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-rewrite/src/main/java/org/apache/shardingsphere/sharding/rewrite/token/pojo/IndexToken.java
index 7a8e578..16bd328 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-rewrite/src/main/java/org/apache/shardingsphere/sharding/rewrite/token/pojo/IndexToken.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-rewrite/src/main/java/org/apache/shardingsphere/sharding/rewrite/token/pojo/IndexToken.java
@@ -18,18 +18,20 @@
 package org.apache.shardingsphere.sharding.rewrite.token.pojo;
 
 import lombok.Getter;
-import org.apache.shardingsphere.sharding.rule.ShardingRule;
-import org.apache.shardingsphere.infra.rewrite.sql.token.pojo.RouteUnitAware;
 import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
-import org.apache.shardingsphere.sql.parser.sql.common.value.identifier.IdentifierValue;
+import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
+import org.apache.shardingsphere.infra.rewrite.sql.token.pojo.RouteUnitAware;
 import org.apache.shardingsphere.infra.rewrite.sql.token.pojo.SQLToken;
 import org.apache.shardingsphere.infra.rewrite.sql.token.pojo.Substitutable;
 import org.apache.shardingsphere.infra.route.context.RouteMapper;
 import org.apache.shardingsphere.infra.route.context.RouteUnit;
+import org.apache.shardingsphere.sharding.rule.ShardingRule;
+import org.apache.shardingsphere.sql.parser.sql.common.value.identifier.IdentifierValue;
 
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Optional;
 
 /**
  * Index token.
@@ -45,12 +47,16 @@ public final class IndexToken extends SQLToken implements Substitutable, RouteUn
     
     private final ShardingRule shardingRule;
     
-    public IndexToken(final int startIndex, final int stopIndex, final IdentifierValue identifier, final SQLStatementContext sqlStatementContext, final ShardingRule shardingRule) {
+    private final ShardingSphereSchema schema;
+    
+    public IndexToken(final int startIndex, final int stopIndex, final IdentifierValue identifier, 
+                      final SQLStatementContext sqlStatementContext, final ShardingRule shardingRule, final ShardingSphereSchema schema) {
         super(startIndex);
         this.stopIndex = stopIndex;
         this.identifier = identifier;
         this.sqlStatementContext = sqlStatementContext;
         this.shardingRule = shardingRule;
+        this.schema = schema;
     }
     
     @Override
@@ -61,12 +67,21 @@ public final class IndexToken extends SQLToken implements Substitutable, RouteUn
     private String getIndexValue(final RouteUnit routeUnit) {
         StringBuilder result = new StringBuilder(identifier.getValue());
         Map<String, String> logicAndActualTables = getLogicAndActualTables(routeUnit);
-        if (!logicAndActualTables.isEmpty()) {
-            result.append("_").append(logicAndActualTables.values().iterator().next());
-        }
+        Optional<String> actualTableName = findLogicTableNameFromMetaData(identifier.getValue()).map(tableName 
+            -> Optional.of(logicAndActualTables.get(tableName))).orElseGet(() -> logicAndActualTables.values().stream().findFirst());
+        actualTableName.ifPresent(tableName -> result.append("_").append(tableName));
         return result.toString();
     }
     
+    private Optional<String> findLogicTableNameFromMetaData(final String logicIndexName) {
+        for (String each : schema.getAllTableNames()) {
+            if (schema.get(each).getIndexes().containsKey(logicIndexName)) {
+                return Optional.of(each);
+            }
+        }
+        return Optional.empty();
+    }
+    
     private Map<String, String> getLogicAndActualTables(final RouteUnit routeUnit) {
         Collection<String> tableNames = sqlStatementContext.getTablesContext().getTableNames();
         Map<String, String> result = new HashMap<>(tableNames.size(), 1);
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-rewrite/src/test/resources/sharding/index.xml b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-rewrite/src/test/resources/sharding/index.xml
index 74ca166..7fab745 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-rewrite/src/test/resources/sharding/index.xml
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-rewrite/src/test/resources/sharding/index.xml
@@ -18,15 +18,15 @@
 
 <rewrite-assertions yaml-rule="yaml/sharding/sharding-rule.yaml">
     <rewrite-assertion id="create_index_for_mysql" db-type="MySQL">
-        <input sql="CREATE INDEX index_name ON t_account (status)" />
-        <output sql="CREATE INDEX index_name_t_account_0 ON t_account_0 (status)" />
-        <output sql="CREATE INDEX index_name_t_account_1 ON t_account_1 (status)" />
+        <input sql="CREATE INDEX index_name_not_exist ON t_account (status)" />
+        <output sql="CREATE INDEX index_name_not_exist_t_account_0 ON t_account_0 (status)" />
+        <output sql="CREATE INDEX index_name_not_exist_t_account_1 ON t_account_1 (status)" />
     </rewrite-assertion>
 
     <rewrite-assertion id="create_index_for_postgresql" db-type="PostgreSQL">
-        <input sql="CREATE INDEX index_name ON t_account (status)" />
-        <output sql="CREATE INDEX index_name_t_account_0 ON t_account_0 (status)" />
-        <output sql="CREATE INDEX index_name_t_account_1 ON t_account_1 (status)" />
+        <input sql="CREATE INDEX index_name_not_exist ON t_account (status)" />
+        <output sql="CREATE INDEX index_name_not_exist_t_account_0 ON t_account_0 (status)" />
+        <output sql="CREATE INDEX index_name_not_exist_t_account_1 ON t_account_1 (status)" />
     </rewrite-assertion>
     
     <rewrite-assertion id="drop_index_for_mysql" db-type="MySQL">
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/ShardingSQLRouter.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/ShardingSQLRouter.java
index 7f1ea3d..a7c9b1e 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/ShardingSQLRouter.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/ShardingSQLRouter.java
@@ -59,7 +59,7 @@ public final class ShardingSQLRouter implements SQLRouter<ShardingRule> {
             mergeShardingConditions(shardingConditions);
         }
         ShardingRouteEngineFactory.newInstance(rule, metaData, logicSQL.getSqlStatementContext(), shardingConditions, props).route(result, rule);
-        validator.ifPresent(v -> v.postValidate(rule, sqlStatement, result));
+        validator.ifPresent(v -> v.postValidate(rule, logicSQL.getSqlStatementContext(), result, metaData.getSchema()));
         return result;
     }
     
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ShardingStatementValidator.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ShardingStatementValidator.java
index b76fe74..d1a64b9 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ShardingStatementValidator.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ShardingStatementValidator.java
@@ -46,8 +46,9 @@ public interface ShardingStatementValidator<T extends SQLStatement> {
      * Validate whether sharding operation is supported after route.
      *
      * @param shardingRule sharding rule
-     * @param sqlStatement SQL statement
+     * @param sqlStatementContext SQL statement context
      * @param routeContext route context
+     * @param schema ShardingSphere schema
      */
-    void postValidate(ShardingRule shardingRule, T sqlStatement, RouteContext routeContext);
+    void postValidate(ShardingRule shardingRule, SQLStatementContext<T> sqlStatementContext, RouteContext routeContext, ShardingSphereSchema schema);
 }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ShardingStatementValidatorFactory.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ShardingStatementValidatorFactory.java
index 69d31ca..a7f881a 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ShardingStatementValidatorFactory.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ShardingStatementValidatorFactory.java
@@ -19,12 +19,15 @@ package org.apache.shardingsphere.sharding.route.engine.validator;
 
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
+import org.apache.shardingsphere.sharding.route.engine.validator.ddl.impl.ShardingAlterIndexStatementValidator;
 import org.apache.shardingsphere.sharding.route.engine.validator.ddl.impl.ShardingAlterTableStatementValidator;
 import org.apache.shardingsphere.sharding.route.engine.validator.ddl.impl.ShardingAlterViewStatementValidator;
 import org.apache.shardingsphere.sharding.route.engine.validator.ddl.impl.ShardingCreateFunctionStatementValidator;
+import org.apache.shardingsphere.sharding.route.engine.validator.ddl.impl.ShardingCreateIndexStatementValidator;
 import org.apache.shardingsphere.sharding.route.engine.validator.ddl.impl.ShardingCreateProcedureStatementValidator;
 import org.apache.shardingsphere.sharding.route.engine.validator.ddl.impl.ShardingCreateTableStatementValidator;
 import org.apache.shardingsphere.sharding.route.engine.validator.ddl.impl.ShardingCreateViewStatementValidator;
+import org.apache.shardingsphere.sharding.route.engine.validator.ddl.impl.ShardingDropIndexStatementValidator;
 import org.apache.shardingsphere.sharding.route.engine.validator.ddl.impl.ShardingDropTableStatementValidator;
 import org.apache.shardingsphere.sharding.route.engine.validator.ddl.impl.ShardingPrepareStatementValidator;
 import org.apache.shardingsphere.sharding.route.engine.validator.dml.impl.ShardingDeleteStatementValidator;
@@ -32,13 +35,16 @@ import org.apache.shardingsphere.sharding.route.engine.validator.dml.impl.Shardi
 import org.apache.shardingsphere.sharding.route.engine.validator.dml.impl.ShardingSelectStatementValidator;
 import org.apache.shardingsphere.sharding.route.engine.validator.dml.impl.ShardingUpdateStatementValidator;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.AlterIndexStatement;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.AlterTableStatement;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.AlterViewStatement;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.CreateFunctionStatement;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.CreateIndexStatement;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.CreateProcedureStatement;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.CreateTableStatement;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.CreateViewStatement;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.DDLStatement;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.DropIndexStatement;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.DropTableStatement;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.dml.DMLStatement;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.dml.DeleteStatement;
@@ -84,15 +90,24 @@ public final class ShardingStatementValidatorFactory {
         if (sqlStatement instanceof CreateViewStatement) {
             return Optional.of(new ShardingCreateViewStatementValidator());
         }
+        if (sqlStatement instanceof CreateIndexStatement) {
+            return Optional.of(new ShardingCreateIndexStatementValidator());
+        }
         if (sqlStatement instanceof AlterTableStatement) {
             return Optional.of(new ShardingAlterTableStatementValidator());
         }
         if (sqlStatement instanceof AlterViewStatement) {
             return Optional.of(new ShardingAlterViewStatementValidator());
         }
+        if (sqlStatement instanceof AlterIndexStatement) {
+            return Optional.of(new ShardingAlterIndexStatementValidator());
+        }
         if (sqlStatement instanceof DropTableStatement) {
             return Optional.of(new ShardingDropTableStatementValidator());
         }
+        if (sqlStatement instanceof DropIndexStatement) {
+            return Optional.of(new ShardingDropIndexStatementValidator());
+        }
         if (sqlStatement instanceof PostgreSQLPrepareStatement) {
             return Optional.of(new ShardingPrepareStatementValidator());
         }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingDDLStatementValidator.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingDDLStatementValidator.java
index d3f3a28..f38d8a9 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingDDLStatementValidator.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingDDLStatementValidator.java
@@ -24,6 +24,7 @@ import org.apache.shardingsphere.sharding.route.engine.exception.NoSuchTableExce
 import org.apache.shardingsphere.sharding.route.engine.exception.TableExistsException;
 import org.apache.shardingsphere.sharding.route.engine.validator.ShardingStatementValidator;
 import org.apache.shardingsphere.sharding.rule.ShardingRule;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.index.IndexSegment;
 import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.SimpleTableSegment;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.DDLStatement;
 
@@ -92,4 +93,14 @@ public abstract class ShardingDDLStatementValidator<T extends DDLStatement> impl
                 ? shardingRule.getTableRule(primaryTable).getActualDataNodes().size() : 1;
         return primaryTableDataNodeSize != routeContext.getRouteUnits().size();
     }
+    
+    /**
+     * Judge whether schema contains index or not.
+     *
+     * @param schema ShardingSphere schema
+     * @param index index
+     */
+    protected boolean isSchemaContainsIndex(final ShardingSphereSchema schema, final IndexSegment index) {
+        return schema.getAllTableNames().stream().anyMatch(each -> schema.get(each).getIndexes().containsKey(index.getIdentifier().getValue()));
+    }
 }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateTableStatementValidator.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingAlterIndexStatementValidator.java
similarity index 60%
copy from shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateTableStatementValidator.java
copy to shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingAlterIndexStatementValidator.java
index 6afc0f0..8619e2e 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateTableStatementValidator.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingAlterIndexStatementValidator.java
@@ -23,30 +23,33 @@ import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
 import org.apache.shardingsphere.infra.route.context.RouteContext;
 import org.apache.shardingsphere.sharding.route.engine.validator.ddl.ShardingDDLStatementValidator;
 import org.apache.shardingsphere.sharding.rule.ShardingRule;
-import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.CreateTableStatement;
-import org.apache.shardingsphere.sql.parser.sql.dialect.handler.ddl.CreateTableStatementHandler;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.index.IndexSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.AlterIndexStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.handler.ddl.AlterIndexStatementHandler;
 
-import java.util.Collections;
 import java.util.List;
+import java.util.Optional;
 
 /**
- * Sharding create table statement validator.
+ * Sharding alter index statement validator.
  */
-public final class ShardingCreateTableStatementValidator extends ShardingDDLStatementValidator<CreateTableStatement> {
+public final class ShardingAlterIndexStatementValidator extends ShardingDDLStatementValidator<AlterIndexStatement> {
     
     @Override
-    public void preValidate(final ShardingRule shardingRule, final SQLStatementContext<CreateTableStatement> sqlStatementContext, 
+    public void preValidate(final ShardingRule shardingRule, final SQLStatementContext<AlterIndexStatement> sqlStatementContext, 
                             final List<Object> parameters, final ShardingSphereSchema schema) {
-        if (!CreateTableStatementHandler.containsIfNotExistClause(sqlStatementContext.getSqlStatement())) {
-            validateTableNotExist(schema, Collections.singletonList(sqlStatementContext.getSqlStatement().getTable()));
+        Optional<IndexSegment> index = sqlStatementContext.getSqlStatement().getIndex();
+        if (index.isPresent() && !isSchemaContainsIndex(schema, index.get())) {
+            throw new ShardingSphereException("Index '%s' does not exist.", index.get().getIdentifier().getValue());
+        }
+        Optional<IndexSegment> renameIndex = AlterIndexStatementHandler.getRenameIndexSegment(sqlStatementContext.getSqlStatement());
+        if (renameIndex.isPresent() && isSchemaContainsIndex(schema, renameIndex.get())) {
+            throw new ShardingSphereException("Index '%s' already exists.", renameIndex.get().getIdentifier().getValue());
         }
     }
     
     @Override
-    public void postValidate(final ShardingRule shardingRule, final CreateTableStatement sqlStatement, final RouteContext routeContext) {
-        String primaryTable = sqlStatement.getTable().getTableName().getIdentifier().getValue();
-        if (isRouteUnitPrimaryTableDataNodeDifferentSize(shardingRule, routeContext, primaryTable)) {
-            throw new ShardingSphereException("CREATE TABLE ... statement route unit size must be same with primary table '%s' data node size.", primaryTable);
-        }
+    public void postValidate(final ShardingRule shardingRule, final SQLStatementContext<AlterIndexStatement> sqlStatementContext, 
+                             final RouteContext routeContext, final ShardingSphereSchema schema) {
     }
 }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingAlterTableStatementValidator.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingAlterTableStatementValidator.java
index 70d5f8b..07d5db7 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingAlterTableStatementValidator.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingAlterTableStatementValidator.java
@@ -38,7 +38,8 @@ import java.util.stream.Collectors;
 public final class ShardingAlterTableStatementValidator extends ShardingDDLStatementValidator<AlterTableStatement> {
     
     @Override
-    public void preValidate(final ShardingRule shardingRule, final SQLStatementContext<AlterTableStatement> sqlStatementContext, final List<Object> parameters, final ShardingSphereSchema schema) {
+    public void preValidate(final ShardingRule shardingRule, final SQLStatementContext<AlterTableStatement> sqlStatementContext, 
+                            final List<Object> parameters, final ShardingSphereSchema schema) {
         Collection<String> tableNames = sqlStatementContext instanceof TableAvailable
                 ? ((TableAvailable) sqlStatementContext).getAllTables().stream().map(each -> each.getTableName().getIdentifier().getValue()).collect(Collectors.toList())
                 : sqlStatementContext.getTablesContext().getTableNames();
@@ -56,10 +57,11 @@ public final class ShardingAlterTableStatementValidator extends ShardingDDLState
     }
     
     @Override
-    public void postValidate(final ShardingRule shardingRule, final AlterTableStatement sqlStatement, final RouteContext routeContext) {
-        String primaryTable = sqlStatement.getTable().getTableName().getIdentifier().getValue();
+    public void postValidate(final ShardingRule shardingRule, final SQLStatementContext<AlterTableStatement> sqlStatementContext, 
+                             final RouteContext routeContext, final ShardingSphereSchema schema) {
+        String primaryTable = sqlStatementContext.getSqlStatement().getTable().getTableName().getIdentifier().getValue();
         if (isRouteUnitPrimaryTableDataNodeDifferentSize(shardingRule, routeContext, primaryTable)) {
-            throw new ShardingSphereException("ALTER TABLE ... statement route unit size must be same with primary table '%s' data node size.", primaryTable);
+            throw new ShardingSphereException("ALTER TABLE ... statement can not route correctly for tables %s.", sqlStatementContext.getTablesContext().getTableNames());
         }
     }
 }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingAlterViewStatementValidator.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingAlterViewStatementValidator.java
index d05e5aa..a84f485 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingAlterViewStatementValidator.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingAlterViewStatementValidator.java
@@ -47,6 +47,7 @@ public final class ShardingAlterViewStatementValidator extends ShardingDDLStatem
     }
     
     @Override
-    public void postValidate(final ShardingRule shardingRule, final AlterViewStatement sqlStatement, final RouteContext routeContext) {
+    public void postValidate(final ShardingRule shardingRule, final SQLStatementContext<AlterViewStatement> sqlStatementContext, 
+                             final RouteContext routeContext, final ShardingSphereSchema schema) {
     }
 }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateFunctionStatementValidator.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateFunctionStatementValidator.java
index 133ac58..e980763 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateFunctionStatementValidator.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateFunctionStatementValidator.java
@@ -51,6 +51,7 @@ public final class ShardingCreateFunctionStatementValidator extends ShardingDDLS
     }
     
     @Override
-    public void postValidate(final ShardingRule shardingRule, final CreateFunctionStatement sqlStatement, final RouteContext routeContext) {
+    public void postValidate(final ShardingRule shardingRule, final SQLStatementContext<CreateFunctionStatement> sqlStatementContext, 
+                             final RouteContext routeContext, final ShardingSphereSchema schema) {
     }
 }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateTableStatementValidator.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateIndexStatementValidator.java
similarity index 63%
copy from shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateTableStatementValidator.java
copy to shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateIndexStatementValidator.java
index 6afc0f0..1e7cb1e 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateTableStatementValidator.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateIndexStatementValidator.java
@@ -23,30 +23,29 @@ import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
 import org.apache.shardingsphere.infra.route.context.RouteContext;
 import org.apache.shardingsphere.sharding.route.engine.validator.ddl.ShardingDDLStatementValidator;
 import org.apache.shardingsphere.sharding.rule.ShardingRule;
-import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.CreateTableStatement;
-import org.apache.shardingsphere.sql.parser.sql.dialect.handler.ddl.CreateTableStatementHandler;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.CreateIndexStatement;
 
 import java.util.Collections;
 import java.util.List;
 
 /**
- * Sharding create table statement validator.
+ * Sharding create index statement validator.
  */
-public final class ShardingCreateTableStatementValidator extends ShardingDDLStatementValidator<CreateTableStatement> {
+public final class ShardingCreateIndexStatementValidator extends ShardingDDLStatementValidator<CreateIndexStatement> {
     
     @Override
-    public void preValidate(final ShardingRule shardingRule, final SQLStatementContext<CreateTableStatement> sqlStatementContext, 
+    public void preValidate(final ShardingRule shardingRule, final SQLStatementContext<CreateIndexStatement> sqlStatementContext, 
                             final List<Object> parameters, final ShardingSphereSchema schema) {
-        if (!CreateTableStatementHandler.containsIfNotExistClause(sqlStatementContext.getSqlStatement())) {
-            validateTableNotExist(schema, Collections.singletonList(sqlStatementContext.getSqlStatement().getTable()));
+        validateTableExist(schema, Collections.singletonList(sqlStatementContext.getSqlStatement().getTable()));
+        String tableName = sqlStatementContext.getSqlStatement().getTable().getTableName().getIdentifier().getValue();
+        String indexName = sqlStatementContext.getSqlStatement().getIndex().getIdentifier().getValue();
+        if (schema.get(tableName).getIndexes().containsKey(indexName)) {
+            throw new ShardingSphereException("Index '%s' already exists.", indexName);
         }
     }
     
     @Override
-    public void postValidate(final ShardingRule shardingRule, final CreateTableStatement sqlStatement, final RouteContext routeContext) {
-        String primaryTable = sqlStatement.getTable().getTableName().getIdentifier().getValue();
-        if (isRouteUnitPrimaryTableDataNodeDifferentSize(shardingRule, routeContext, primaryTable)) {
-            throw new ShardingSphereException("CREATE TABLE ... statement route unit size must be same with primary table '%s' data node size.", primaryTable);
-        }
+    public void postValidate(final ShardingRule shardingRule, final SQLStatementContext<CreateIndexStatement> sqlStatementContext, 
+                             final RouteContext routeContext, final ShardingSphereSchema schema) {
     }
 }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateProcedureStatementValidator.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateProcedureStatementValidator.java
index b5267e7..f36c13a 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateProcedureStatementValidator.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateProcedureStatementValidator.java
@@ -51,6 +51,7 @@ public final class ShardingCreateProcedureStatementValidator extends ShardingDDL
     }
     
     @Override
-    public void postValidate(final ShardingRule shardingRule, final CreateProcedureStatement sqlStatement, final RouteContext routeContext) {
+    public void postValidate(final ShardingRule shardingRule, final SQLStatementContext<CreateProcedureStatement> sqlStatementContext, 
+                             final RouteContext routeContext, final ShardingSphereSchema schema) {
     }
 }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateTableStatementValidator.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateTableStatementValidator.java
index 6afc0f0..d261058 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateTableStatementValidator.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateTableStatementValidator.java
@@ -43,10 +43,11 @@ public final class ShardingCreateTableStatementValidator extends ShardingDDLStat
     }
     
     @Override
-    public void postValidate(final ShardingRule shardingRule, final CreateTableStatement sqlStatement, final RouteContext routeContext) {
-        String primaryTable = sqlStatement.getTable().getTableName().getIdentifier().getValue();
+    public void postValidate(final ShardingRule shardingRule, final SQLStatementContext<CreateTableStatement> sqlStatementContext, 
+                             final RouteContext routeContext, final ShardingSphereSchema schema) {
+        String primaryTable = sqlStatementContext.getSqlStatement().getTable().getTableName().getIdentifier().getValue();
         if (isRouteUnitPrimaryTableDataNodeDifferentSize(shardingRule, routeContext, primaryTable)) {
-            throw new ShardingSphereException("CREATE TABLE ... statement route unit size must be same with primary table '%s' data node size.", primaryTable);
+            throw new ShardingSphereException("CREATE TABLE ... statement can not route correctly for tables %s.", sqlStatementContext.getTablesContext().getTableNames());
         }
     }
 }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateViewStatementValidator.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateViewStatementValidator.java
index d04ab55..870488b 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateViewStatementValidator.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateViewStatementValidator.java
@@ -47,6 +47,7 @@ public final class ShardingCreateViewStatementValidator extends ShardingDDLState
     }
     
     @Override
-    public void postValidate(final ShardingRule shardingRule, final CreateViewStatement sqlStatement, final RouteContext routeContext) {
+    public void postValidate(final ShardingRule shardingRule, final SQLStatementContext<CreateViewStatement> sqlStatementContext, 
+                             final RouteContext routeContext, final ShardingSphereSchema schema) {
     }
 }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateFunctionStatementValidator.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingDropIndexStatementValidator.java
similarity index 54%
copy from shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateFunctionStatementValidator.java
copy to shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingDropIndexStatementValidator.java
index 133ac58..ecc2e55 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateFunctionStatementValidator.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingDropIndexStatementValidator.java
@@ -18,39 +18,41 @@
 package org.apache.shardingsphere.sharding.route.engine.validator.ddl.impl;
 
 import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
+import org.apache.shardingsphere.infra.exception.ShardingSphereException;
 import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
 import org.apache.shardingsphere.infra.route.context.RouteContext;
 import org.apache.shardingsphere.sharding.route.engine.validator.ddl.ShardingDDLStatementValidator;
 import org.apache.shardingsphere.sharding.rule.ShardingRule;
-import org.apache.shardingsphere.sql.parser.sql.common.extractor.TableExtractor;
-import org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.routine.RoutineBodySegment;
-import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.SimpleTableSegment;
-import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.CreateFunctionStatement;
-import org.apache.shardingsphere.sql.parser.sql.dialect.handler.ddl.CreateFunctionStatementHandler;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.index.IndexSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.DropIndexStatement;
 
 import java.util.Collection;
 import java.util.List;
 import java.util.Optional;
+import java.util.stream.Collectors;
 
 /**
- * Sharding create function statement validator.
+ * Sharding drop index statement validator.
  */
-public final class ShardingCreateFunctionStatementValidator extends ShardingDDLStatementValidator<CreateFunctionStatement> {
+public final class ShardingDropIndexStatementValidator extends ShardingDDLStatementValidator<DropIndexStatement> {
     
     @Override
-    public void preValidate(final ShardingRule shardingRule, final SQLStatementContext<CreateFunctionStatement> sqlStatementContext, 
+    public void preValidate(final ShardingRule shardingRule, final SQLStatementContext<DropIndexStatement> sqlStatementContext, 
                             final List<Object> parameters, final ShardingSphereSchema schema) {
-        Optional<RoutineBodySegment> routineBodySegment = CreateFunctionStatementHandler.getRoutineBodySegment(sqlStatementContext.getSqlStatement());
-        routineBodySegment.ifPresent(routineBody -> {
-            TableExtractor extractor = new TableExtractor();
-            Collection<SimpleTableSegment> existTables = extractor.extractExistTableFromRoutineBody(routineBody);
-            validateShardingTable(schema, existTables);
-            validateTableExist(schema, existTables);
-            validateTableNotExist(schema, extractor.extractNotExistTableFromRoutineBody(routineBody));
-        });
+        for (IndexSegment each : sqlStatementContext.getSqlStatement().getIndexes()) {
+            if (!isSchemaContainsIndex(schema, each)) {
+                throw new ShardingSphereException("Index '%s' does not exist.", each.getIdentifier().getValue());
+            }
+        }
     }
     
     @Override
-    public void postValidate(final ShardingRule shardingRule, final CreateFunctionStatement sqlStatement, final RouteContext routeContext) {
+    public void postValidate(final ShardingRule shardingRule, final SQLStatementContext<DropIndexStatement> sqlStatementContext, 
+                             final RouteContext routeContext, final ShardingSphereSchema schema) {
+        Collection<String> indexNames = sqlStatementContext.getSqlStatement().getIndexes().stream().map(each -> each.getIdentifier().getValue()).collect(Collectors.toList());
+        Optional<String> primaryTable = schema.getAllTableNames().stream().filter(each -> schema.get(each).getIndexes().containsKey(indexNames.iterator().next())).findFirst();
+        if (primaryTable.isPresent() && isRouteUnitPrimaryTableDataNodeDifferentSize(shardingRule, routeContext, primaryTable.get())) {
+            throw new ShardingSphereException("DROP INDEX ... statement can not route correctly for indexes %s.", indexNames);
+        }
     }
 }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingDropTableStatementValidator.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingDropTableStatementValidator.java
index 29bdbe6..cd97411 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingDropTableStatementValidator.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingDropTableStatementValidator.java
@@ -48,11 +48,12 @@ public final class ShardingDropTableStatementValidator extends ShardingDDLStatem
     }
     
     @Override
-    public void postValidate(final ShardingRule shardingRule, final DropTableStatement sqlStatement, final RouteContext routeContext) {
-        checkTableInUsed(shardingRule, sqlStatement, routeContext);
-        String primaryTable = sqlStatement.getTables().iterator().next().getTableName().getIdentifier().getValue();
+    public void postValidate(final ShardingRule shardingRule, final SQLStatementContext<DropTableStatement> sqlStatementContext, 
+                             final RouteContext routeContext, final ShardingSphereSchema schema) {
+        checkTableInUsed(shardingRule, sqlStatementContext.getSqlStatement(), routeContext);
+        String primaryTable = sqlStatementContext.getSqlStatement().getTables().iterator().next().getTableName().getIdentifier().getValue();
         if (isRouteUnitPrimaryTableDataNodeDifferentSize(shardingRule, routeContext, primaryTable)) {
-            throw new ShardingSphereException("DROP TABLE ... statement route unit size must be same with primary table '%s' data node size.", primaryTable);
+            throw new ShardingSphereException("DROP TABLE ... statement can not route correctly for tables %s.", sqlStatementContext.getTablesContext().getTableNames());
         }
     }
     
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingPrepareStatementValidator.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingPrepareStatementValidator.java
index 523be71..1d2ed62 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingPrepareStatementValidator.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingPrepareStatementValidator.java
@@ -45,7 +45,8 @@ public final class ShardingPrepareStatementValidator extends ShardingDDLStatemen
     }
     
     @Override
-    public void postValidate(final ShardingRule shardingRule, final PostgreSQLPrepareStatement sqlStatement, final RouteContext routeContext) {
+    public void postValidate(final ShardingRule shardingRule, final SQLStatementContext<PostgreSQLPrepareStatement> sqlStatementContext, 
+                             final RouteContext routeContext, final ShardingSphereSchema schema) {
         if (routeContext.getRouteUnits().isEmpty()) {
             throw new ShardingSphereException("Can not get route result, please check your sharding table config.");
         }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/impl/ShardingDeleteStatementValidator.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/impl/ShardingDeleteStatementValidator.java
index 9ec750d..79bd574 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/impl/ShardingDeleteStatementValidator.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/impl/ShardingDeleteStatementValidator.java
@@ -40,8 +40,9 @@ public final class ShardingDeleteStatementValidator extends ShardingDMLStatement
     }
     
     @Override
-    public void postValidate(final ShardingRule shardingRule, final DeleteStatement sqlStatement, final RouteContext routeContext) {
-        if (DeleteStatementHandler.getLimitSegment(sqlStatement).isPresent() && routeContext.getRouteUnits().size() > 1) {
+    public void postValidate(final ShardingRule shardingRule, final SQLStatementContext<DeleteStatement> sqlStatementContext, 
+                             final RouteContext routeContext, final ShardingSphereSchema schema) {
+        if (DeleteStatementHandler.getLimitSegment(sqlStatementContext.getSqlStatement()).isPresent() && routeContext.getRouteUnits().size() > 1) {
             throw new ShardingSphereException("DELETE ... LIMIT can not support sharding route to multiple data nodes.");
         }
     }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/impl/ShardingInsertStatementValidator.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/impl/ShardingInsertStatementValidator.java
index dde6449..29e9d3d 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/impl/ShardingInsertStatementValidator.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/impl/ShardingInsertStatementValidator.java
@@ -17,6 +17,7 @@
 
 package org.apache.shardingsphere.sharding.route.engine.validator.dml.impl;
 
+import com.google.common.base.Preconditions;
 import org.apache.shardingsphere.infra.binder.segment.table.TablesContext;
 import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
 import org.apache.shardingsphere.infra.binder.statement.dml.InsertStatementContext;
@@ -32,8 +33,6 @@ import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.subquery
 import org.apache.shardingsphere.sql.parser.sql.common.statement.dml.InsertStatement;
 import org.apache.shardingsphere.sql.parser.sql.dialect.handler.dml.InsertStatementHandler;
 
-import com.google.common.base.Preconditions;
-
 import java.util.Collection;
 import java.util.List;
 import java.util.Optional;
@@ -93,7 +92,8 @@ public final class ShardingInsertStatementValidator extends ShardingDMLStatement
     }
     
     @Override
-    public void postValidate(final ShardingRule shardingRule, final InsertStatement sqlStatement, final RouteContext routeContext) {
+    public void postValidate(final ShardingRule shardingRule, final SQLStatementContext<InsertStatement> sqlStatementContext, 
+                             final RouteContext routeContext, final ShardingSphereSchema schema) {
         if (needCheckDatabaseInstance) {
             Preconditions.checkState(routeContext.isSingleRouting(), "Sharding value must same with subquery.");
         }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/impl/ShardingSelectStatementValidator.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/impl/ShardingSelectStatementValidator.java
index 7b315e9..98fdf13 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/impl/ShardingSelectStatementValidator.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/impl/ShardingSelectStatementValidator.java
@@ -17,6 +17,7 @@
 
 package org.apache.shardingsphere.sharding.route.engine.validator.dml.impl;
 
+import com.google.common.base.Preconditions;
 import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
 import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
 import org.apache.shardingsphere.infra.route.context.RouteContext;
@@ -24,8 +25,6 @@ import org.apache.shardingsphere.sharding.route.engine.validator.dml.ShardingDML
 import org.apache.shardingsphere.sharding.rule.ShardingRule;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.dml.SelectStatement;
 
-import com.google.common.base.Preconditions;
-
 import java.util.List;
 
 /**
@@ -44,7 +43,8 @@ public final class ShardingSelectStatementValidator extends ShardingDMLStatement
     }
     
     @Override
-    public void postValidate(final ShardingRule shardingRule, final SelectStatement sqlStatement, final RouteContext routeContext) {
+    public void postValidate(final ShardingRule shardingRule, final SQLStatementContext<SelectStatement> sqlStatementContext, 
+                             final RouteContext routeContext, final ShardingSphereSchema schema) {
         if (needCheckDatabaseInstance) {
             Preconditions.checkState(routeContext.isSingleRouting(), "Sharding value must same with subquery.");
         }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/impl/ShardingUpdateStatementValidator.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/impl/ShardingUpdateStatementValidator.java
index 1e77770..4f9b6d3 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/impl/ShardingUpdateStatementValidator.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/impl/ShardingUpdateStatementValidator.java
@@ -151,8 +151,9 @@ public final class ShardingUpdateStatementValidator extends ShardingDMLStatement
     }
     
     @Override
-    public void postValidate(final ShardingRule shardingRule, final UpdateStatement sqlStatement, final RouteContext routeContext) {
-        if (UpdateStatementHandler.getLimitSegment(sqlStatement).isPresent() && routeContext.getRouteUnits().size() > 1) {
+    public void postValidate(final ShardingRule shardingRule, final SQLStatementContext<UpdateStatement> sqlStatementContext, 
+                             final RouteContext routeContext, final ShardingSphereSchema schema) {
+        if (UpdateStatementHandler.getLimitSegment(sqlStatementContext.getSqlStatement()).isPresent() && routeContext.getRouteUnits().size() > 1) {
             throw new ShardingSphereException("UPDATE ... LIMIT can not support sharding route to multiple data nodes.");
         }
     }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingAlterIndexStatementValidatorTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingAlterIndexStatementValidatorTest.java
new file mode 100644
index 0000000..20d0d6c
--- /dev/null
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingAlterIndexStatementValidatorTest.java
@@ -0,0 +1,94 @@
+/*
+ * 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.sharding.route.engine.validator.ddl;
+
+import org.apache.shardingsphere.infra.binder.statement.ddl.AlterIndexStatementContext;
+import org.apache.shardingsphere.infra.exception.ShardingSphereException;
+import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
+import org.apache.shardingsphere.infra.metadata.schema.model.IndexMetaData;
+import org.apache.shardingsphere.infra.metadata.schema.model.TableMetaData;
+import org.apache.shardingsphere.sharding.route.engine.validator.ddl.impl.ShardingAlterIndexStatementValidator;
+import org.apache.shardingsphere.sharding.rule.ShardingRule;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.index.IndexSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.value.identifier.IdentifierValue;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl.PostgreSQLAlterIndexStatement;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+@RunWith(MockitoJUnitRunner.class)
+public final class ShardingAlterIndexStatementValidatorTest {
+    
+    @Mock
+    private ShardingRule shardingRule;
+    
+    @Mock
+    private ShardingSphereSchema schema;
+    
+    @Test
+    public void assertPreValidateAlterIndexWhenIndexExistRenameIndexNotExistForPostgreSQL() {
+        PostgreSQLAlterIndexStatement sqlStatement = new PostgreSQLAlterIndexStatement();
+        sqlStatement.setIndex(new IndexSegment(0, 0, new IdentifierValue("t_order_index")));
+        sqlStatement.setRenameIndex(new IndexSegment(0, 0, new IdentifierValue("t_order_index_new")));
+        TableMetaData tableMetaData = mock(TableMetaData.class);
+        Map<String, IndexMetaData> indexes = mock(HashMap.class);
+        when(tableMetaData.getIndexes()).thenReturn(indexes);
+        when(schema.getAllTableNames()).thenReturn(Collections.singletonList("t_order"));
+        when(schema.get("t_order")).thenReturn(tableMetaData);
+        when(indexes.containsKey("t_order_index")).thenReturn(true);
+        when(indexes.containsKey("t_order_index_new")).thenReturn(false);
+        new ShardingAlterIndexStatementValidator().preValidate(shardingRule, new AlterIndexStatementContext(sqlStatement), Collections.emptyList(), schema);
+    }
+    
+    @Test(expected = ShardingSphereException.class)
+    public void assertPreValidateAlterIndexWhenIndexNotExistRenameIndexNotExistForPostgreSQL() {
+        PostgreSQLAlterIndexStatement sqlStatement = new PostgreSQLAlterIndexStatement();
+        sqlStatement.setIndex(new IndexSegment(0, 0, new IdentifierValue("t_order_index")));
+        sqlStatement.setRenameIndex(new IndexSegment(0, 0, new IdentifierValue("t_order_index_new")));
+        TableMetaData tableMetaData = mock(TableMetaData.class);
+        Map<String, IndexMetaData> indexes = mock(HashMap.class);
+        when(tableMetaData.getIndexes()).thenReturn(indexes);
+        when(schema.getAllTableNames()).thenReturn(Collections.singletonList("t_order"));
+        when(schema.get("t_order")).thenReturn(tableMetaData);
+        when(indexes.containsKey("t_order_index")).thenReturn(false);
+        new ShardingAlterIndexStatementValidator().preValidate(shardingRule, new AlterIndexStatementContext(sqlStatement), Collections.emptyList(), schema);
+    }
+    
+    @Test(expected = ShardingSphereException.class)
+    public void assertPreValidateAlterIndexWhenIndexExistRenameIndexExistForPostgreSQL() {
+        PostgreSQLAlterIndexStatement sqlStatement = new PostgreSQLAlterIndexStatement();
+        sqlStatement.setIndex(new IndexSegment(0, 0, new IdentifierValue("t_order_index")));
+        sqlStatement.setRenameIndex(new IndexSegment(0, 0, new IdentifierValue("t_order_index_new")));
+        TableMetaData tableMetaData = mock(TableMetaData.class);
+        Map<String, IndexMetaData> indexes = mock(HashMap.class);
+        when(tableMetaData.getIndexes()).thenReturn(indexes);
+        when(schema.getAllTableNames()).thenReturn(Collections.singletonList("t_order"));
+        when(schema.get("t_order")).thenReturn(tableMetaData);
+        when(indexes.containsKey("t_order_index")).thenReturn(true);
+        when(indexes.containsKey("t_order_index_new")).thenReturn(true);
+        new ShardingAlterIndexStatementValidator().preValidate(shardingRule, new AlterIndexStatementContext(sqlStatement), Collections.emptyList(), schema);
+    }
+}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingAlterTableStatementValidatorTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingAlterTableStatementValidatorTest.java
index 4ffb634..ba74a9c 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingAlterTableStatementValidatorTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingAlterTableStatementValidatorTest.java
@@ -124,7 +124,7 @@ public final class ShardingAlterTableStatementValidatorTest {
         routeUnits.add(new RouteUnit(new RouteMapper("ds_0", "ds_0"), Collections.singletonList(new RouteMapper("t_order", "t_order_0"))));
         routeUnits.add(new RouteUnit(new RouteMapper("ds_1", "ds_1"), Collections.singletonList(new RouteMapper("t_order", "t_order_0"))));
         when(routeContext.getRouteUnits()).thenReturn(routeUnits);
-        new ShardingAlterTableStatementValidator().postValidate(shardingRule, sqlStatement, routeContext);
+        new ShardingAlterTableStatementValidator().postValidate(shardingRule, new AlterTableStatementContext(sqlStatement), routeContext, schema);
     }
     
     @Test(expected = ShardingSphereException.class)
@@ -136,7 +136,7 @@ public final class ShardingAlterTableStatementValidatorTest {
         Collection<RouteUnit> routeUnits = new LinkedList<>();
         routeUnits.add(new RouteUnit(new RouteMapper("ds_0", "ds_0"), Collections.singletonList(new RouteMapper("t_order", "t_order_0"))));
         when(routeContext.getRouteUnits()).thenReturn(routeUnits);
-        new ShardingAlterTableStatementValidator().postValidate(shardingRule, sqlStatement, routeContext);
+        new ShardingAlterTableStatementValidator().postValidate(shardingRule, new AlterTableStatementContext(sqlStatement), routeContext, schema);
     }
     
     @Test
@@ -149,7 +149,7 @@ public final class ShardingAlterTableStatementValidatorTest {
         routeUnits.add(new RouteUnit(new RouteMapper("ds_0", "ds_0"), Collections.singletonList(new RouteMapper("t_config", "t_config"))));
         routeUnits.add(new RouteUnit(new RouteMapper("ds_1", "ds_1"), Collections.singletonList(new RouteMapper("t_config", "t_config"))));
         when(routeContext.getRouteUnits()).thenReturn(routeUnits);
-        new ShardingAlterTableStatementValidator().postValidate(shardingRule, sqlStatement, routeContext);
+        new ShardingAlterTableStatementValidator().postValidate(shardingRule, new AlterTableStatementContext(sqlStatement), routeContext, schema);
     }
     
     @Test(expected = ShardingSphereException.class)
@@ -161,7 +161,7 @@ public final class ShardingAlterTableStatementValidatorTest {
         Collection<RouteUnit> routeUnits = new LinkedList<>();
         routeUnits.add(new RouteUnit(new RouteMapper("ds_0", "ds_0"), Collections.singletonList(new RouteMapper("t_config", "t_config"))));
         when(routeContext.getRouteUnits()).thenReturn(routeUnits);
-        new ShardingAlterTableStatementValidator().postValidate(shardingRule, sqlStatement, routeContext);
+        new ShardingAlterTableStatementValidator().postValidate(shardingRule, new AlterTableStatementContext(sqlStatement), routeContext, schema);
     }
     
     @Test
@@ -171,7 +171,7 @@ public final class ShardingAlterTableStatementValidatorTest {
         Collection<RouteUnit> routeUnits = new LinkedList<>();
         routeUnits.add(new RouteUnit(new RouteMapper("ds_0", "ds_0"), Collections.singletonList(new RouteMapper("t_single", "t_single"))));
         when(routeContext.getRouteUnits()).thenReturn(routeUnits);
-        new ShardingAlterTableStatementValidator().postValidate(shardingRule, sqlStatement, routeContext);
+        new ShardingAlterTableStatementValidator().postValidate(shardingRule, new AlterTableStatementContext(sqlStatement), routeContext, schema);
     }
     
     @Test(expected = ShardingSphereException.class)
@@ -182,6 +182,6 @@ public final class ShardingAlterTableStatementValidatorTest {
         routeUnits.add(new RouteUnit(new RouteMapper("ds_0", "ds_0"), Collections.singletonList(new RouteMapper("t_single", "t_single"))));
         routeUnits.add(new RouteUnit(new RouteMapper("ds_1", "ds_1"), Collections.singletonList(new RouteMapper("t_single", "t_single"))));
         when(routeContext.getRouteUnits()).thenReturn(routeUnits);
-        new ShardingAlterTableStatementValidator().postValidate(shardingRule, sqlStatement, routeContext);
+        new ShardingAlterTableStatementValidator().postValidate(shardingRule, new AlterTableStatementContext(sqlStatement), routeContext, schema);
     }
 }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingCreateIndexStatementValidatorTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingCreateIndexStatementValidatorTest.java
new file mode 100644
index 0000000..5709ce9
--- /dev/null
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingCreateIndexStatementValidatorTest.java
@@ -0,0 +1,91 @@
+/*
+ * 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.sharding.route.engine.validator.ddl;
+
+import org.apache.shardingsphere.infra.binder.statement.ddl.CreateIndexStatementContext;
+import org.apache.shardingsphere.infra.exception.ShardingSphereException;
+import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
+import org.apache.shardingsphere.infra.metadata.schema.model.IndexMetaData;
+import org.apache.shardingsphere.infra.metadata.schema.model.TableMetaData;
+import org.apache.shardingsphere.sharding.route.engine.exception.NoSuchTableException;
+import org.apache.shardingsphere.sharding.route.engine.validator.ddl.impl.ShardingCreateIndexStatementValidator;
+import org.apache.shardingsphere.sharding.rule.ShardingRule;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.index.IndexSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.SimpleTableSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.value.identifier.IdentifierValue;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl.PostgreSQLCreateIndexStatement;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+@RunWith(MockitoJUnitRunner.class)
+public final class ShardingCreateIndexStatementValidatorTest {
+    
+    @Mock
+    private ShardingRule shardingRule;
+    
+    @Mock
+    private ShardingSphereSchema schema;
+    
+    @Test
+    public void assertPreValidateCreateIndexWhenTableExistIndexNotExistForPostgreSQL() {
+        PostgreSQLCreateIndexStatement sqlStatement = new PostgreSQLCreateIndexStatement();
+        sqlStatement.setTable(new SimpleTableSegment(0, 0, new IdentifierValue("t_order")));
+        sqlStatement.setIndex(new IndexSegment(0, 0, new IdentifierValue("t_order_index")));
+        when(schema.containsTable("t_order")).thenReturn(true);
+        TableMetaData tableMetaData = mock(TableMetaData.class);
+        when(schema.get("t_order")).thenReturn(tableMetaData);
+        Map<String, IndexMetaData> indexes = mock(HashMap.class);
+        when(tableMetaData.getIndexes()).thenReturn(indexes);
+        when(indexes.containsKey("t_order_index")).thenReturn(false);
+        new ShardingCreateIndexStatementValidator().preValidate(shardingRule, new CreateIndexStatementContext(sqlStatement), Collections.emptyList(), schema);
+    }
+    
+    @Test(expected = NoSuchTableException.class)
+    public void assertPreValidateCreateIndexWhenTableNotExistIndexNotExistForPostgreSQL() {
+        PostgreSQLCreateIndexStatement sqlStatement = new PostgreSQLCreateIndexStatement();
+        sqlStatement.setTable(new SimpleTableSegment(0, 0, new IdentifierValue("t_order")));
+        sqlStatement.setIndex(new IndexSegment(0, 0, new IdentifierValue("t_order_index")));
+        when(schema.containsTable("t_order")).thenReturn(false);
+        TableMetaData tableMetaData = mock(TableMetaData.class);
+        Map<String, IndexMetaData> indexes = mock(HashMap.class);
+        new ShardingCreateIndexStatementValidator().preValidate(shardingRule, new CreateIndexStatementContext(sqlStatement), Collections.emptyList(), schema);
+    }
+    
+    @Test(expected = ShardingSphereException.class)
+    public void assertPreValidateCreateIndexWhenTableExistIndexExistForPostgreSQL() {
+        PostgreSQLCreateIndexStatement sqlStatement = new PostgreSQLCreateIndexStatement();
+        sqlStatement.setTable(new SimpleTableSegment(0, 0, new IdentifierValue("t_order")));
+        sqlStatement.setIndex(new IndexSegment(0, 0, new IdentifierValue("t_order_index")));
+        when(schema.containsTable("t_order")).thenReturn(true);
+        TableMetaData tableMetaData = mock(TableMetaData.class);
+        when(schema.get("t_order")).thenReturn(tableMetaData);
+        Map<String, IndexMetaData> indexes = mock(HashMap.class);
+        when(tableMetaData.getIndexes()).thenReturn(indexes);
+        when(indexes.containsKey("t_order_index")).thenReturn(true);
+        new ShardingCreateIndexStatementValidator().preValidate(shardingRule, new CreateIndexStatementContext(sqlStatement), Collections.emptyList(), schema);
+    }
+}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingCreateTableStatementValidatorTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingCreateTableStatementValidatorTest.java
index 185a061..ccc836d 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingCreateTableStatementValidatorTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingCreateTableStatementValidatorTest.java
@@ -56,6 +56,9 @@ public final class ShardingCreateTableStatementValidatorTest {
     private ShardingRule shardingRule;
     
     @Mock
+    private ShardingSphereSchema schema;
+    
+    @Mock
     private RouteContext routeContext;
     
     @Test(expected = TableExistsException.class)
@@ -134,7 +137,7 @@ public final class ShardingCreateTableStatementValidatorTest {
         routeUnits.add(new RouteUnit(new RouteMapper("ds_0", "ds_0"), Collections.singletonList(new RouteMapper("t_order", "t_order_0"))));
         routeUnits.add(new RouteUnit(new RouteMapper("ds_1", "ds_1"), Collections.singletonList(new RouteMapper("t_order", "t_order_0"))));
         when(routeContext.getRouteUnits()).thenReturn(routeUnits);
-        new ShardingCreateTableStatementValidator().postValidate(shardingRule, sqlStatement, routeContext);
+        new ShardingCreateTableStatementValidator().postValidate(shardingRule, new CreateTableStatementContext(sqlStatement), routeContext, schema);
     }
     
     @Test(expected = ShardingSphereException.class)
@@ -146,7 +149,7 @@ public final class ShardingCreateTableStatementValidatorTest {
         Collection<RouteUnit> routeUnits = new LinkedList<>();
         routeUnits.add(new RouteUnit(new RouteMapper("ds_0", "ds_0"), Collections.singletonList(new RouteMapper("t_order", "t_order_0"))));
         when(routeContext.getRouteUnits()).thenReturn(routeUnits);
-        new ShardingCreateTableStatementValidator().postValidate(shardingRule, sqlStatement, routeContext);
+        new ShardingCreateTableStatementValidator().postValidate(shardingRule, new CreateTableStatementContext(sqlStatement), routeContext, schema);
     }
     
     @Test
@@ -159,7 +162,7 @@ public final class ShardingCreateTableStatementValidatorTest {
         routeUnits.add(new RouteUnit(new RouteMapper("ds_0", "ds_0"), Collections.singletonList(new RouteMapper("t_config", "t_config"))));
         routeUnits.add(new RouteUnit(new RouteMapper("ds_1", "ds_1"), Collections.singletonList(new RouteMapper("t_config", "t_config"))));
         when(routeContext.getRouteUnits()).thenReturn(routeUnits);
-        new ShardingCreateTableStatementValidator().postValidate(shardingRule, sqlStatement, routeContext);
+        new ShardingCreateTableStatementValidator().postValidate(shardingRule, new CreateTableStatementContext(sqlStatement), routeContext, schema);
     }
     
     @Test(expected = ShardingSphereException.class)
@@ -171,7 +174,7 @@ public final class ShardingCreateTableStatementValidatorTest {
         Collection<RouteUnit> routeUnits = new LinkedList<>();
         routeUnits.add(new RouteUnit(new RouteMapper("ds_0", "ds_0"), Collections.singletonList(new RouteMapper("t_config", "t_config"))));
         when(routeContext.getRouteUnits()).thenReturn(routeUnits);
-        new ShardingCreateTableStatementValidator().postValidate(shardingRule, sqlStatement, routeContext);
+        new ShardingCreateTableStatementValidator().postValidate(shardingRule, new CreateTableStatementContext(sqlStatement), routeContext, schema);
     }
     
     @Test
@@ -181,7 +184,7 @@ public final class ShardingCreateTableStatementValidatorTest {
         Collection<RouteUnit> routeUnits = new LinkedList<>();
         routeUnits.add(new RouteUnit(new RouteMapper("ds_0", "ds_0"), Collections.singletonList(new RouteMapper("t_single", "t_single"))));
         when(routeContext.getRouteUnits()).thenReturn(routeUnits);
-        new ShardingCreateTableStatementValidator().postValidate(shardingRule, sqlStatement, routeContext);
+        new ShardingCreateTableStatementValidator().postValidate(shardingRule, new CreateTableStatementContext(sqlStatement), routeContext, schema);
     }
     
     @Test(expected = ShardingSphereException.class)
@@ -192,6 +195,6 @@ public final class ShardingCreateTableStatementValidatorTest {
         routeUnits.add(new RouteUnit(new RouteMapper("ds_0", "ds_0"), Collections.singletonList(new RouteMapper("t_single", "t_single"))));
         routeUnits.add(new RouteUnit(new RouteMapper("ds_1", "ds_1"), Collections.singletonList(new RouteMapper("t_single", "t_single"))));
         when(routeContext.getRouteUnits()).thenReturn(routeUnits);
-        new ShardingCreateTableStatementValidator().postValidate(shardingRule, sqlStatement, routeContext);
+        new ShardingCreateTableStatementValidator().postValidate(shardingRule, new CreateTableStatementContext(sqlStatement), routeContext, schema);
     }
 }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingDropIndexStatementValidatorTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingDropIndexStatementValidatorTest.java
new file mode 100644
index 0000000..e243241
--- /dev/null
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingDropIndexStatementValidatorTest.java
@@ -0,0 +1,202 @@
+/*
+ * 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.sharding.route.engine.validator.ddl;
+
+import org.apache.shardingsphere.infra.binder.statement.ddl.DropIndexStatementContext;
+import org.apache.shardingsphere.infra.exception.ShardingSphereException;
+import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
+import org.apache.shardingsphere.infra.metadata.schema.model.IndexMetaData;
+import org.apache.shardingsphere.infra.metadata.schema.model.TableMetaData;
+import org.apache.shardingsphere.infra.route.context.RouteContext;
+import org.apache.shardingsphere.infra.route.context.RouteMapper;
+import org.apache.shardingsphere.infra.route.context.RouteUnit;
+import org.apache.shardingsphere.sharding.route.engine.validator.ddl.impl.ShardingDropIndexStatementValidator;
+import org.apache.shardingsphere.sharding.rule.ShardingRule;
+import org.apache.shardingsphere.sharding.rule.TableRule;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.index.IndexSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.value.identifier.IdentifierValue;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl.PostgreSQLDropIndexStatement;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+@RunWith(MockitoJUnitRunner.class)
+public final class ShardingDropIndexStatementValidatorTest {
+    
+    @Mock
+    private ShardingRule shardingRule;
+    
+    @Mock
+    private ShardingSphereSchema schema;
+    
+    @Mock
+    private RouteContext routeContext;
+    
+    @Test
+    public void assertPreValidateDropIndexWhenIndexExistForPostgreSQL() {
+        PostgreSQLDropIndexStatement sqlStatement = new PostgreSQLDropIndexStatement();
+        sqlStatement.getIndexes().add(new IndexSegment(0, 0, new IdentifierValue("t_order_index")));
+        sqlStatement.getIndexes().add(new IndexSegment(0, 0, new IdentifierValue("t_order_index_new")));
+        TableMetaData tableMetaData = mock(TableMetaData.class);
+        Map<String, IndexMetaData> indexes = mock(HashMap.class);
+        when(tableMetaData.getIndexes()).thenReturn(indexes);
+        when(schema.getAllTableNames()).thenReturn(Collections.singletonList("t_order"));
+        when(schema.get("t_order")).thenReturn(tableMetaData);
+        when(indexes.containsKey("t_order_index")).thenReturn(true);
+        when(indexes.containsKey("t_order_index_new")).thenReturn(true);
+        new ShardingDropIndexStatementValidator().preValidate(shardingRule, new DropIndexStatementContext(sqlStatement), Collections.emptyList(), schema);
+    }
+    
+    @Test(expected = ShardingSphereException.class)
+    public void assertPreValidateDropIndexWhenIndexNotExistForPostgreSQL() {
+        PostgreSQLDropIndexStatement sqlStatement = new PostgreSQLDropIndexStatement();
+        sqlStatement.getIndexes().add(new IndexSegment(0, 0, new IdentifierValue("t_order_index")));
+        sqlStatement.getIndexes().add(new IndexSegment(0, 0, new IdentifierValue("t_order_index_new")));
+        TableMetaData tableMetaData = mock(TableMetaData.class);
+        Map<String, IndexMetaData> indexes = mock(HashMap.class);
+        when(tableMetaData.getIndexes()).thenReturn(indexes);
+        when(schema.getAllTableNames()).thenReturn(Collections.singletonList("t_order"));
+        when(schema.get("t_order")).thenReturn(tableMetaData);
+        when(indexes.containsKey("t_order_index")).thenReturn(false);
+        new ShardingDropIndexStatementValidator().preValidate(shardingRule, new DropIndexStatementContext(sqlStatement), Collections.emptyList(), schema);
+    }
+    
+    @Test
+    public void assertPostValidateDropIndexWithSameRouteResultShardingTableIndexForPostgreSQL() {
+        PostgreSQLDropIndexStatement sqlStatement = new PostgreSQLDropIndexStatement();
+        sqlStatement.getIndexes().add(new IndexSegment(0, 0, new IdentifierValue("t_order_index")));
+        sqlStatement.getIndexes().add(new IndexSegment(0, 0, new IdentifierValue("t_order_index_new")));
+        TableMetaData tableMetaData = mock(TableMetaData.class);
+        Map<String, IndexMetaData> indexes = mock(HashMap.class);
+        when(tableMetaData.getIndexes()).thenReturn(indexes);
+        when(schema.getAllTableNames()).thenReturn(Collections.singletonList("t_order"));
+        when(schema.get("t_order")).thenReturn(tableMetaData);
+        when(indexes.containsKey("t_order_index")).thenReturn(true);
+        when(shardingRule.isShardingTable("t_order")).thenReturn(true);
+        when(shardingRule.getTableRule("t_order")).thenReturn(new TableRule(Arrays.asList("ds_0", "ds_1"), "t_order"));
+        Collection<RouteUnit> routeUnits = new LinkedList<>();
+        routeUnits.add(new RouteUnit(new RouteMapper("ds_0", "ds_0"), Collections.singletonList(new RouteMapper("t_order", "t_order_0"))));
+        routeUnits.add(new RouteUnit(new RouteMapper("ds_1", "ds_1"), Collections.singletonList(new RouteMapper("t_order", "t_order_0"))));
+        when(routeContext.getRouteUnits()).thenReturn(routeUnits);
+        new ShardingDropIndexStatementValidator().postValidate(shardingRule, new DropIndexStatementContext(sqlStatement), routeContext, schema);
+    }
+    
+    @Test(expected = ShardingSphereException.class)
+    public void assertPostValidateDropIndexWithDifferentRouteResultShardingTableIndexForPostgreSQL() {
+        PostgreSQLDropIndexStatement sqlStatement = new PostgreSQLDropIndexStatement();
+        sqlStatement.getIndexes().add(new IndexSegment(0, 0, new IdentifierValue("t_order_index")));
+        sqlStatement.getIndexes().add(new IndexSegment(0, 0, new IdentifierValue("t_order_index_new")));
+        TableMetaData tableMetaData = mock(TableMetaData.class);
+        Map<String, IndexMetaData> indexes = mock(HashMap.class);
+        when(tableMetaData.getIndexes()).thenReturn(indexes);
+        when(schema.getAllTableNames()).thenReturn(Collections.singletonList("t_order"));
+        when(schema.get("t_order")).thenReturn(tableMetaData);
+        when(indexes.containsKey("t_order_index")).thenReturn(true);
+        when(shardingRule.isShardingTable("t_order")).thenReturn(true);
+        when(shardingRule.getTableRule("t_order")).thenReturn(new TableRule(Arrays.asList("ds_0", "ds_1"), "t_order"));
+        Collection<RouteUnit> routeUnits = new LinkedList<>();
+        routeUnits.add(new RouteUnit(new RouteMapper("ds_0", "ds_0"), Collections.singletonList(new RouteMapper("t_order", "t_order_0"))));
+        when(routeContext.getRouteUnits()).thenReturn(routeUnits);
+        new ShardingDropIndexStatementValidator().postValidate(shardingRule, new DropIndexStatementContext(sqlStatement), routeContext, schema);
+    }
+    
+    @Test
+    public void assertPostValidateDropIndexWithSameRouteResultBroadcastTableIndexForPostgreSQL() {
+        PostgreSQLDropIndexStatement sqlStatement = new PostgreSQLDropIndexStatement();
+        sqlStatement.getIndexes().add(new IndexSegment(0, 0, new IdentifierValue("t_config_index")));
+        sqlStatement.getIndexes().add(new IndexSegment(0, 0, new IdentifierValue("t_config_index_new")));
+        TableMetaData tableMetaData = mock(TableMetaData.class);
+        Map<String, IndexMetaData> indexes = mock(HashMap.class);
+        when(tableMetaData.getIndexes()).thenReturn(indexes);
+        when(schema.getAllTableNames()).thenReturn(Collections.singletonList("t_config"));
+        when(schema.get("t_config")).thenReturn(tableMetaData);
+        when(indexes.containsKey("t_config_index")).thenReturn(true);
+        when(shardingRule.isBroadcastTable("t_config")).thenReturn(true);
+        when(shardingRule.getTableRule("t_config")).thenReturn(new TableRule(Arrays.asList("ds_0", "ds_1"), "t_config"));
+        Collection<RouteUnit> routeUnits = new LinkedList<>();
+        routeUnits.add(new RouteUnit(new RouteMapper("ds_0", "ds_0"), Collections.singletonList(new RouteMapper("t_config", "t_config"))));
+        routeUnits.add(new RouteUnit(new RouteMapper("ds_1", "ds_1"), Collections.singletonList(new RouteMapper("t_config", "t_config"))));
+        when(routeContext.getRouteUnits()).thenReturn(routeUnits);
+        new ShardingDropIndexStatementValidator().postValidate(shardingRule, new DropIndexStatementContext(sqlStatement), routeContext, schema);
+    }
+    
+    @Test(expected = ShardingSphereException.class)
+    public void assertPostValidateDropIndexWithDifferentRouteResultBroadcastTableIndexForPostgreSQL() {
+        PostgreSQLDropIndexStatement sqlStatement = new PostgreSQLDropIndexStatement();
+        sqlStatement.getIndexes().add(new IndexSegment(0, 0, new IdentifierValue("t_config_index")));
+        sqlStatement.getIndexes().add(new IndexSegment(0, 0, new IdentifierValue("t_config_index_new")));
+        TableMetaData tableMetaData = mock(TableMetaData.class);
+        Map<String, IndexMetaData> indexes = mock(HashMap.class);
+        when(tableMetaData.getIndexes()).thenReturn(indexes);
+        when(schema.getAllTableNames()).thenReturn(Collections.singletonList("t_config"));
+        when(schema.get("t_config")).thenReturn(tableMetaData);
+        when(indexes.containsKey("t_config_index")).thenReturn(true);
+        when(shardingRule.isBroadcastTable("t_config")).thenReturn(true);
+        when(shardingRule.getTableRule("t_config")).thenReturn(new TableRule(Arrays.asList("ds_0", "ds_1"), "t_config"));
+        Collection<RouteUnit> routeUnits = new LinkedList<>();
+        routeUnits.add(new RouteUnit(new RouteMapper("ds_0", "ds_0"), Collections.singletonList(new RouteMapper("t_config", "t_config"))));
+        when(routeContext.getRouteUnits()).thenReturn(routeUnits);
+        new ShardingDropIndexStatementValidator().postValidate(shardingRule, new DropIndexStatementContext(sqlStatement), routeContext, schema);
+    }
+    
+    @Test
+    public void assertPostValidateDropIndexWithSameRouteResultSingleTableIndexForPostgreSQL() {
+        PostgreSQLDropIndexStatement sqlStatement = new PostgreSQLDropIndexStatement();
+        sqlStatement.getIndexes().add(new IndexSegment(0, 0, new IdentifierValue("t_single_index")));
+        sqlStatement.getIndexes().add(new IndexSegment(0, 0, new IdentifierValue("t_single_index_new")));
+        TableMetaData tableMetaData = mock(TableMetaData.class);
+        Map<String, IndexMetaData> indexes = mock(HashMap.class);
+        when(tableMetaData.getIndexes()).thenReturn(indexes);
+        when(schema.getAllTableNames()).thenReturn(Collections.singletonList("t_single"));
+        when(schema.get("t_single")).thenReturn(tableMetaData);
+        when(indexes.containsKey("t_single_index")).thenReturn(true);
+        Collection<RouteUnit> routeUnits = new LinkedList<>();
+        routeUnits.add(new RouteUnit(new RouteMapper("ds_0", "ds_0"), Collections.singletonList(new RouteMapper("t_single", "t_single"))));
+        when(routeContext.getRouteUnits()).thenReturn(routeUnits);
+        new ShardingDropIndexStatementValidator().postValidate(shardingRule, new DropIndexStatementContext(sqlStatement), routeContext, schema);
+    }
+    
+    @Test(expected = ShardingSphereException.class)
+    public void assertPostValidateDropIndexWithDifferentRouteResultSingleTableIndexForPostgreSQL() {
+        PostgreSQLDropIndexStatement sqlStatement = new PostgreSQLDropIndexStatement();
+        sqlStatement.getIndexes().add(new IndexSegment(0, 0, new IdentifierValue("t_single_index")));
+        sqlStatement.getIndexes().add(new IndexSegment(0, 0, new IdentifierValue("t_single_index_new")));
+        TableMetaData tableMetaData = mock(TableMetaData.class);
+        Map<String, IndexMetaData> indexes = mock(HashMap.class);
+        when(tableMetaData.getIndexes()).thenReturn(indexes);
+        when(schema.getAllTableNames()).thenReturn(Collections.singletonList("t_single"));
+        when(schema.get("t_single")).thenReturn(tableMetaData);
+        when(indexes.containsKey("t_single_index")).thenReturn(true);
+        Collection<RouteUnit> routeUnits = new LinkedList<>();
+        routeUnits.add(new RouteUnit(new RouteMapper("ds_0", "ds_0"), Collections.singletonList(new RouteMapper("t_single", "t_single"))));
+        routeUnits.add(new RouteUnit(new RouteMapper("ds_1", "ds_1"), Collections.singletonList(new RouteMapper("t_single", "t_single"))));
+        when(routeContext.getRouteUnits()).thenReturn(routeUnits);
+        new ShardingDropIndexStatementValidator().postValidate(shardingRule, new DropIndexStatementContext(sqlStatement), routeContext, schema);
+    }
+}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingDropTableStatementValidatorTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingDropTableStatementValidatorTest.java
index 063aedf..3a83f38 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingDropTableStatementValidatorTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingDropTableStatementValidatorTest.java
@@ -19,6 +19,7 @@ package org.apache.shardingsphere.sharding.route.engine.validator.ddl;
 
 import org.apache.shardingsphere.infra.binder.statement.CommonSQLStatementContext;
 import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
+import org.apache.shardingsphere.infra.binder.statement.ddl.DropTableStatementContext;
 import org.apache.shardingsphere.infra.datanode.DataNode;
 import org.apache.shardingsphere.infra.exception.ShardingSphereException;
 import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
@@ -83,7 +84,7 @@ public final class ShardingDropTableStatementValidatorTest {
         routeUnits.add(routeUnit);
         RouteContext routeContext = mock(RouteContext.class);
         when(routeContext.getRouteUnits()).thenReturn(routeUnits);
-        validator.postValidate(shardingRule, sqlStatement, routeContext);
+        validator.postValidate(shardingRule, new DropTableStatementContext(sqlStatement), routeContext, schema);
     }
     
     private TableRule generateShardingRule(final String tableName) {
@@ -115,7 +116,7 @@ public final class ShardingDropTableStatementValidatorTest {
         routeUnits.add(new RouteUnit(new RouteMapper("ds_0", "ds_0"), Collections.singletonList(new RouteMapper("t_order", "t_order_0"))));
         routeUnits.add(new RouteUnit(new RouteMapper("ds_1", "ds_1"), Collections.singletonList(new RouteMapper("t_order", "t_order_0"))));
         when(routeContext.getRouteUnits()).thenReturn(routeUnits);
-        new ShardingDropTableStatementValidator().postValidate(shardingRule, sqlStatement, routeContext);
+        new ShardingDropTableStatementValidator().postValidate(shardingRule, new DropTableStatementContext(sqlStatement), routeContext, mock(ShardingSphereSchema.class));
     }
     
     @Test(expected = ShardingSphereException.class)
@@ -127,7 +128,7 @@ public final class ShardingDropTableStatementValidatorTest {
         Collection<RouteUnit> routeUnits = new LinkedList<>();
         routeUnits.add(new RouteUnit(new RouteMapper("ds_0", "ds_0"), Collections.singletonList(new RouteMapper("t_order", "t_order_0"))));
         when(routeContext.getRouteUnits()).thenReturn(routeUnits);
-        new ShardingDropTableStatementValidator().postValidate(shardingRule, sqlStatement, routeContext);
+        new ShardingDropTableStatementValidator().postValidate(shardingRule, new DropTableStatementContext(sqlStatement), routeContext, mock(ShardingSphereSchema.class));
     }
     
     @Test
@@ -140,7 +141,7 @@ public final class ShardingDropTableStatementValidatorTest {
         routeUnits.add(new RouteUnit(new RouteMapper("ds_0", "ds_0"), Collections.singletonList(new RouteMapper("t_config", "t_config"))));
         routeUnits.add(new RouteUnit(new RouteMapper("ds_1", "ds_1"), Collections.singletonList(new RouteMapper("t_config", "t_config"))));
         when(routeContext.getRouteUnits()).thenReturn(routeUnits);
-        new ShardingDropTableStatementValidator().postValidate(shardingRule, sqlStatement, routeContext);
+        new ShardingDropTableStatementValidator().postValidate(shardingRule, new DropTableStatementContext(sqlStatement), routeContext, mock(ShardingSphereSchema.class));
     }
     
     @Test(expected = ShardingSphereException.class)
@@ -152,7 +153,7 @@ public final class ShardingDropTableStatementValidatorTest {
         Collection<RouteUnit> routeUnits = new LinkedList<>();
         routeUnits.add(new RouteUnit(new RouteMapper("ds_0", "ds_0"), Collections.singletonList(new RouteMapper("t_config", "t_config"))));
         when(routeContext.getRouteUnits()).thenReturn(routeUnits);
-        new ShardingDropTableStatementValidator().postValidate(shardingRule, sqlStatement, routeContext);
+        new ShardingDropTableStatementValidator().postValidate(shardingRule, new DropTableStatementContext(sqlStatement), routeContext, mock(ShardingSphereSchema.class));
     }
     
     @Test
@@ -162,7 +163,7 @@ public final class ShardingDropTableStatementValidatorTest {
         Collection<RouteUnit> routeUnits = new LinkedList<>();
         routeUnits.add(new RouteUnit(new RouteMapper("ds_0", "ds_0"), Collections.singletonList(new RouteMapper("t_single", "t_single"))));
         when(routeContext.getRouteUnits()).thenReturn(routeUnits);
-        new ShardingDropTableStatementValidator().postValidate(shardingRule, sqlStatement, routeContext);
+        new ShardingDropTableStatementValidator().postValidate(shardingRule, new DropTableStatementContext(sqlStatement), routeContext, mock(ShardingSphereSchema.class));
     }
     
     @Test(expected = ShardingSphereException.class)
@@ -173,6 +174,6 @@ public final class ShardingDropTableStatementValidatorTest {
         routeUnits.add(new RouteUnit(new RouteMapper("ds_0", "ds_0"), Collections.singletonList(new RouteMapper("t_single", "t_single"))));
         routeUnits.add(new RouteUnit(new RouteMapper("ds_1", "ds_1"), Collections.singletonList(new RouteMapper("t_single", "t_single"))));
         when(routeContext.getRouteUnits()).thenReturn(routeUnits);
-        new ShardingDropTableStatementValidator().postValidate(shardingRule, sqlStatement, routeContext);
+        new ShardingDropTableStatementValidator().postValidate(shardingRule, new DropTableStatementContext(sqlStatement), routeContext, mock(ShardingSphereSchema.class));
     }
 }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingPrepareStatementValidatorTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingPrepareStatementValidatorTest.java
index 93fba9a..8379b3c 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingPrepareStatementValidatorTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingPrepareStatementValidatorTest.java
@@ -89,16 +89,17 @@ public final class ShardingPrepareStatementValidatorTest {
     public void assertPostValidatePrepareWithEmptyRouteResultForPostgreSQL() {
         PostgreSQLPrepareStatement sqlStatement = new PostgreSQLPrepareStatement();
         when(routeContext.getRouteUnits()).thenReturn(Collections.emptyList());
-        new ShardingPrepareStatementValidator().postValidate(shardingRule, sqlStatement, routeContext);
+        new ShardingPrepareStatementValidator().postValidate(shardingRule, new PrepareStatementContext(sqlStatement), routeContext, schema);
     }
     
     @Test
     public void assertPostValidatePrepareWithDifferentDataSourceForPostgreSQL() {
+        PostgreSQLPrepareStatement sqlStatement = new PostgreSQLPrepareStatement();
         Collection<RouteUnit> routeUnits = new LinkedList<>();
         routeUnits.add(new RouteUnit(new RouteMapper("ds_0", "ds_0"),
                 Arrays.asList(new RouteMapper("t_order", "t_order_0"), new RouteMapper("t_order_item", "t_order_item_0"))));
         when(routeContext.getRouteUnits()).thenReturn(routeUnits);
-        new ShardingPrepareStatementValidator().postValidate(shardingRule, new PostgreSQLPrepareStatement(), routeContext);
+        new ShardingPrepareStatementValidator().postValidate(shardingRule, new PrepareStatementContext(sqlStatement), routeContext, schema);
     }
     
     @Test(expected = ShardingSphereException.class)
@@ -109,6 +110,7 @@ public final class ShardingPrepareStatementValidatorTest {
         routeUnits.add(new RouteUnit(new RouteMapper("ds_0", "ds_0"),
                 Arrays.asList(new RouteMapper("t_order", "t_order_0"), new RouteMapper("t_order_item", "t_order_item_1"))));
         when(routeContext.getRouteUnits()).thenReturn(routeUnits);
-        new ShardingPrepareStatementValidator().postValidate(shardingRule, new PostgreSQLPrepareStatement(), routeContext);
+        PostgreSQLPrepareStatement sqlStatement = new PostgreSQLPrepareStatement();
+        new ShardingPrepareStatementValidator().postValidate(shardingRule, new PrepareStatementContext(sqlStatement), routeContext, schema);
     }
 }