org.apache.hadoop.hive.service
Class HiveServer.HiveServerHandler

java.lang.Object
  extended by com.facebook.fb303.FacebookBase
      extended by org.apache.hadoop.hive.metastore.HiveMetaStore.HMSHandler
          extended by org.apache.hadoop.hive.service.HiveServer.HiveServerHandler
All Implemented Interfaces:
com.facebook.fb303.FacebookService.Iface, ThriftHiveMetastore.Iface, IHMSHandler, HiveInterface, ThriftHive.Iface
Enclosing class:
HiveServer

public static class HiveServer.HiveServerHandler
extends HiveMetaStore.HMSHandler
implements HiveInterface

Handler which implements the Hive Interface This class can be used in lieu of the HiveClient class to get an embedded server.


Field Summary
static org.apache.commons.logging.Log LOG
           
 
Fields inherited from class org.apache.hadoop.hive.metastore.HiveMetaStore.HMSHandler
AUDIT_FORMAT, auditLog
 
Constructor Summary
HiveServer.HiveServerHandler()
          Construct a new handler.
HiveServer.HiveServerHandler(HiveConf conf)
          Construct a new handler with the specified hive configuration.
 
Method Summary
 void clean()
          Should be called by the client at the end of a session.
 void execute(String cmd)
          Executes a query.
 List<String> fetchAll()
          Fetches all the rows in a result set.
 List<String> fetchN(int numRows)
          Fetches numRows rows.
 String fetchOne()
          Fetches the next row in a query result set.
 HiveClusterStatus getClusterStatus()
          Return the status information about the Map-Reduce cluster.
 QueryPlan getQueryPlan()
           
 Schema getSchema()
          Return the Hive schema of the query result.
 com.facebook.fb303.fb_status getStatus()
          Return the status of the server.
 Schema getThriftSchema()
          Return the Thrift schema of the query result.
 String getVersion()
          Return the version of the server software.
 
Methods inherited from class org.apache.hadoop.hive.metastore.HiveMetaStore.HMSHandler
add_index, add_partition_with_environment_context, add_partition, add_partitions, alter_database, alter_index, alter_partition_with_environment_context, alter_partition, alter_partitions, alter_table_with_environment_context, alter_table, append_partition_by_name, append_partition, cancel_delegation_token, create_database, create_index, create_role, create_table_with_environment_context, create_table, create_type, delete_partition_column_statistics, delete_table_column_statistics, drop_database, drop_index_by_name, drop_partition_by_name, drop_partition, drop_role, drop_table, drop_type, endFunction, endFunction, get_all_databases, get_all_tables, get_column_privilege_set, get_config_value, get_database, get_databases, get_db_privilege_set, get_delegation_token, get_fields, get_index_by_name, get_index_names, get_indexes, get_partition_by_name, get_partition_column_statistics, get_partition_names_ps, get_partition_names, get_partition_privilege_set, get_partition_with_auth, get_partition, get_partitions_by_filter, get_partitions_by_names, get_partitions_ps_with_auth, get_partitions_ps, get_partitions_with_auth, get_partitions, get_privilege_set, get_role_names, get_schema, get_table_column_statistics, get_table_names_by_filter, get_table_objects_by_name, get_table_privilege_set, get_table, get_tables, get_type_all, get_type, get_user_privilege_set, get, getCounters, getCpuProfile, getHiveConf, getIpAddress, getMS, getPrincipalType, getWh, grant_privileges, grant_role, isPartitionMarkedForEvent, list_column_privileges, list_db_privileges, list_global_privileges, list_partition_privileges, list_privileges, list_roles, list_table_privileges, markPartitionForEvent, partition_name_to_spec, partition_name_to_vals, rename_partition, renew_delegation_token, revoke_privileges, revoke_role, set_table_parameters, set_ugi, setConf, setIpAddress, shutdown, startFunction, startFunction, startMultiTableFunction, startPartitionFunction, startPartitionFunction, startTableFunction, update_partition_column_statistics, update_table_column_statistics
 
Methods inherited from class com.facebook.fb303.FacebookBase
aliveSince, deleteCounter, getCounter, getCpuProfile, getName, getOption, getOptions, getStatusDetails, incrementCounter, incrementCounter, reinitialize, resetCounter, setCounter, setOption
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore.Iface
add_index, add_partition_with_environment_context, add_partition, add_partitions, alter_database, alter_index, alter_partition_with_environment_context, alter_partition, alter_partitions, alter_table_with_environment_context, alter_table, append_partition_by_name, append_partition, cancel_delegation_token, create_database, create_role, create_table_with_environment_context, create_table, create_type, delete_partition_column_statistics, delete_table_column_statistics, drop_database, drop_index_by_name, drop_partition_by_name, drop_partition, drop_role, drop_table, drop_type, get_all_databases, get_all_tables, get_config_value, get_database, get_databases, get_delegation_token, get_fields, get_index_by_name, get_index_names, get_indexes, get_partition_by_name, get_partition_column_statistics, get_partition_names_ps, get_partition_names, get_partition_with_auth, get_partition, get_partitions_by_filter, get_partitions_by_names, get_partitions_ps_with_auth, get_partitions_ps, get_partitions_with_auth, get_partitions, get_privilege_set, get_role_names, get_schema, get_table_column_statistics, get_table_names_by_filter, get_table_objects_by_name, get_table, get_tables, get_type_all, get_type, grant_privileges, grant_role, isPartitionMarkedForEvent, list_privileges, list_roles, markPartitionForEvent, partition_name_to_spec, partition_name_to_vals, rename_partition, renew_delegation_token, revoke_privileges, revoke_role, set_ugi, update_partition_column_statistics, update_table_column_statistics
 
Methods inherited from interface com.facebook.fb303.FacebookService.Iface
aliveSince, getCounter, getCounters, getCpuProfile, getName, getOption, getOptions, getStatusDetails, reinitialize, setOption, shutdown
 

Field Detail

LOG

public static final org.apache.commons.logging.Log LOG
Constructor Detail

HiveServer.HiveServerHandler

public HiveServer.HiveServerHandler()
                             throws MetaException
Construct a new handler.

Throws:
MetaException - unable to create metastore

HiveServer.HiveServerHandler

public HiveServer.HiveServerHandler(HiveConf conf)
                             throws MetaException
Construct a new handler with the specified hive configuration.

Parameters:
conf - caller specified hive configuration
Throws:
MetaException - unable to create metastore
Method Detail

execute

public void execute(String cmd)
             throws HiveServerException,
                    org.apache.thrift.TException
Executes a query.

Specified by:
execute in interface ThriftHive.Iface
Parameters:
cmd - HiveQL query to execute
Throws:
HiveServerException
org.apache.thrift.TException

clean

public void clean()
Should be called by the client at the end of a session.

Specified by:
clean in interface ThriftHive.Iface

getClusterStatus

public HiveClusterStatus getClusterStatus()
                                   throws HiveServerException,
                                          org.apache.thrift.TException
Return the status information about the Map-Reduce cluster.

Specified by:
getClusterStatus in interface ThriftHive.Iface
Throws:
HiveServerException
org.apache.thrift.TException

getSchema

public Schema getSchema()
                 throws HiveServerException,
                        org.apache.thrift.TException
Return the Hive schema of the query result.

Specified by:
getSchema in interface ThriftHive.Iface
Throws:
HiveServerException
org.apache.thrift.TException

getThriftSchema

public Schema getThriftSchema()
                       throws HiveServerException,
                              org.apache.thrift.TException
Return the Thrift schema of the query result.

Specified by:
getThriftSchema in interface ThriftHive.Iface
Throws:
HiveServerException
org.apache.thrift.TException

fetchOne

public String fetchOne()
                throws HiveServerException,
                       org.apache.thrift.TException
Fetches the next row in a query result set.

Specified by:
fetchOne in interface ThriftHive.Iface
Returns:
the next row in a query result set. null if there is no more row to fetch.
Throws:
HiveServerException
org.apache.thrift.TException

fetchN

public List<String> fetchN(int numRows)
                    throws HiveServerException,
                           org.apache.thrift.TException
Fetches numRows rows.

Specified by:
fetchN in interface ThriftHive.Iface
Parameters:
numRows - Number of rows to fetch.
Returns:
A list of rows. The size of the list is numRows if there are at least numRows rows available to return. The size is smaller than numRows if there aren't enough rows. The list will be empty if there is no more row to fetch or numRows == 0.
Throws:
HiveServerException - Invalid value for numRows (numRows < 0)
org.apache.thrift.TException

fetchAll

public List<String> fetchAll()
                      throws HiveServerException,
                             org.apache.thrift.TException
Fetches all the rows in a result set.

Specified by:
fetchAll in interface ThriftHive.Iface
Returns:
All the rows in a result set of a query executed using execute method. TODO: Currently the server buffers all the rows before returning them to the client. Decide whether the buffering should be done in the client.
Throws:
HiveServerException
org.apache.thrift.TException

getStatus

public com.facebook.fb303.fb_status getStatus()
Return the status of the server.

Specified by:
getStatus in interface com.facebook.fb303.FacebookService.Iface
Overrides:
getStatus in class HiveMetaStore.HMSHandler

getVersion

public String getVersion()
Return the version of the server software.

Specified by:
getVersion in interface com.facebook.fb303.FacebookService.Iface
Overrides:
getVersion in class HiveMetaStore.HMSHandler

getQueryPlan

public QueryPlan getQueryPlan()
                       throws HiveServerException,
                              org.apache.thrift.TException
Specified by:
getQueryPlan in interface ThriftHive.Iface
Throws:
HiveServerException
org.apache.thrift.TException


Copyright © 2013 The Apache Software Foundation