Class ToolsPigServer

  extended by org.apache.pig.PigServer
      extended by

public class ToolsPigServer
extends PigServer

ToolsPigServer is a subclass of PigServer intended only for Pig tools. Users should not use this interface, as we make no promises about its stability or continued existence.

Nested Class Summary
static class ToolsPigServer.PigPlans
Nested classes/interfaces inherited from class org.apache.pig.PigServer
Field Summary
Fields inherited from class org.apache.pig.PigServer
graphs, log, pigContext, scope
Constructor Summary
ToolsPigServer(ExecType execType, Properties properties)
ToolsPigServer(PigContext ctx)
ToolsPigServer(String execTypeString)
Method Summary
 ToolsPigServer.PigPlans getPlans()
          Get a class containing the Pig plans.
 void registerNoRun(String fileName, Map<String,String> params, List<String> paramFiles)
          Register a script without running it.
 List<ExecJob> runPlan(LogicalPlan newPlan, String jobName)
          Given a (modified) new logical plan, run the script.
Methods inherited from class org.apache.pig.PigServer
addPathToSkip, capacity, debugOff, debugOn, deleteFile, discardBatch, doParamSubstitution, dumpSchema, dumpSchemaNested, executeBatch, existsFile, explain, explain, fileSize, getAliases, getAliasKeySet, getClonedGraph, getExamples, getJobs, getPigContext, isBatchEmpty, isBatchOn, launchPlan, listPaths, mkdirs, openIterator, parseExecType, printAliases, registerCode, registerFunction, registerJar, registerQuery, registerQuery, registerScript, registerScript, registerScript, registerScript, registerScript, registerScript, registerScript, registerScript, registerStreamingCommand, renameFile, setBatchOn, setDefaultParallel, setJobName, setJobPriority, setValidateEachStatement, shutdown, store, store
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public ToolsPigServer(String execTypeString)
               throws ExecException,
execTypeString - can be 'mapreduce' or 'local'. Local mode will use Hadoop's local job runner to execute the job on the local machine. Mapreduce mode will connect to a cluster to execute the job.
ExecException - if throws by PigServer
IOException - if throws by PigServer


public ToolsPigServer(PigContext ctx)
               throws ExecException,
ctx - the context to use to construct the PigServer
ExecException - if throws by PigServer
IOException - if throws by PigServer


public ToolsPigServer(ExecType execType,
                      Properties properties)
               throws ExecException
execType - execution type to start the engine in.
properties - to use for this run
ExecException - if throws by PigServer
Method Detail


public void registerNoRun(String fileName,
                          Map<String,String> params,
                          List<String> paramFiles)
                   throws IOException,
Register a script without running it. This method is not compatible with PigServer.registerQuery(String), PigServer.registerScript(String),, String) or PigServer.openIterator(String). It can be used with getPlans() and runPlan(LogicalPlan, String) in this class only. The proper control flow is for the caller to call registerNoRun() and then getPlans() to get a copy of the plans. The user can then modify the logical plan. It can then be returned via runPlan(), which will execute the plan.

fileName - File containing Pig Latin script to register.
params - the key is the parameter name, and the value is the parameter value
paramFiles - files which have the parameter setting
IOException - if it encounters problems reading the script
FrontendException - if it encounters problems parsing the script


public ToolsPigServer.PigPlans getPlans()
Get a class containing the Pig plans. For now it just contains the new logical plan. At some point in the future it should contain the MR plan as well.

the pig plans.


public List<ExecJob> runPlan(LogicalPlan newPlan,
                             String jobName)
                      throws FrontendException,
Given a (modified) new logical plan, run the script.

newPlan - plan to run
jobName - name to give the MR jobs associated with this run
list of exec jobs describing the jobs that were run.
FrontendException - if plan translation fails.
ExecException - if running the job fails.

Copyright © ${year} The Apache Software Foundation