use of org.apache.hadoop.hive.ql.ddl.DDLTask in project hive by apache.
the class TestHiveDecimalParse method getColumnType.
private String getColumnType(String query) {
Driver driver = createDriver();
int rc = driver.compile(query, true);
if (rc != 0) {
return null;
}
QueryPlan plan = driver.getPlan();
DDLTask task = (DDLTask) plan.getRootTasks().get(0);
DDLWork work = task.getWork();
CreateTableDesc spec = (CreateTableDesc) work.getDDLDesc();
FieldSchema fs = spec.getCols().get(0);
return fs.getType();
}
use of org.apache.hadoop.hive.ql.ddl.DDLTask in project hive by apache.
the class DummySemanticAnalyzerHook1 method postAnalyze.
@Override
public void postAnalyze(HiveSemanticAnalyzerHookContext context, List<Task<?>> rootTasks) throws SemanticException {
count = 0;
if (!isCreateTable) {
return;
}
CreateTableDesc desc = (CreateTableDesc) ((DDLTask) rootTasks.get(rootTasks.size() - 1)).getWork().getDDLDesc();
Map<String, String> tblProps = desc.getTblProps();
if (tblProps == null) {
tblProps = new HashMap<String, String>();
}
tblProps.put("createdBy", DummyCreateTableHook.class.getName());
tblProps.put("Message", "Hive rocks!! Count: " + myCount);
LogHelper console = SessionState.getConsole();
console.printError("DummySemanticAnalyzerHook1 Post: Hive rocks!! Count: " + myCount);
}
Aggregations