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

Method Detail

execute

<T> T execute(HiveClientCallback<T> action)
          throws 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:
DataAccessException

query

List<String> query(String query)
                   throws 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:
DataAccessException

query

List<String> query(String query,
                   Map<?,?> arguments)
                   throws 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:
DataAccessException

queryForString

String queryForString(String query)
                      throws 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:
DataAccessException

queryForString

String queryForString(String query,
                      Map<?,?> arguments)
                      throws 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:
DataAccessException

queryForInt

Integer queryForInt(String query)
                    throws 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:
DataAccessException

queryForInt

Integer queryForInt(String query,
                    Map<?,?> arguments)
                    throws 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:
DataAccessException

queryForLong

Long queryForLong(String query)
                  throws 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:
DataAccessException

queryForLong

Long queryForLong(String query,
                  Map<?,?> arguments)
                  throws 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:
DataAccessException

executeScript

List<String> executeScript(HiveScript script)
                           throws DataAccessException
Executes a Hive script.

Parameters:
script - script resource and arguments
Returns:
script result
Throws:
DataAccessException

executeScript

List<String> executeScript(Iterable<HiveScript> scripts)
                           throws DataAccessException
Executes multiple Hive scripts.

Parameters:
scripts - script resources and arguments
Returns:
scripts results
Throws:
DataAccessException