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

Method registerScript

test/org/apache/pig/pigunit/PigTest.java:182–200  ·  view source on GitHub ↗

Registers a pig scripts with its variables substituted. @throws IOException If a temp file containing the pig script could not be created. @throws ParseException The pig script could not have all its variables substituted.

()

Source from the content-addressed store, hash-verified

180 * @throws ParseException The pig script could not have all its variables substituted.
181 */
182 protected void registerScript() throws IOException, ParseException {
183 getCluster();
184
185 BufferedReader reader = new BufferedReader(new StringReader(this.originalTextPigScript));
186 PigContext context = getPigServer().getPigContext();
187
188 String substitutedPig = context.doParamSubstitution(reader,
189 args == null ? null : Arrays.asList(args),
190 argFiles == null ? null : Arrays.asList(argFiles));
191 LOG.info(substitutedPig);
192
193 File f = File.createTempFile("tmp", "pigunit");
194 PrintWriter pw = new PrintWriter(f);
195 pw.println(substitutedPig);
196 pw.close();
197
198 String pigSubstitutedFile = f.getCanonicalPath();
199 getPigServer().registerScript(pigSubstitutedFile, aliasOverrides);
200 }
201
202 /**
203 * Executes the Pig script with its current overrides.

Callers 13

runScriptMethod · 0.95
getAliasMethod · 0.95
getAliasToSchemaMapMethod · 0.95
assertOutputMethod · 0.95
test3Method · 0.45
test4Method · 0.45
test5Method · 0.45
testAutoParallelismMethod · 0.45

Calls 7

getClusterMethod · 0.95
getPigServerMethod · 0.95
doParamSubstitutionMethod · 0.95
infoMethod · 0.80
closeMethod · 0.65
getPigContextMethod · 0.45
createTempFileMethod · 0.45

Tested by

no test coverage detected