@Override
  public void analyzeInternal(ASTNode root) throws SemanticException {
    if (root.getChildCount() > 3 || root.getChildCount() < 1) {
      throw new SemanticException(ErrorMsg.INVALID_AST_TREE.getMsg());
    }

    ctx.setResFile(ctx.getLocalTmpPath());

    String tableNames = getUnescapedName((ASTNode) root.getChild(0));
    String dbName = SessionState.get().getCurrentDatabase();
    Map<String, String> partitionSpec = null;
    if (root.getChildCount() > 1) {
      for (int i = 1; i < root.getChildCount(); i++) {
        ASTNode child = (ASTNode) root.getChild(i);
        if (child.getToken().getType() == HiveParser.Identifier) {
          dbName = unescapeIdentifier(child.getText());
        } else if (child.getToken().getType() == HiveParser.TOK_PARTSPEC) {
          partitionSpec = getValidatedPartSpec(getTable(tableNames), child, conf, false);
        } else {
          throw new SemanticException(ErrorMsg.INVALID_AST_TREE.getMsg(
              child.toStringTree() + " , Invalid token " + child.getToken().getType()));
        }
      }
    }

    if (partitionSpec != null) {
      // validate that partition exists
      PartitionUtils.getPartition(db, getTable(HiveTableName.of(tableNames)), partitionSpec, true);
    }

    ShowTableStatusDesc desc = new ShowTableStatusDesc(ctx.getResFile(), dbName, tableNames, partitionSpec);
    Task<DDLWork> task = TaskFactory.get(new DDLWork(getInputs(), getOutputs(), desc));
    rootTasks.add(task);

    task.setFetchSource(true);
    setFetchTask(createFetchTask(ShowTableStatusDesc.SCHEMA));
  }
Analyzer for show table status commands.
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/info/show/status/ShowTableStatusAnalyzer.java