15 package com.cloudera.impala.analysis;
17 import org.apache.hadoop.hive.metastore.api.FieldSchema;
22 import com.cloudera.impala.thrift.TAlterTableDropColParams;
23 import com.cloudera.impala.thrift.TAlterTableParams;
24 import com.cloudera.impala.thrift.TAlterTableType;
25 import com.google.common.base.Preconditions;
37 Preconditions.checkState(colName != null && !colName.isEmpty());
45 TAlterTableParams params = super.toThrift();
46 params.setAlter_type(TAlterTableType.DROP_COLUMN);
47 TAlterTableDropColParams dropColParams =
new TAlterTableDropColParams(
colName_);
48 params.setDrop_col_params(dropColParams);
54 super.analyze(analyzer);
64 for (FieldSchema fs: t.getMetaStoreTable().getPartitionKeys()) {
65 if (fs.getName().toLowerCase().equals(
colName_.toLowerCase())) {
70 if (t.getColumns().size() - t.getMetaStoreTable().getPartitionKeysSize() <= 1) {
72 "Cannot drop column '%s' from %s. Tables must contain at least 1 column.",
78 "Column '%s' does not exist in table: %s",
colName_, tableName));
TAlterTableParams toThrift()
AlterTableDropColStmt(TableName tableName, String colName)
void analyze(Analyzer analyzer)