public class PigTemplate extends Object implements InitializingBean, PigOperations, ResourceLoaderAware
| Constructor and Description |
|---|
PigTemplate()
Constructs a new
PigTemplate instance. |
PigTemplate(PigServerFactory pigFactory)
Constructs a new
PigTemplate instance. |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
protected DataAccessException |
convertPigAccessException(ExecException ex)
Converts the given Pig exception to an appropriate exception from the org.springframework.dao hierarchy.
|
protected DataAccessException |
convertPigAccessException(IOException ex)
Converts the given Pig exception to an appropriate exception from the org.springframework.dao hierarchy.
|
protected PigServer |
createPigServer() |
<T> T |
execute(PigCallback<T> action)
Executes the action specified by the given callback object within an active
PigServer. |
List<ExecJob> |
executeScript(Iterable<PigScript> scripts)
Executes multiple scripts that result in a list of job executions.
|
List<ExecJob> |
executeScript(PigScript script)
Executes the given script identified by location and arguments that results in a list of job executions.
|
List<ExecJob> |
executeScript(String script)
Executes the given Pig Latin that results in a list of job executions.
|
List<ExecJob> |
executeScript(String script,
Map<?,?> arguments)
Executes the given Pig Latin with arguments that results in a list of job executions.
|
void |
setPigFactory(PigServerFactory pigServerFactory)
Sets the
PigServer factory. |
void |
setResourceLoader(ResourceLoader resourceLoader) |
public PigTemplate()
PigTemplate instance.
Expects setPigFactory(PigServerFactory) to be called before using it.public PigTemplate(PigServerFactory pigFactory)
PigTemplate instance.pigFactory - pig factorypublic void afterPropertiesSet()
afterPropertiesSet in interface InitializingBeanpublic <T> T execute(PigCallback<T> action) throws DataAccessException
PigServer.execute in interface PigOperationsT - action typeaction - callback object that specifies the Hive actionDataAccessException - exceptionprotected DataAccessException convertPigAccessException(IOException ex)
ex - Pig exceptionprotected DataAccessException convertPigAccessException(ExecException ex)
ex - Pig exceptionpublic List<ExecJob> executeScript(String script) throws DataAccessException
executeScript in interface PigOperationsscript - script URL or pig latin statementDataAccessException - exceptionpublic List<ExecJob> executeScript(String script, Map<?,?> arguments) throws DataAccessException
executeScript in interface PigOperationsscript - script URL or pig latin statementarguments - script argumentsDataAccessException - exceptionpublic List<ExecJob> executeScript(PigScript script) throws DataAccessException
executeScript in interface PigOperationsscript - script location and argumentsDataAccessException - exceptionpublic List<ExecJob> executeScript(Iterable<PigScript> scripts) throws DataAccessException
executeScript in interface PigOperationsscripts - scripts location and argumentsDataAccessException - exceptionprotected PigServer createPigServer()
public void setPigFactory(PigServerFactory pigServerFactory)
PigServer factory.pigServerFactory - pig server factorypublic void setResourceLoader(ResourceLoader resourceLoader)
setResourceLoader in interface ResourceLoaderAware