public class Pig
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
protected |
Pig(java.lang.String script,
ScriptPigContext scriptContext,
java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
BoundScript |
bind()
Bind a Pig object to variables in the host language (optional
operation).
|
BoundScript |
bind(java.util.List<java.util.Map<java.lang.String,java.lang.Object>> vars)
Bind this to multiple sets of variables.
|
BoundScript |
bind(java.util.Map<java.lang.String,java.lang.Object> vars)
Bind this to a set of variables.
|
static Pig |
compile(java.lang.String pl)
Define a Pig pipeline.
|
static Pig |
compile(java.lang.String name,
java.lang.String pl)
Define a named portion of a Pig pipeline.
|
static Pig |
compileFromFile(java.lang.String filename)
Define a Pig pipeline based on Pig Latin in a separate file.
|
static Pig |
compileFromFile(java.lang.String name,
java.lang.String filename)
Define a named Pig pipeline based on Pig Latin in a separate file.
|
static void |
define(java.lang.String alias,
java.lang.String definition)
Define an alias for a UDF or a streaming command.
|
static int |
fs(java.lang.String cmd)
Run a filesystem command.
|
static void |
registerJar(java.lang.String jarfile)
Register a jar for use in Pig.
|
static void |
registerUDF(java.lang.String udffile,
java.lang.String namespace)
Register scripting UDFs for use in Pig.
|
static void |
set(java.lang.String var,
java.lang.String value)
Set a variable for use in Pig Latin.
|
static int |
sql(java.lang.String cmd)
Run a sql command.
|
protected Pig(java.lang.String script, ScriptPigContext scriptContext, java.lang.String name)
public static int fs(java.lang.String cmd) throws java.io.IOException
cmd
- Filesystem command to run along with its arguments as one
string.java.io.IOException
public static int sql(java.lang.String cmd) throws java.io.IOException
cmd
- sql command to run along with its arguments as one
string. Currently only hcat is supported as a sql backendjava.io.IOException
public static void registerJar(java.lang.String jarfile) throws java.io.IOException
jarfile
- Path of jar to include.java.io.IOException
- if the indicated jarfile cannot be found.public static void registerUDF(java.lang.String udffile, java.lang.String namespace) throws java.io.IOException
udffile
- Path of the script UDF filenamespace
- namespace of the UDFsjava.io.IOException
public static void define(java.lang.String alias, java.lang.String definition) throws java.io.IOException
alias
- name of the defined aliasdefinition
- string this alias is defined asjava.io.IOException
public static void set(java.lang.String var, java.lang.String value) throws java.io.IOException
var
- variable to setvalue
- to set it tojava.io.IOException
public static Pig compile(java.lang.String pl) throws java.io.IOException
pl
- Pig Latin definition of the pipeline.java.io.IOException
- if the Pig Latin does not compile.public static Pig compile(java.lang.String name, java.lang.String pl) throws java.io.IOException
name
- Name that will be used to define this pipeline.
The namespace is global.pl
- Pig Latin definition of the pipeline.java.io.IOException
- if the Pig Latin does not compile.public static Pig compileFromFile(java.lang.String filename) throws java.io.IOException
filename
- File to read Pig Latin from. This must be a purely
Pig Latin file. It cannot contain host language constructs in it.java.io.IOException
- if the Pig Latin does not compile or the file
cannot be found.public static Pig compileFromFile(java.lang.String name, java.lang.String filename) throws java.io.IOException
name
- Name that will be used to define this pipeline.
The namespace is global.filename
- File to read Pig Latin from. This must be a purely
Pig Latin file. It cannot contain host language constructs in it.java.io.IOException
- if the Pig Latin does not compile or the file
cannot be found.public BoundScript bind(java.util.Map<java.lang.String,java.lang.Object> vars) throws java.io.IOException
vars
- map of variables to bind. Keys should be parameters defined
in the Pig Latin. Values should be strings that provide values for those
parameters. They can be either constants or variables from the host
language. Host language variables must contain strings.BoundScript
objectjava.io.IOException
- if there is not a key for each
Pig Latin parameter or if they contain unsupported types.public BoundScript bind(java.util.List<java.util.Map<java.lang.String,java.lang.Object>> vars) throws java.io.IOException
vars
- list of maps of variables to bind. Keys should be parameters defined
in the Pig Latin. Values should be strings that provide values for those
variables. They can be either constants or variables from the host
language. Host language variables must be strings.BoundScript
objectjava.io.IOException
- if there is not a key for each
Pig Latin parameter or if they contain unsupported types.public BoundScript bind() throws java.io.IOException
java.io.IOException
- if host language variables are not found to resolve all
Pig Latin parameters or if they contain unsupported types.Copyright © 2007-2012 The Apache Software Foundation