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

Method exec

src/org/apache/pig/scripting/BoundScript.java:264–288  ·  view source on GitHub ↗
(String query)

Source from the content-addressed store, hash-verified

262 //-------------------------------------------------------------------------
263
264 private PigStats exec(String query) throws IOException {
265 LOG.info("Query to run:\n" + query);
266 List<PigProgressNotificationListener> listeners = ScriptState.get().getAllListeners();
267 PigContext pc = scriptContext.getPigContext();
268 String scriptName = new File(ScriptState.get().getFileName()).getName();
269 ScriptState scriptState = pc.getExecutionEngine().instantiateScriptState();
270 scriptState.setFileName(scriptName);
271 ScriptState.start(scriptState);
272 ScriptState.get().setScript(query);
273 for (PigProgressNotificationListener listener : listeners) {
274 ScriptState.get().registerListener(listener);
275 }
276 PigServer pigServer = new PigServer(scriptContext.getPigContext(), false);
277 if (!pigServer.getPigContext().getProperties().containsKey("jobName")) {
278 pigServer.setJobName(scriptName);
279 }
280 GruntParser grunt = new GruntParser(new StringReader(query), pigServer);
281 grunt.setInteractive(false);
282 try {
283 grunt.parseStopOnError(false);
284 } catch (ParseException e) {
285 throw new IOException("Failed to parse script " + e.getMessage(), e);
286 }
287 return PigStats.get();
288 }
289
290 private void registerQueryForDiagnostics(PigServer pigServer, String pl) throws IOException {
291 GruntParser grunt = new GruntParser(new StringReader(pl), pigServer);

Callers 1

runSingleMethod · 0.95

Calls 15

getMethod · 0.95
getExecutionEngineMethod · 0.95
setFileNameMethod · 0.95
startMethod · 0.95
getPigContextMethod · 0.95
setJobNameMethod · 0.95
setInteractiveMethod · 0.95
parseStopOnErrorMethod · 0.95
getMethod · 0.95
infoMethod · 0.80
getAllListenersMethod · 0.80
setScriptMethod · 0.80

Tested by

no test coverage detected