public class HiveTemplate extends Object implements InitializingBean, HiveOperations, ResourceLoaderAware
HiveClient (which is non-thread-safe) 
 and converts Hive exceptions into DataAccessExceptions.| Constructor and Description | 
|---|
| HiveTemplate()Constructs a new  HiveClientinstance. | 
| HiveTemplate(HiveClientFactory hiveClientFactory)Constructs a new  HiveTemplateinstance. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | afterPropertiesSet() | 
| protected DataAccessException | convertHiveAccessException(Exception ex)Converts the given Hive exception to an appropriate exception from the org.springframework.dao hierarchy. | 
| protected HiveClient | createHiveClient() | 
| <T> T | execute(HiveClientCallback<T> action)Executes the action specified by the given callback object within an active  HiveClient. | 
| List<String> | executeScript(HiveScript script)Executes a Hive script. | 
| List<String> | executeScript(Iterable<HiveScript> scripts)Executes multiple Hive scripts. | 
| List<String> | query(String query)Executes the given HiveQL that results in a list of objects. | 
| List<String> | query(String query,
     Map<?,?> arguments)Executes the given HiveQL using the list of arguments, expecting a list of objects. | 
| Integer | queryForInt(String query)Executes the given HiveQL that results in a single int value. | 
| Integer | queryForInt(String query,
           Map<?,?> arguments)Executes the given HiveQL using the list of arguments, that results in a single int value. | 
| Long | queryForLong(String query)Executes the given HiveQL that results in a single long value. | 
| Long | queryForLong(String query,
            Map<?,?> arguments)Executes the given HiveQL using the list of arguments, that results in a single long value. | 
| String | queryForString(String query)Executes the given HiveQL that results in a single object. | 
| String | queryForString(String query,
              Map<?,?> arguments)Executes the given HiveQL using the list of arguments, that results in a single object. | 
| void | setHiveClientFactory(HiveClientFactory hiveClientFactory)Sets the  HiveClientfactory. | 
| void | setResourceLoader(ResourceLoader resourceLoader) | 
public HiveTemplate()
HiveClient instance.
 Expects setHiveClientFactory(HiveClientFactory) to be called before using it.public HiveTemplate(HiveClientFactory hiveClientFactory)
HiveTemplate instance.hiveClientFactory - HiveClient factorypublic void afterPropertiesSet()
afterPropertiesSet in interface InitializingBeanpublic <T> T execute(HiveClientCallback<T> action) throws DataAccessException
HiveClient.execute in interface HiveOperationsT - action typeaction - callback object that specifies the Hive actionDataAccessException - exceptionprotected DataAccessException convertHiveAccessException(Exception ex)
ex - hive exceptionpublic List<String> query(String query) throws DataAccessException
query in interface HiveOperationsquery - HiveQLDataAccessException - exceptionpublic List<String> query(String query, Map<?,?> arguments) throws DataAccessException
query in interface HiveOperationsquery - HiveQLarguments - query argumentsDataAccessException - exceptionpublic String queryForString(String query) throws DataAccessException
queryForString in interface HiveOperationsquery - HiveQLDataAccessException - exceptionpublic String queryForString(String query, Map<?,?> arguments) throws DataAccessException
queryForString in interface HiveOperationsquery - HiveQLarguments - query argumentsDataAccessException - exceptionpublic Integer queryForInt(String query) throws DataAccessException
queryForInt in interface HiveOperationsquery - HiveQLDataAccessException - exceptionpublic Integer queryForInt(String query, Map<?,?> arguments) throws DataAccessException
queryForInt in interface HiveOperationsquery - HiveQLarguments - query argumentsDataAccessException - exceptionpublic Long queryForLong(String query) throws DataAccessException
queryForLong in interface HiveOperationsquery - HiveQLDataAccessException - exceptionpublic Long queryForLong(String query, Map<?,?> arguments) throws DataAccessException
queryForLong in interface HiveOperationsquery - HiveQLarguments - query argumentsDataAccessException - exceptionpublic List<String> executeScript(HiveScript script) throws DataAccessException
executeScript in interface HiveOperationsscript - script resource and argumentsDataAccessException - exceptionpublic List<String> executeScript(Iterable<HiveScript> scripts) throws DataAccessException
executeScript in interface HiveOperationsscripts - scripts resources and argumentsDataAccessException - exceptionprotected HiveClient createHiveClient()
public void setHiveClientFactory(HiveClientFactory hiveClientFactory)
HiveClient factory.hiveClientFactory - hive client factory to setpublic void setResourceLoader(ResourceLoader resourceLoader)
setResourceLoader in interface ResourceLoaderAware