org.apache.pig.tools
Class ToolsPigServer
java.lang.Object
org.apache.pig.PigServer
org.apache.pig.tools.ToolsPigServer
@InterfaceAudience.LimitedPrivate(value="Penny")
@InterfaceStability.Unstable
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.
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 |
ToolsPigServer
public ToolsPigServer(String execTypeString)
throws ExecException,
IOException
- Parameters:
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.
- Throws:
ExecException
- if throws by PigServer
IOException
- if throws by PigServer
ToolsPigServer
public ToolsPigServer(PigContext ctx)
throws ExecException,
IOException
- Parameters:
ctx
- the context to use to construct the PigServer
- Throws:
ExecException
- if throws by PigServer
IOException
- if throws by PigServer
ToolsPigServer
public ToolsPigServer(ExecType execType,
Properties properties)
throws ExecException
- Parameters:
execType
- execution type to start the engine in.properties
- to use for this run
- Throws:
ExecException
- if throws by PigServer
registerNoRun
public void registerNoRun(String fileName,
Map<String,String> params,
List<String> paramFiles)
throws IOException,
FrontendException
- Register a script without running it. This method is not compatible with
PigServer.registerQuery(String)
, PigServer.registerScript(String)
,
PigServer.store(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.
- Parameters:
fileName
- File containing Pig Latin script to register.params
- the key is the parameter name, and the value is the parameter valueparamFiles
- files which have the parameter setting
- Throws:
IOException
- if it encounters problems reading the script
FrontendException
- if it encounters problems parsing the script
getPlans
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.
- Returns:
- the pig plans.
runPlan
public List<ExecJob> runPlan(LogicalPlan newPlan,
String jobName)
throws FrontendException,
ExecException
- Given a (modified) new logical plan, run the script.
- Parameters:
newPlan
- plan to runjobName
- name to give the MR jobs associated with this run
- Returns:
- list of exec jobs describing the jobs that were run.
- Throws:
FrontendException
- if plan translation fails.
ExecException
- if running the job fails.
Copyright © 2012 The Apache Software Foundation