Spring for Apache Hadoop

org.springframework.data.hadoop.hive
Interface HiveOperations

All Known Implementing Classes:
HiveTemplate

public interface HiveOperations

Interface specifying a basic set of Hive operations. Implemented by HiveTemplate. Not often used directly, but a useful option to enhance testability, as it can easily be mocked or stubbed.

Author:
Costin Leau

Method Summary
<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.
 

Method Detail

execute

<T> T execute(HiveClientCallback<T> action)
          throws org.springframework.dao.DataAccessException
Executes the action specified by the given callback object within an active HiveClient.

Parameters:
action - callback object taht specifies the Hive action
Returns:
the action result object
Throws:
org.springframework.dao.DataAccessException

query

java.util.List<java.lang.String> query(java.lang.String query)
                                       throws org.springframework.dao.DataAccessException
Executes the given HiveQL that results in a list of objects. The script is interpreted as a URL or if that fails, as a HiveQL statement.

Parameters:
query - HiveQL
Returns:
list of values returned by the query
Throws:
org.springframework.dao.DataAccessException

query

java.util.List<java.lang.String> query(java.lang.String query,
                                       java.util.Map<?,?> arguments)
                                       throws org.springframework.dao.DataAccessException
Executes the given HiveQL using the list of arguments, expecting a list of objects. The script is interpreted as a URL or if that fails, as a HiveQL statement.

Parameters:
query - HiveQL
arguments - query arguments
Returns:
list of values returned by the query
Throws:
org.springframework.dao.DataAccessException

queryForString

java.lang.String queryForString(java.lang.String query)
                                throws org.springframework.dao.DataAccessException
Executes the given HiveQL that results in a single object. The script is interpreted as a URL or if that fails, as a HiveQL statement.

Parameters:
query - HiveQL
Returns:
query result
Throws:
org.springframework.dao.DataAccessException

queryForString

java.lang.String queryForString(java.lang.String query,
                                java.util.Map<?,?> arguments)
                                throws org.springframework.dao.DataAccessException
Executes the given HiveQL using the list of arguments, that results in a single object. The script is interpreted as a URL or if that fails, as a HiveQL statement.

Parameters:
query - HiveQL
arguments - query arguments
Returns:
query result
Throws:
org.springframework.dao.DataAccessException

queryForInt

java.lang.Integer queryForInt(java.lang.String query)
                              throws org.springframework.dao.DataAccessException
Executes the given HiveQL that results in a single int value. The script is interpreted as a URL or if that fails, as a HiveQL statement.

Parameters:
query - HiveQL
Returns:
query int result
Throws:
org.springframework.dao.DataAccessException

queryForInt

java.lang.Integer queryForInt(java.lang.String query,
                              java.util.Map<?,?> arguments)
                              throws org.springframework.dao.DataAccessException
Executes the given HiveQL using the list of arguments, that results in a single int value. The script is interpreted as a URL or if that fails, as a HiveQL statement.

Parameters:
query - HiveQL
arguments - query arguments
Returns:
query int result
Throws:
org.springframework.dao.DataAccessException

queryForLong

java.lang.Long queryForLong(java.lang.String query)
                            throws org.springframework.dao.DataAccessException
Executes the given HiveQL that results in a single long value. The script is interpreted as a URL or if that fails, as a HiveQL statement.

Parameters:
query - HiveQL
Returns:
query long result
Throws:
org.springframework.dao.DataAccessException

queryForLong

java.lang.Long queryForLong(java.lang.String query,
                            java.util.Map<?,?> arguments)
                            throws org.springframework.dao.DataAccessException
Executes the given HiveQL using the list of arguments, that results in a single long value. The script is interpreted as a URL or if that fails, as a HiveQL statement.

Parameters:
query - HiveQL
arguments - query arguments
Returns:
query long result
Throws:
org.springframework.dao.DataAccessException

executeScript

java.util.List<java.lang.String> executeScript(HiveScript script)
                                               throws org.springframework.dao.DataAccessException
Executes a Hive script.

Parameters:
script - script resource and arguments
Returns:
script result
Throws:
org.springframework.dao.DataAccessException

executeScript

java.util.List<java.lang.String> executeScript(java.lang.Iterable<HiveScript> scripts)
                                               throws org.springframework.dao.DataAccessException
Executes multiple Hive scripts.

Parameters:
scripts - script resources and arguments
Returns:
scripts results
Throws:
org.springframework.dao.DataAccessException

Spring for Apache Hadoop