ishnagy commented on code in PR #6146:
URL: https://github.com/apache/hive/pull/6146#discussion_r2484773797
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionState.java:
##########
@@ -852,15 +855,27 @@ private String getKey(final FileStatus fileStatus) {
return fileStatus.getPath() + ":" + fileStatus.getLen() + ":" +
fileStatus.getModificationTime();
}
+ private void addJarLRByPath(String jarPath, final Map<String, LocalResource>
lrMap) throws IOException {
+ final File jar = new File(jarPath);
+ final String localJarPath = jar.toURI().toURL().toExternalForm();
+ final LocalResource jarLr = createJarLocalResource(localJarPath);
+ lrMap.put(DagUtils.getBaseName(jarLr), jarLr);
+ }
+
private void addJarLRByClass(Class<?> clazz, final Map<String,
LocalResource> lrMap) throws IOException {
String jarPath = Utilities.jarFinderGetJar(clazz);
if (jarPath == null) {
throw new IOException("Can't find jar for: " + clazz);
}
- final File jar = new File(jarPath);
- final String localJarPath = jar.toURI().toURL().toExternalForm();
- final LocalResource jarLr = createJarLocalResource(localJarPath);
- lrMap.put(DagUtils.getBaseName(jarLr), jarLr);
+ addJarLRByPath(jarPath, lrMap);
+ }
+
+ private void addJarLRByClassName(ClassLoader loader, String className, final
Map<String, LocalResource> lrMap) throws IOException {
+ String jarPath = Utilities.jarFinderGetJar(loader, className);
Review Comment:
Technically, we can use `Utilities.getSessionSpecifiedClassLoader()` as
well, of course. But the whole intention was not having to do the actual
classload (Class::forName), if we only want to look up a jar resource by
className in the classloader.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]