|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pig.PigServer
public class PigServer
This class is the program's connection to Pig. Typically a program will create a PigServer instance. The programmer then registers queries using registerQuery() and retrieves results using openIterator() or store().
Constructor Summary | |
---|---|
PigServer(ExecType execType)
|
|
PigServer(ExecType execType,
Properties properties)
|
|
PigServer(PigContext context)
|
|
PigServer(PigContext context,
boolean connect)
|
|
PigServer(String execTypeString)
|
Method Summary | |
---|---|
void |
addPathToSkip(String path)
Add a path to be skipped while automatically shipping binaries for streaming. |
long |
capacity()
Returns the unused byte capacity of an HDFS filesystem. |
LogicalPlan |
clonePlan(String alias)
|
void |
debugOff()
|
void |
debugOn()
|
boolean |
deleteFile(String filename)
|
Schema |
dumpSchema(String alias)
|
boolean |
existsFile(String filename)
|
void |
explain(String alias,
PrintStream stream)
Provide information on how a pig query will be executed. |
long |
fileSize(String filename)
Returns the length of a file in bytes which exists in the HDFS (accounts for replication). |
Map<String,LogicalPlan> |
getAliases()
|
Map<LogicalOperator,DataBag> |
getExamples(String alias)
|
PigContext |
getPigContext()
|
String[] |
listPaths(String dir)
|
boolean |
mkdirs(String dirs)
|
Iterator<Tuple> |
openIterator(String id)
Forces execution of query (and all queries from which it reads), in order to materialize result |
static ExecType |
parseExecType(String str)
|
void |
printAliases()
|
void |
registerFunction(String function,
FuncSpec funcSpec)
Defines an alias for the given function spec. |
void |
registerFunction(String function,
String functionSpec)
Deprecated. |
void |
registerJar(String name)
Registers a jar file. |
void |
registerQuery(String query)
|
void |
registerQuery(String query,
int startLine)
Register a query with the Pig runtime. |
void |
registerScript(String fileName)
|
void |
registerStreamingCommand(String commandAlias,
StreamingCommand command)
Defines an alias for the given streaming command. |
boolean |
renameFile(String source,
String target)
|
void |
setJobName(String name)
|
void |
shutdown()
|
ExecJob |
store(String id,
LogicalPlan readFrom,
String filename,
String func)
|
ExecJob |
store(String id,
String filename)
Store an alias into a file |
ExecJob |
store(String id,
String filename,
String func)
forces execution of query (and all queries from which it reads), in order to store result in file |
long |
totalHadoopTimeSpent()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PigServer(String execTypeString) throws ExecException, IOException
ExecException
IOException
public PigServer(ExecType execType) throws ExecException
ExecException
public PigServer(ExecType execType, Properties properties) throws ExecException
ExecException
public PigServer(PigContext context) throws ExecException
ExecException
public PigServer(PigContext context, boolean connect) throws ExecException
ExecException
Method Detail |
---|
public static ExecType parseExecType(String str) throws IOException
IOException
public PigContext getPigContext()
public void debugOn()
public void debugOff()
public void addPathToSkip(String path)
path
- path to be skipped@Deprecated public void registerFunction(String function, String functionSpec)
function
- - the new function alias to define.functionSpec
- - the name of the function and any arguments.
It should have the form: classname('arg1', 'arg2', ...)public void registerFunction(String function, FuncSpec funcSpec)
function
- - the new function alias to define.funcSpec
- - the FuncSpec object representing the name of
the function class and any arguments to constructor.public void registerStreamingCommand(String commandAlias, StreamingCommand command)
commandAlias
- - the new command alias to definecommand
- - streaming command to be executedpublic void registerJar(String name) throws IOException
name
- of the jar file to register
IOException
public void registerQuery(String query, int startLine) throws IOException
query
- a Pig Latin expression to be evaluated.startLine
- line number of the query within the whold script
IOException
public LogicalPlan clonePlan(String alias) throws IOException
IOException
public void registerQuery(String query) throws IOException
IOException
public void registerScript(String fileName) throws IOException
IOException
public void printAliases() throws FrontendException
FrontendException
public Schema dumpSchema(String alias) throws IOException
IOException
public void setJobName(String name)
public Iterator<Tuple> openIterator(String id) throws IOException
IOException
public ExecJob store(String id, String filename) throws IOException
id
- The alias to storefilename
- The file to which to store to
IOException
public ExecJob store(String id, String filename, String func) throws IOException
IOException
public ExecJob store(String id, LogicalPlan readFrom, String filename, String func) throws IOException
IOException
public void explain(String alias, PrintStream stream) throws IOException
alias
- Name of alias to explain.stream
- PrintStream to write explanation to.
IOException
- if the requested alias cannot be found.public long capacity() throws IOException
IOException
public long fileSize(String filename) throws IOException
filename
-
IOException
public boolean existsFile(String filename) throws IOException
IOException
public boolean deleteFile(String filename) throws IOException
IOException
public boolean renameFile(String source, String target) throws IOException
IOException
public boolean mkdirs(String dirs) throws IOException
IOException
public String[] listPaths(String dir) throws IOException
IOException
public long totalHadoopTimeSpent()
public Map<String,LogicalPlan> getAliases()
public void shutdown()
public Map<LogicalOperator,DataBag> getExamples(String alias)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |