@Override
  protected void analyzeCommand(TableName tableName, Map<String, String> partitionSpec, ASTNode command)
      throws SemanticException {
    TableName target = getQualifiedTableName((ASTNode) command.getChild(0));

    AlterTableRenameDesc desc = new AlterTableRenameDesc(tableName, null, isView(), target.getNotEmptyDbTable());
    Table table = getTable(tableName.getNotEmptyDbTable(), true);
    if (AcidUtils.isTransactionalTable(table)) {
      setAcidDdlDesc(desc);
    }
    addInputsOutputsAlterTable(tableName, null, desc, desc.getType(), false);
    String newDatabaseName = target.getDb() != null ? target.getDb() : table.getDbName(); // extract new database name from new table name, if not specified, then src dbname is used
    DDLUtils.addDbAndTableToOutputs(getDatabase(newDatabaseName), target,
            table.getTableType(), table.isTemporary(), table.getParameters(), outputs);
    rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), desc)));
  }
Analyzer for rename table like entities commands.
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/misc/rename/AbstractAlterTableRenameAnalyzer.java