use of org.apache.hadoop.hive.ql.exec.ColumnStatsUpdateTask 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");
ColumnStatsDesc cStatsDesc = new ColumnStatsDesc(tbl.getDbName() + "." + tbl.getTableName(), Arrays.asList(colName), Arrays.asList(colType), partSpec == null);
ColumnStatsUpdateTask cStatsUpdateTask = (ColumnStatsUpdateTask) TaskFactory.get(new ColumnStatsUpdateWork(cStatsDesc, partName, mapProp), conf);
rootTasks.add(cStatsUpdateTask);
}
Aggregations