public class PigContext extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
int |
defaultParallel |
List<URL> |
extraJars |
boolean |
inDumpSchema |
boolean |
inExplain |
boolean |
inIllustrator |
static String |
JOB_NAME |
static String |
JOB_NAME_PREFIX |
static String |
JOB_PRIORITY |
Map<String,org.antlr.runtime.tree.Tree> |
macros |
static String |
PIG_CMD_ARGS_REMAINDERS |
Vector<String> |
predeployedJars |
List<String> |
scriptFiles
Deprecated.
|
Map<String,String> |
scriptingUDFs |
List<String> |
scriptJars |
Constructor and Description |
---|
PigContext() |
PigContext(org.apache.hadoop.conf.Configuration conf) |
PigContext(ExecType execType,
org.apache.hadoop.conf.Configuration conf) |
PigContext(ExecType execType,
Properties properties) |
PigContext(Properties properties) |
Modifier and Type | Method and Description |
---|---|
void |
addJar(String path) |
void |
addJar(URL resource,
String originalPath) |
void |
addPathToSkip(String path)
Add a path to be skipped while automatically shipping binaries for
streaming.
|
void |
addScriptFile(String path)
calls: addScriptFile(path, new File(path)), ensuring that a given path is
added to the jar at most once.
|
void |
addScriptFile(String name,
String path)
this method adds script files that must be added to the shipped jar
named differently from their local fs path.
|
void |
addScriptJar(String path) |
void |
connect() |
void |
copy(String src,
String dst,
boolean localDst) |
ClassLoader |
createCl(String jarFile)
Creates a Classloader based on the passed jarFile and any extra jar files.
|
ExecutableManager |
createExecutableManager()
Create a new
ExecutableManager depending on the ExecType. |
String |
doParamSubstitution(BufferedReader reader) |
String |
doParamSubstitution(BufferedReader reader,
List<String> params,
List<String> paramFiles) |
String |
doParamSubstitution(InputStream in,
List<String> params,
List<String> paramFiles) |
BufferedReader |
doParamSubstitutionOutputToFile(BufferedReader reader,
String outputFilePath) |
BufferedReader |
doParamSubstitutionOutputToFile(BufferedReader reader,
String outputFilePath,
List<String> params,
List<String> paramFiles) |
Class |
getClassForAlias(String alias) |
static ClassLoader |
getClassLoader() |
StreamingCommand |
getCommandForAlias(String alias)
Get the
StreamingCommand for the given alias. |
Properties |
getConf()
Deprecated.
use
getProperties() instead |
org.apache.log4j.Level |
getDefaultLogLevel() |
int |
getDefaultParallel() |
DataStorage |
getDfs() |
byte |
getErrorSource()
Check the execution mode and return the appropriate error source
|
ExecType |
getExecType()
Returns the type of execution currently in effect.
|
ExecutionEngine |
getExecutionEngine() |
DataStorage |
getFs() |
FuncSpec |
getFuncSpecFromAlias(String alias) |
String |
getLastAlias() |
DataStorage |
getLfs() |
Properties |
getLog4jProperties() |
static ArrayList<String> |
getPackageImportList() |
List<String> |
getParamFiles() |
List<String> |
getParams() |
Map<String,String> |
getParamVal() |
List<String> |
getPathsToSkip()
Get paths which are to skipped while automatically shipping binaries for
streaming.
|
PreprocessorContext |
getPreprocessorContext() |
Properties |
getProperties()
Provides configuration information.
|
Map<String,File> |
getScriptFiles()
script files as name/file pairs to be added to the job jar
|
boolean |
hasJar(String path) |
static void |
initializeImportList(String importListCommandLineProperties) |
Object |
instantiateFuncFromAlias(String alias) |
static Object |
instantiateFuncFromSpec(FuncSpec funcSpec) |
static Object |
instantiateFuncFromSpec(String funcSpec) |
static <T> T |
instantiateObjectFromParams(org.apache.hadoop.conf.Configuration conf,
String classParamKey,
String argParamKey,
Class<T> clazz)
A common Pig pattern for initializing objects via system properties is to support passing
something like this on the command line:
-Dpig.notification.listener=MyClass
-Dpig.notification.listener.arg=myConstructorStringArg
This method will properly initialize the class with the args, if they exist. |
void |
markJarAsPredeployed(String path)
Adds the specified path to the predeployed jars list.
|
void |
registerFunction(String function,
FuncSpec functionSpec)
Defines an alias for the given function spec.
|
void |
registerStreamCmd(String alias,
StreamingCommand command)
Defines an alias for the given streaming command.
|
void |
rename(String oldName,
String newName) |
static Class |
resolveClassName(String name) |
static void |
setClassLoader(ClassLoader cl) |
void |
setDefaultLogLevel(org.apache.log4j.Level l) |
void |
setExecType(ExecType execType) |
void |
setJobtrackerLocation(String newLocation) |
void |
setLastAlias(String value) |
void |
setLog4jProperties(Properties p) |
static void |
setPackageImportList(ArrayList<String> list) |
void |
setParamFiles(List<String> paramFiles) |
void |
setParams(List<String> params) |
static void |
staticDataCleanup() |
public static final String JOB_NAME
public static final String JOB_NAME_PREFIX
public static final String JOB_PRIORITY
public static final String PIG_CMD_ARGS_REMAINDERS
@Deprecated public List<String> scriptFiles
public int defaultParallel
public boolean inExplain
public boolean inDumpSchema
public boolean inIllustrator
public PigContext()
public PigContext(org.apache.hadoop.conf.Configuration conf) throws PigException
PigException
public PigContext(Properties properties) throws PigException
PigException
public PigContext(ExecType execType, org.apache.hadoop.conf.Configuration conf)
public PigContext(ExecType execType, Properties properties)
public static void staticDataCleanup()
public PreprocessorContext getPreprocessorContext()
public Map<String,String> getParamVal() throws IOException
IOException
public static void initializeImportList(String importListCommandLineProperties)
public void connect() throws ExecException
ExecException
public void setJobtrackerLocation(String newLocation)
public void addScriptFile(String path)
path
- public void addScriptFile(String name, String path)
name
- name in the jarpath
- path on the local fspublic void addScriptJar(String path)
public void addJar(String path) throws MalformedURLException
MalformedURLException
public void addJar(URL resource, String originalPath) throws MalformedURLException
MalformedURLException
public boolean hasJar(String path)
public void markJarAsPredeployed(String path)
This can be called for jars that are pre-installed on the Hadoop cluster to reduce the size of the job jar.
public String doParamSubstitution(InputStream in, List<String> params, List<String> paramFiles) throws IOException
IOException
public String doParamSubstitution(BufferedReader reader, List<String> params, List<String> paramFiles) throws IOException
IOException
public String doParamSubstitution(BufferedReader reader) throws IOException
IOException
public BufferedReader doParamSubstitutionOutputToFile(BufferedReader reader, String outputFilePath, List<String> params, List<String> paramFiles) throws IOException
IOException
public BufferedReader doParamSubstitutionOutputToFile(BufferedReader reader, String outputFilePath) throws IOException
IOException
public Map<String,File> getScriptFiles()
public void rename(String oldName, String newName) throws IOException
IOException
public void copy(String src, String dst, boolean localDst) throws IOException
IOException
public ExecutionEngine getExecutionEngine()
public DataStorage getDfs()
public DataStorage getLfs()
public DataStorage getFs()
public Properties getProperties()
@Deprecated public Properties getConf()
getProperties()
insteadpublic String getLastAlias()
public void setLastAlias(String value)
public void registerFunction(String function, FuncSpec functionSpec)
function
- - the new function alias to define.functionSpec
- - the FuncSpec object representing the name of
the function class and any arguments to constructor.public void registerStreamCmd(String alias, StreamingCommand command)
alias
- - the new command alias to define.command
- - the commandpublic ExecType getExecType()
public ClassLoader createCl(String jarFile) throws MalformedURLException
jarFile
- the jar file to be part of the newly created Classloader. This jar file plus any
jars in the extraJars list will constitute the classpath.MalformedURLException
public static Class resolveClassName(String name) throws IOException
IOException
public static <T> T instantiateObjectFromParams(org.apache.hadoop.conf.Configuration conf, String classParamKey, String argParamKey, Class<T> clazz) throws ExecException
-Dpig.notification.listener=MyClass
-Dpig.notification.listener.arg=myConstructorStringArg
This method will properly initialize the class with the args, if they exist.conf
- classParamKey
- the property used to identify the classargParamKey
- the property used to identify the class argsclazz
- The class that is expectedExecException
public Class getClassForAlias(String alias) throws IOException
IOException
public Object instantiateFuncFromAlias(String alias) throws IOException
IOException
public StreamingCommand getCommandForAlias(String alias)
StreamingCommand
for the given alias.alias
- the alias for the StreamingCommand
StreamingCommand
for the aliaspublic void setExecType(ExecType execType)
public ExecutableManager createExecutableManager() throws ExecException
ExecutableManager
depending on the ExecType.ExecutableManager
depending on the ExecTypeExecException
public void addPathToSkip(String path)
path
- path to be skippedpublic List<String> getPathsToSkip()
public byte getErrorSource()
public void setLog4jProperties(Properties p)
public Properties getLog4jProperties()
public org.apache.log4j.Level getDefaultLogLevel()
public void setDefaultLogLevel(org.apache.log4j.Level l)
public int getDefaultParallel()
public static ClassLoader getClassLoader()
public static void setClassLoader(ClassLoader cl)
Copyright © 2007-2017 The Apache Software Foundation