@VisibleForTesting
  LocalResource createJarLocalResource(String localJarPath)
      throws IOException, LoginException, IllegalArgumentException {
    // TODO Reduce the number of lookups that happen here. This shouldn't go to HDFS for each call.
    // The hiveJarDir can be determined once per client.
    FileStatus destDirStatus = utils.getHiveJarDirectory(conf);
    assert destDirStatus != null;
    Path destDirPath = destDirStatus.getPath();

    Path localFile = FileUtils.resolveSymlinks(new Path(localJarPath), conf);
    String sha = getSha(localFile);

    String destFileName = localFile.getName();

    // Now, try to find the file based on SHA and name. Currently we require exact name match.
    // We could also allow cutting off versions and other stuff provided that SHA matches...
    destFileName = FilenameUtils.removeExtension(destFileName) + "-" + sha
        + FilenameUtils.EXTENSION_SEPARATOR + FilenameUtils.getExtension(destFileName);

    LOG.debug("The destination file name for [{}] is {}", localJarPath, destFileName);

    // TODO: if this method is ever called on more than one jar, getting the dir and the
    //       list need to be refactored out to be done only once.
    Path destFile = new Path(destDirPath.toString() + "/" + destFileName);
    return utils.localizeResource(localFile, destFile, LocalResourceType.FILE, conf);
  }
Returns a local resource representing a jar.
This resource will be used to execute the plan on the cluster.
@param localJarPath Local path to the jar to be localized.
@return LocalResource corresponding to the localized hive exec resource.
@throws IOException when any file system related call fails.
@throws LoginException when we are unable to determine the user.
@throws URISyntaxException when current jar location cannot be determined.
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionState.java