15 package com.cloudera.impala.analysis;
17 import org.apache.hadoop.hive.metastore.api.FieldSchema;
22 import com.cloudera.impala.thrift.TAlterTableChangeColParams;
23 import com.cloudera.impala.thrift.TAlterTableParams;
24 import com.cloudera.impala.thrift.TAlterTableType;
25 import com.google.common.base.Preconditions;
39 Preconditions.checkNotNull(newColDef);
40 Preconditions.checkState(colName != null && !colName.isEmpty());
50 TAlterTableParams params = super.toThrift();
51 params.setAlter_type(TAlterTableType.CHANGE_COLUMN);
52 TAlterTableChangeColParams colParams =
new TAlterTableChangeColParams();
54 colParams.setNew_col_def(newColDef_.toThrift());
55 params.setChange_col_params(colParams);
61 super.analyze(analyzer);
66 throw new AnalysisException(
"ALTER TABLE CHANGE COLUMN not currently supported " +
72 for (FieldSchema fs: t.getMetaStoreTable().getPartitionKeys()) {
73 if (fs.getName().toLowerCase().equals(
colName_.toLowerCase())) {
78 "Column name conflicts with existing partition column: " +
86 "Column '%s' does not exist in table: %s",
colName_, tableName));
93 if (!
colName_.toLowerCase().equals(newColDef_.getColName().toLowerCase()) &&
TAlterTableParams toThrift()
void analyze(Analyzer analyzer)
AlterTableChangeColStmt(TableName tableName, String colName, ColumnDef newColDef)
final ColumnDef newColDef_