public EnqueueBean enqueueJob(String user, Map<String, Object> userArgs, String callback,
                     List<String> args, TempletonControllerJob controllerJob)
    throws NotAuthorizedException, BusyException,
    IOException, QueueException {
    UserGroupInformation ugi = null;
    try {
      ugi = UgiFactory.getUgi(user);

      final long startTime = System.nanoTime();

      String id = queueAsUser(ugi, args, controllerJob);

      long elapsed = ((System.nanoTime() - startTime) / ((int) 1e6));
      LOG.debug("queued job " + id + " in " + elapsed + " ms");

      if (id == null) {
        throw new QueueException("Unable to get job id");
      }
      
      registerJob(id, user, callback, userArgs);

      return new EnqueueBean(id);
    } catch (InterruptedException e) {
      throw new QueueException("Unable to launch job " + e);
    } finally {
      if (ugi != null) {
        FileSystem.closeAllForUGI(ugi);
      }
    }
  }
Enqueue the TempletonControllerJob directly calling doAs.
hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/LauncherDelegator.java