presto-main/src/main/java/io/prestosql/execution/RenameSchemaTask.java/RenameSchemaTask/execute
class RenameSchemaTask:    @Override
    public ListenableFuture<?> execute(RenameSchema statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine, List<Expression> parameters)
    {
        Session session = stateMachine.getSession();
        CatalogSchemaName source = createCatalogSchemaName(session, statement, Optional.of(statement.getSource()));
        CatalogSchemaName target = new CatalogSchemaName(source.getCatalogName(), statement.getTarget().getValue());

        if (!metadata.schemaExists(session, source)) {
            throw semanticException(SCHEMA_NOT_FOUND, statement, "Schema '%s' does not exist", source);
        }

        if (metadata.schemaExists(session, target)) {
            throw semanticException(SCHEMA_ALREADY_EXISTS, statement, "Target schema '%s' already exists", target);
        }

        accessControl.checkCanRenameSchema(session.toSecurityContext(), source, statement.getTarget().getValue());

        metadata.renameSchema(session, source, statement.getTarget().getValue());

        return immediateFuture(null);
    }