private void getCredentialsForFileSinks(BaseWork baseWork, Set<URI> fileSinkUris, DAG dag) {
    if (LOG.isDebugEnabled()) {
      for (URI fileSinkUri : fileSinkUris) {
        LOG.debug("Marking {} output URI as needing credentials (filesink): {}",
            baseWork.getClass(), fileSinkUri);
      }
    }
    dag.addURIsForCredentials(fileSinkUris);
  }
Set up credentials for the base work on secure clusters
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DagUtils.java