@Override
  public int execute() {
    try {
      LOG.info("Importing Ranger Metadata");
      RangerExportPolicyList rangerExportPolicyList = null;
      List<RangerPolicy> rangerPolicies = null;
      SecurityUtils.reloginExpiringKeytabUser();
      if (rangerRestClient == null) {
        rangerRestClient = getRangerRestClient();
      }
      URL url = work.getRangerConfigResource();
      if (url == null) {
        throw new SemanticException(ErrorMsg.REPL_INVALID_CONFIG_FOR_SERVICE
          .format("Ranger configuration is not valid "
            + ReplUtils.RANGER_CONFIGURATION_RESOURCE_NAME, ReplUtils.REPL_RANGER_SERVICE));
      }
      conf.addResource(url);
      String rangerHiveServiceName = conf.get(ReplUtils.RANGER_HIVE_SERVICE_NAME);
      String rangerEndpoint = conf.get(ReplUtils.RANGER_REST_URL);
      if (StringUtils.isEmpty(rangerEndpoint)) {
        throw new SemanticException(ErrorMsg.REPL_INVALID_CONFIG_FOR_SERVICE
          .format("Ranger endpoint is not valid "
            + rangerEndpoint, ReplUtils.REPL_RANGER_SERVICE));
      }
      if (!rangerRestClient.checkConnection(rangerEndpoint, conf)) {
        throw new SemanticException(ErrorMsg.REPL_EXTERNAL_SERVICE_CONNECTION_ERROR.format(ReplUtils
            .REPL_RANGER_SERVICE,
          "Ranger endpoint is not valid " + rangerEndpoint));
      }
      if (work.getCurrentDumpPath() != null) {
        LOG.info("Importing Ranger Metadata from {} ", work.getCurrentDumpPath());
        rangerExportPolicyList = rangerRestClient.readRangerPoliciesFromJsonFile(new Path(work.getCurrentDumpPath(),
                ReplUtils.HIVE_RANGER_POLICIES_FILE_NAME), conf);
        int expectedPolicyCount = rangerExportPolicyList == null ? 0 : rangerExportPolicyList.getListSize();
        replLogger = new RangerLoadLogger(work.getSourceDbName(), work.getTargetDbName(),
          work.getCurrentDumpPath().toString(), expectedPolicyCount);
        replLogger.startLog();
        Map<String, Long> metricMap = new HashMap<>();
        metricMap.put(ReplUtils.MetricName.POLICIES.name(), (long) expectedPolicyCount);
        work.getMetricCollector().reportStageStart(getName(), metricMap);
        if (rangerExportPolicyList != null && !CollectionUtils.isEmpty(rangerExportPolicyList.getPolicies())) {
          rangerPolicies = rangerExportPolicyList.getPolicies();
        }
      }

      if (CollectionUtils.isEmpty(rangerPolicies)) {
        LOG.info("There are no ranger policies to import");
        rangerPolicies = new ArrayList<>();
      }

      List<RangerPolicy> updatedRangerPolicies = rangerRestClient.changeDataSet(rangerPolicies,
          work.getSourceDbName(), work.getTargetDbName());

      long importCount = 0;
      if (!CollectionUtils.isEmpty(updatedRangerPolicies)) {
        if (rangerExportPolicyList == null) {
          rangerExportPolicyList = new RangerExportPolicyList();
        }
        rangerExportPolicyList.setPolicies(updatedRangerPolicies);
        rangerRestClient.importRangerPolicies(rangerExportPolicyList, work.getTargetDbName(), rangerEndpoint,
                rangerHiveServiceName, conf);
        LOG.info("Number of ranger policies imported {}", rangerExportPolicyList.getListSize());
        importCount = rangerExportPolicyList.getListSize();
        work.getMetricCollector().reportStageProgress(getName(), ReplUtils.MetricName.POLICIES.name(), importCount);
        replLogger.endLog(importCount);
        LOG.info("Ranger policy import finished {} ", importCount);
      }
      work.getMetricCollector().reportStageEnd(getName(), Status.SUCCESS);
      return 0;
    } catch (RuntimeException e) {
      LOG.error("Runtime Excepton during RangerLoad", e);
      setException(e);
      try{
        ReplUtils.handleException(true, e, work.getCurrentDumpPath().getParent().toString(), work.getMetricCollector(),
                getName(), conf);
      } catch (Exception ex){
        LOG.error("Failed to collect replication metrics: ", ex);
      }
      throw e;
    } catch (Exception e) {
      LOG.error("RangerLoad Failed", e);
      int errorCode = ErrorMsg.getErrorMsg(e.getMessage()).getErrorCode();
      setException(e);
      try{
        return ReplUtils.handleException(true, e, work.getCurrentDumpPath().getParent().toString(), work.getMetricCollector(),
                getName(), conf);
      } catch (Exception ex){
        LOG.error("Failed to collect replication metrics: ", ex);
        return errorCode;
      }
    }
  }
RangerLoadTask.

Rask to import Ranger authorization policies.
ql/src/java/org/apache/hadoop/hive/ql/exec/repl/RangerLoadTask.java