public class HiveTemplate extends java.lang.Object implements org.springframework.beans.factory.InitializingBean, HiveOperations, org.springframework.context.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 org.springframework.dao.DataAccessException | convertHiveAccessException(java.lang.Exception ex)Converts the given Hive exception to an appropriate exception from the org.springframework.dao hierarchy. | 
| protected org.apache.hadoop.hive.service.HiveClient | createHiveClient() | 
| <T> T | execute(HiveClientCallback<T> action)Executes the action specified by the given callback object within an active  HiveClient. | 
| java.util.List<java.lang.String> | executeScript(HiveScript script)Executes a Hive script. | 
| java.util.List<java.lang.String> | executeScript(java.lang.Iterable<HiveScript> scripts)Executes multiple Hive scripts. | 
| java.util.List<java.lang.String> | query(java.lang.String query)Executes the given HiveQL that results in a list of objects. | 
| java.util.List<java.lang.String> | query(java.lang.String query,
     java.util.Map<?,?> arguments)Executes the given HiveQL using the list of arguments, expecting a list of objects. | 
| java.lang.Integer | queryForInt(java.lang.String query)Executes the given HiveQL that results in a single int value. | 
| java.lang.Integer | queryForInt(java.lang.String query,
           java.util.Map<?,?> arguments)Executes the given HiveQL using the list of arguments, that results in a single int value. | 
| java.lang.Long | queryForLong(java.lang.String query)Executes the given HiveQL that results in a single long value. | 
| java.lang.Long | queryForLong(java.lang.String query,
            java.util.Map<?,?> arguments)Executes the given HiveQL using the list of arguments, that results in a single long value. | 
| java.lang.String | queryForString(java.lang.String query)Executes the given HiveQL that results in a single object. | 
| java.lang.String | queryForString(java.lang.String query,
              java.util.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(org.springframework.core.io.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 org.springframework.beans.factory.InitializingBeanpublic <T> T execute(HiveClientCallback<T> action) throws org.springframework.dao.DataAccessException
HiveClient.execute in interface HiveOperationsT - action typeaction - callback object that specifies the Hive actionorg.springframework.dao.DataAccessException - exceptionprotected org.springframework.dao.DataAccessException convertHiveAccessException(java.lang.Exception ex)
ex - hive exceptionpublic java.util.List<java.lang.String> query(java.lang.String query)
                                       throws org.springframework.dao.DataAccessException
query in interface HiveOperationsquery - HiveQLorg.springframework.dao.DataAccessException - exceptionpublic java.util.List<java.lang.String> query(java.lang.String query,
                                     java.util.Map<?,?> arguments)
                                       throws org.springframework.dao.DataAccessException
query in interface HiveOperationsquery - HiveQLarguments - query argumentsorg.springframework.dao.DataAccessException - exceptionpublic java.lang.String queryForString(java.lang.String query)
                                throws org.springframework.dao.DataAccessException
queryForString in interface HiveOperationsquery - HiveQLorg.springframework.dao.DataAccessException - exceptionpublic java.lang.String queryForString(java.lang.String query,
                              java.util.Map<?,?> arguments)
                                throws org.springframework.dao.DataAccessException
queryForString in interface HiveOperationsquery - HiveQLarguments - query argumentsorg.springframework.dao.DataAccessException - exceptionpublic java.lang.Integer queryForInt(java.lang.String query)
                              throws org.springframework.dao.DataAccessException
queryForInt in interface HiveOperationsquery - HiveQLorg.springframework.dao.DataAccessException - exceptionpublic java.lang.Integer queryForInt(java.lang.String query,
                            java.util.Map<?,?> arguments)
                              throws org.springframework.dao.DataAccessException
queryForInt in interface HiveOperationsquery - HiveQLarguments - query argumentsorg.springframework.dao.DataAccessException - exceptionpublic java.lang.Long queryForLong(java.lang.String query)
                            throws org.springframework.dao.DataAccessException
queryForLong in interface HiveOperationsquery - HiveQLorg.springframework.dao.DataAccessException - exceptionpublic java.lang.Long queryForLong(java.lang.String query,
                          java.util.Map<?,?> arguments)
                            throws org.springframework.dao.DataAccessException
queryForLong in interface HiveOperationsquery - HiveQLarguments - query argumentsorg.springframework.dao.DataAccessException - exceptionpublic java.util.List<java.lang.String> executeScript(HiveScript script) throws org.springframework.dao.DataAccessException
executeScript in interface HiveOperationsscript - script resource and argumentsorg.springframework.dao.DataAccessException - exceptionpublic java.util.List<java.lang.String> executeScript(java.lang.Iterable<HiveScript> scripts) throws org.springframework.dao.DataAccessException
executeScript in interface HiveOperationsscripts - scripts resources and argumentsorg.springframework.dao.DataAccessException - exceptionprotected org.apache.hadoop.hive.service.HiveClient createHiveClient()
public void setHiveClientFactory(HiveClientFactory hiveClientFactory)
HiveClient factory.hiveClientFactory - hive client factory to setpublic void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
setResourceLoader in interface org.springframework.context.ResourceLoaderAware