presto-main/src/main/java/io/prestosql/execution/SetPathTask.java/SetPathTask/execute
class SetPathTask:    @Override
    public ListenableFuture<?> execute(
            SetPath statement,
            TransactionManager transactionManager,
            Metadata metadata,
            AccessControl accessControl,
            QueryStateMachine stateMachine,
            List<Expression> parameters)
    {
        Session session = stateMachine.getSession();

        if (!session.getClientCapabilities().contains(ClientCapabilities.PATH.toString())) {
            throw new PrestoException(NOT_SUPPORTED, "SET PATH not supported by client");
        }

        // convert to IR before setting HTTP headers - ensures that the representations of all path objects outside the parser remain consistent
        SqlPath sqlPath = new SqlPath(Optional.of(statement.getPathSpecification().toString()));

        for (SqlPathElement element : sqlPath.getParsedPath()) {
            if (!element.getCatalog().isPresent() && !session.getCatalog().isPresent()) {
                throw semanticException(MISSING_CATALOG_NAME, statement, "Catalog must be specified for each path element when session catalog is not set");
            }

            element.getCatalog().ifPresent(catalog -> {
                String catalogName = catalog.getValue().toLowerCase(ENGLISH);
                if (!metadata.getCatalogHandle(session, catalogName).isPresent()) {
                    throw new PrestoException(NOT_FOUND, "Catalog does not exist: " + catalogName);
                }
            });
        }
        stateMachine.setSetPath(sqlPath.toString());
        return immediateFuture(null);
    }