|
||||||||||
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().
Nested Class Summary | |
---|---|
static class |
PigServer.ExecType
The type of query execution |
Field Summary | |
---|---|
String |
Result
|
Constructor Summary | |
---|---|
PigServer(PigContext context)
|
|
PigServer(PigServer.ExecType execType)
|
|
PigServer(PigServer.ExecType execType,
Properties properties)
|
|
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. |
void |
debugOff()
|
void |
debugOn()
|
boolean |
deleteFile(String filename)
|
void |
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()
|
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 PigServer.ExecType |
parseExecType(String str)
|
void |
registerFunction(String function,
String functionSpec)
Defines an alias for the given function spec. |
void |
registerJar(String name)
Registers a jar file. |
void |
registerQuery(String query)
Register a query with the Pig runtime. |
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 |
showExamples(LogicalPlan lp)
|
void |
showExamples(String id)
|
void |
shutdown()
|
void |
store(LogicalPlan readFrom,
String filename,
String func)
|
void |
store(String id,
String filename)
Store an alias into a file |
void |
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 |
Field Detail |
---|
public String Result
Constructor Detail |
---|
public PigServer(String execTypeString) throws ExecException, IOException
ExecException
IOException
public PigServer(PigServer.ExecType execType) throws ExecException
ExecException
public PigServer(PigServer.ExecType execType, Properties properties) throws ExecException
ExecException
public PigServer(PigContext context) throws ExecException
ExecException
Method Detail |
---|
public static PigServer.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 skippedpublic void registerFunction(String function, String functionSpec)
aliases
- - 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 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) throws IOException
query
- a Pig Latin expression to be evaluated.
IOException
public void dumpSchema(String alias) throws IOException
IOException
public void setJobName(String name)
public Iterator<Tuple> openIterator(String id) throws IOException
IOException
public void store(String id, String filename) throws IOException
id:
- The alias to storefilename:
- The file to which to store to
IOException
public void store(String id, String filename, String func) throws IOException
IOException
public void store(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 void showExamples(String id) throws IOException
IOException
public void showExamples(LogicalPlan lp) throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |