showTblsDesc), conf));
setFetchTask(createFetchTask(showTblsDesc.getSchema()));
}
private void analyzeShowColumns(ASTNode ast) throws SemanticException {
ShowColumnsDesc showColumnsDesc;
String dbName = null;
String tableName = null;
switch (ast.getChildCount()) {
case 1:
tableName = getUnescapedName((ASTNode) ast.getChild(0));
break;
case 2:
dbName = getUnescapedName((ASTNode) ast.getChild(0));
tableName = getUnescapedName((ASTNode) ast.getChild(1));
break;
default:
break;
}
try {
Table tab = null;
if (dbName == null) {
tab = db.getTable(tableName, true);
}
else {
tab = db.getTable(dbName, tableName, true);
}
inputs.add(new ReadEntity(tab));
} catch (HiveException e) {
throw new SemanticException(ErrorMsg.INVALID_TABLE.getMsg(tableName));
}
showColumnsDesc = new ShowColumnsDesc(ctx.getResFile(), dbName, tableName);
rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(),
showColumnsDesc), conf));
setFetchTask(createFetchTask(showColumnsDesc.getSchema()));
}