/**
 * Copyright (C) 2011 Akiban Technologies Inc.
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License, version 3,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see http://www.gnu.org/licenses.
 */
package com.akiban.sql.aisddl;

import com.akiban.ais.model.TableName;
import com.akiban.server.api.DDLFunctions;
import com.akiban.server.error.NoSuchTableException;
import com.akiban.server.error.UnsupportedSQLException;
import com.akiban.server.service.session.Session;
import com.akiban.sql.parser.AlterTableNode;

import java.util.Collection;
import java.util.Collections;

public class AlterTableDDL {
    private AlterTableDDL() {}
    
    public static void alterTable(DDLFunctions ddlFunctions,
                                  Session session, 
                                  String defaultSchemaName,
                                  AlterTableNode alterTable) {

        com.akiban.sql.parser.TableName sqlName = alterTable.getObjectName();
        String schemaName = sqlName.hasSchema() ? sqlName.getSchemaName() : defaultSchemaName;
        TableName tableName = TableName.create(schemaName, sqlName.getTableName());
        if (ddlFunctions.getAIS(session).getUserTable(tableName) == null) {
            throw new NoSuchTableException(tableName.getSchemaName(), 
                                           tableName.getTableName());
        }

        if (alterTable.isUpdateStatistics()) {
            analyze(ddlFunctions, tableName,
                    alterTable.isUpdateStatisticsAll() ? null : 
                    Collections.singletonList(alterTable.getIndexNameForUpdateStatistics()));
            return;
        }
        throw new UnsupportedSQLException (alterTable.statementToString(), alterTable);
    }

    protected static void analyze(DDLFunctions ddlFunctions, 
                                  TableName tableName, Collection<String> indexNames) {
        
    }
}

@@ -1878,45 +1878,43 @@
     
-analyze(ddlFunctions, tableName,%0A    
+Collection%3CString%3E indexes = null;%0A
     
@@ -1921,20 +1921,21 @@
         
-    
+if (!
 alterTab
@@ -1964,18 +1964,9 @@
 ll()
- ? null : 
+)
 %0A   
@@ -1970,35 +1970,41 @@
                 
-   
+indexes =
  Collections.sin
@@ -2059,16 +2059,92 @@
 stics())
+;%0A            ddlFunctions.updateTableStatistics(session, tableName, indexes
 );%0A     
@@ -2265,173 +2265,7 @@
    %7D
-%0A%0A    protected static void analyze(DDLFunctions ddlFunctions, %0A                                  TableName tableName, Collection%3CString%3E indexNames) %7B%0A        %0A    %7D
 %0A%7D%0A

Simplify call.