@Override
  public void analyzeInternal(ASTNode root) throws SemanticException {
    ctx.setResFile(ctx.getLocalTmpPath());

    Entry<String, String> tableIdentifier = getDbTableNamePair((ASTNode) root.getChild(0));
    if (tableIdentifier.getValue().contains(".")) {
      throw new SemanticException("The SHOW CREATE TABLE command is not supported for metadata tables.");
    }
    Table table = getTable(tableIdentifier.getKey(), tableIdentifier.getValue(), true);

    inputs.add(new ReadEntity(table));

    // If no DB was specified in statement, do not include it in the final output
    ShowCreateTableDesc desc = new ShowCreateTableDesc(table.getDbName(), table.getTableName(),
        ctx.getResFile().toString(), StringUtils.isBlank(tableIdentifier.getKey()));
    Task<DDLWork> task = TaskFactory.get(new DDLWork(getInputs(), getOutputs(), desc));
    rootTasks.add(task);

    task.setFetchSource(true);
    setFetchTask(createFetchTask(ShowCreateTableDesc.SCHEMA));
  }
Analyzer for showing table creation commands.
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/create/show/ShowCreateTableAnalyzer.java