use of org.apache.hadoop.hive.ql.plan.ColumnStatsUpdateWork in project hive by apache.
the class DDLSemanticAnalyzer method analyzeAlterTableUpdateStats.
private void analyzeAlterTableUpdateStats(ASTNode ast, String tblName, Map<String, String> partSpec) throws SemanticException {
String colName = getUnescapedName((ASTNode) ast.getChild(0));
Map<String, String> mapProp = getProps((ASTNode) (ast.getChild(1)).getChild(0));
Table tbl = getTable(tblName);
String partName = null;
if (partSpec != null) {
try {
partName = Warehouse.makePartName(partSpec, false);
} catch (MetaException e) {
throw new SemanticException("partition " + partSpec.toString() + " not found");
}
}
String colType = null;
List<FieldSchema> cols = tbl.getCols();
for (FieldSchema col : cols) {
if (colName.equalsIgnoreCase(col.getName())) {
colType = col.getType();
break;
}
}
if (colType == null) {
throw new SemanticException("column type not found");
}
ColumnStatsUpdateWork columnStatsUpdateWork = new ColumnStatsUpdateWork(partName, mapProp, tbl.getDbName(), tbl.getTableName(), colName, colType);
ColumnStatsUpdateTask cStatsUpdateTask = (ColumnStatsUpdateTask) TaskFactory.get(columnStatsUpdateWork);
rootTasks.add(cStatsUpdateTask);
}
Aggregations