/*
 * 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.core.optimize.engine.sharding.ddl;

/**
 * DDL OptimizeEngine.
 *
 * @author panjuan
 */
public final class DDLOptimizeEngine {
}

@@ -866,16 +866,643 @@
 g.ddl;%0A%0A
+import com.google.common.base.Optional;%0Aimport lombok.RequiredArgsConstructor;%0Aimport org.apache.shardingsphere.core.metadata.ShardingMetaData;%0Aimport org.apache.shardingsphere.core.optimize.condition.ShardingCondition;%0Aimport org.apache.shardingsphere.core.optimize.condition.ShardingConditions;%0Aimport org.apache.shardingsphere.core.optimize.engine.OptimizeEngine;%0Aimport org.apache.shardingsphere.core.optimize.result.OptimizeResult;%0Aimport org.apache.shardingsphere.core.parse.sql.statement.ddl.DDLStatement;%0Aimport org.apache.shardingsphere.core.parse.sql.statement.ddl.DropIndexStatement;%0A%0Aimport java.util.Collections;%0A%0A
 /**%0A * D
@@ -1546,16 +1546,41 @@
 uan%0A */%0A
+@RequiredArgsConstructor%0A
 public f
@@ -1612,8 +1612,914 @@
 ine 
-%7B
+implements OptimizeEngine %7B%0A    %0A    private final DDLStatement ddlStatement;%0A    %0A    private final ShardingMetaData shardingMetaData;%0A    %0A    @Override%0A    public OptimizeResult optimize() %7B%0A        OptimizeResult result = new OptimizeResult(new ShardingConditions(Collections.%3CShardingCondition%3EemptyList()));%0A        if (isDropIndexWithoutTable()) %7B%0A            setLogicTableName(result);%0A        %7D%0A        return result;%0A    %7D%0A    %0A    private boolean isDropIndexWithoutTable() %7B%0A        return ddlStatement instanceof DropIndexStatement && ddlStatement.getTables().isEmpty();%0A    %7D%0A    %0A    private void setLogicTableName(final OptimizeResult result) %7B%0A        Optional%3CString%3E logicTableName = shardingMetaData.getTable().getLogicTableName(ddlStatement.getIndexName());%0A        if (logicTableName.isPresent()) %7B%0A            result.setLogicTableNameForDropIndex(logicTableName.get());%0A        %7D%0A    %7D
 %0A%7D%0A

add optimize()