MCPcopy Create free account
hub / github.com/apache/pig / createPigScriptUDFJar

Method createPigScriptUDFJar

src/org/apache/pig/impl/util/JarManager.java:81–105  ·  view source on GitHub ↗
(PigContext pigContext)

Source from the content-addressed store, hash-verified

79 }
80
81 public static File createPigScriptUDFJar(PigContext pigContext) throws IOException {
82 File scriptUDFJarFile = File.createTempFile("PigScriptUDF", ".jar");
83 // ensure the scriptUDFJarFile is deleted on exit
84 scriptUDFJarFile.deleteOnExit();
85 FileOutputStream fos = new FileOutputStream(scriptUDFJarFile);
86 HashMap<String, String> contents = new HashMap<String, String>();
87 createPigScriptUDFJar(fos, pigContext, contents);
88
89 if (!contents.isEmpty()) {
90 FileInputStream fis = null;
91 String md5 = null;
92 try {
93 fis = new FileInputStream(scriptUDFJarFile);
94 md5 = org.apache.commons.codec.digest.DigestUtils.md5Hex(fis);
95 } finally {
96 if (fis != null) {
97 fis.close();
98 }
99 }
100 File newScriptUDFJarFile = new File(scriptUDFJarFile.getParent(), "PigScriptUDF-" + md5 + ".jar");
101 scriptUDFJarFile.renameTo(newScriptUDFJarFile);
102 return newScriptUDFJarFile;
103 }
104 return null;
105 }
106
107 private static void createPigScriptUDFJar(OutputStream os, PigContext pigContext, HashMap<String, String> contents) throws IOException {
108 JarOutputStream jarOutputStream = new JarOutputStream(os);

Callers 3

addJarsToSparkJobMethod · 0.95
getJobMethod · 0.95
getLocalResourcesMethod · 0.95

Calls 12

getClassLoaderMethod · 0.95
addStreamMethod · 0.95
debugMethod · 0.80
entrySetMethod · 0.80
getScriptFilesMethod · 0.80
closeMethod · 0.65
existsMethod · 0.65
getValueMethod · 0.65
createTempFileMethod · 0.45
isEmptyMethod · 0.45
getKeyMethod · 0.45
getPathMethod · 0.45

Tested by

no test coverage detected