org.apache.hadoop.hive.metastore
Class HiveMetaStoreClient

java.lang.Object
  extended by org.apache.hadoop.hive.metastore.HiveMetaStoreClient
All Implemented Interfaces:
IMetaStoreClient

public class HiveMetaStoreClient
extends Object
implements IMetaStoreClient

Hive Metastore Client.


Constructor Summary
HiveMetaStoreClient(HiveConf conf)
           
HiveMetaStoreClient(HiveConf conf, HiveMetaHookLoader hookLoader)
           
 
Method Summary
 Partition add_partition(Partition new_part)
          Add a partition to the table.
 int add_partitions(List<Partition> new_parts)
          Add partitions to the table.
 void alter_index(String dbname, String base_tbl_name, String idx_name, Index new_idx)
           
 void alter_partition(String dbName, String tblName, Partition newPart)
          updates a partition to new partition
 void alter_table(String dbname, String tbl_name, Table new_tbl)
           
 void alterDatabase(String dbName, Database db)
           
 Partition appendPartition(String db_name, String table_name, List<String> part_vals)
           
 Partition appendPartition(String dbName, String tableName, String partName)
           
 Partition appendPartitionByName(String dbName, String tableName, String partName)
           
 void cancelDelegationToken(String tokenStrForm)
           
 void close()
           
 boolean create_role(Role role)
           
 void createDatabase(Database db)
          Create a new Database
 void createIndex(Index index, Table indexTable)
          create an index
 void createTable(Table tbl)
           
 boolean createType(Type type)
           
 boolean drop_role(String roleName)
           
 void dropDatabase(String name)
           
 void dropDatabase(String name, boolean deleteData, boolean ignoreUnknownDb)
           
 void dropDatabase(String name, boolean deleteData, boolean ignoreUnknownDb, boolean cascade)
           
 boolean dropIndex(String dbName, String tblName, String name, boolean deleteData)
           
 boolean dropPartition(String db_name, String tbl_name, List<String> part_vals)
           
 boolean dropPartition(String db_name, String tbl_name, List<String> part_vals, boolean deleteData)
           
 boolean dropPartition(String dbName, String tableName, String partName, boolean deleteData)
           
 boolean dropPartitionByName(String dbName, String tableName, String partName, boolean deleteData)
           
 void dropTable(String tableName, boolean deleteData)
          Deprecated. 
 void dropTable(String dbname, String name)
           
 void dropTable(String dbname, String name, boolean deleteData, boolean ignoreUknownTab)
          Drop the table.
 boolean dropType(String type)
           
 PrincipalPrivilegeSet get_privilege_set(HiveObjectRef hiveObject, String userName, List<String> groupNames)
           
 List<String> getAllDatabases()
          Get the names of all databases in the MetaStore.
 List<String> getAllTables(String dbname)
          Get the names of all tables in the specified database.
 String getConfigValue(String name, String defaultValue)
           
 Database getDatabase(String name)
          Get a Database Object
 List<String> getDatabases(String databasePattern)
          Get the names of all databases in the MetaStore that match the given pattern.
 String getDelegationToken(String renewerKerberosPrincipalName)
           
 String getDelegationToken(String owner, String renewerKerberosPrincipalName)
           
 List<FieldSchema> getFields(String db, String tableName)
           
 Index getIndex(String dbName, String tblName, String indexName)
           
 Partition getPartition(String db_name, String tbl_name, List<String> part_vals)
           
 Partition getPartition(String db, String tableName, String partName)
           
 List<Partition> getPartitionsByNames(String db_name, String tbl_name, List<String> part_names)
          Get partitions by a list of partition names.
 Partition getPartitionWithAuthInfo(String db_name, String tbl_name, List<String> part_vals, String user_name, List<String> group_names)
           
 List<FieldSchema> getSchema(String db, String tableName)
           
 Table getTable(String tableName)
          Deprecated. 
 Table getTable(String dbname, String name)
          Get a table object.
 List<Table> getTableObjectsByName(String dbName, List<String> tableNames)
          
 List<String> getTables(String dbname, String tablePattern)
          Get the names of all tables in the specified database that satisfy the supplied table name pattern.
 String getTokenStrForm()
           
 Type getType(String name)
           
 Map<String,Type> getTypeAll(String name)
           
 boolean grant_privileges(PrivilegeBag privileges)
           
 boolean grant_role(String roleName, String userName, PrincipalType principalType, String grantor, PrincipalType grantorType, boolean grantOption)
           
 boolean isPartitionMarkedForEvent(String db_name, String tbl_name, Map<String,String> partKVs, PartitionEventType eventType)
           
 List<HiveObjectPrivilege> list_privileges(String principalName, PrincipalType principalType, HiveObjectRef hiveObject)
           
 List<Role> list_roles(String principalName, PrincipalType principalType)
           
 List<Index> listIndexes(String dbName, String tblName, short max)
          list all the index names of the give base table.
 List<String> listIndexNames(String dbName, String tblName, short max)
          list indexes of the give base table
 List<String> listPartitionNames(String db_name, String tbl_name, List<String> part_vals, short max_parts)
           
 List<String> listPartitionNames(String dbName, String tblName, short max)
           
 List<Partition> listPartitions(String db_name, String tbl_name, List<String> part_vals, short max_parts)
           
 List<Partition> listPartitions(String db_name, String tbl_name, short max_parts)
           
 List<Partition> listPartitionsByFilter(String db_name, String tbl_name, String filter, short max_parts)
          Get list of partitions matching specified filter
 List<Partition> listPartitionsWithAuthInfo(String db_name, String tbl_name, List<String> part_vals, short max_parts, String user_name, List<String> group_names)
           
 List<Partition> listPartitionsWithAuthInfo(String db_name, String tbl_name, short max_parts, String user_name, List<String> group_names)
           
 List<String> listRoleNames()
          list all role names
 List<String> listTableNamesByFilter(String dbName, String filter, short maxTables)
          Get a list of table names that match a filter.
 void markPartitionForEvent(String db_name, String tbl_name, Map<String,String> partKVs, PartitionEventType eventType)
           
static IMetaStoreClient newSynchronizedClient(IMetaStoreClient client)
          Creates a synchronized wrapper for any IMetaStoreClient.
 Map<String,String> partitionNameToSpec(String name)
           
 List<String> partitionNameToVals(String name)
           
 void renamePartition(String dbname, String name, List<String> part_vals, Partition newPart)
          rename a partition to a new partition
 long renewDelegationToken(String tokenStrForm)
           
 boolean revoke_privileges(PrivilegeBag privileges)
           
 boolean revoke_role(String roleName, String userName, PrincipalType principalType)
           
 boolean tableExists(String tableName)
          Deprecated. 
 boolean tableExists(String databaseName, String tableName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HiveMetaStoreClient

public HiveMetaStoreClient(HiveConf conf)
                    throws MetaException
Throws:
MetaException

HiveMetaStoreClient

public HiveMetaStoreClient(HiveConf conf,
                           HiveMetaHookLoader hookLoader)
                    throws MetaException
Throws:
MetaException
Method Detail

alter_table

public void alter_table(String dbname,
                        String tbl_name,
                        Table new_tbl)
                 throws InvalidOperationException,
                        MetaException,
                        org.apache.thrift.TException
Specified by:
alter_table in interface IMetaStoreClient
Parameters:
dbname -
tbl_name -
new_tbl -
Throws:
InvalidOperationException
MetaException
org.apache.thrift.TException
See Also:
ThriftHiveMetastore.Iface.alter_table( java.lang.String, java.lang.String, org.apache.hadoop.hive.metastore.api.Table)

renamePartition

public void renamePartition(String dbname,
                            String name,
                            List<String> part_vals,
                            Partition newPart)
                     throws InvalidOperationException,
                            MetaException,
                            org.apache.thrift.TException
Description copied from interface: IMetaStoreClient
rename a partition to a new partition

Specified by:
renamePartition in interface IMetaStoreClient
Parameters:
dbname -
name -
part_vals -
newPart -
Throws:
InvalidOperationException
MetaException
org.apache.thrift.TException
See Also:
ThriftHiveMetastore.Iface.rename_partition( java.lang.String, java.lang.String, java.util.List, org.apache.hadoop.hive.metastore.api.Partition)

getTokenStrForm

public String getTokenStrForm()
                       throws IOException
Throws:
IOException

close

public void close()
Specified by:
close in interface IMetaStoreClient

add_partition

public Partition add_partition(Partition new_part)
                        throws InvalidObjectException,
                               AlreadyExistsException,
                               MetaException,
                               org.apache.thrift.TException
Description copied from interface: IMetaStoreClient
Add a partition to the table.

Specified by:
add_partition in interface IMetaStoreClient
Parameters:
new_part -
Returns:
the added partition
Throws:
InvalidObjectException
AlreadyExistsException
MetaException
org.apache.thrift.TException
See Also:
ThriftHiveMetastore.Iface.add_partition(org.apache.hadoop.hive.metastore.api.Partition)

add_partitions

public int add_partitions(List<Partition> new_parts)
                   throws InvalidObjectException,
                          AlreadyExistsException,
                          MetaException,
                          org.apache.thrift.TException
Description copied from interface: IMetaStoreClient
Add partitions to the table.

Specified by:
add_partitions in interface IMetaStoreClient
Parameters:
new_parts -
Throws:
InvalidObjectException
AlreadyExistsException
MetaException
org.apache.thrift.TException
See Also:
ThriftHiveMetastore.Iface.add_partitions(List)

appendPartition

public Partition appendPartition(String db_name,
                                 String table_name,
                                 List<String> part_vals)
                          throws InvalidObjectException,
                                 AlreadyExistsException,
                                 MetaException,
                                 org.apache.thrift.TException
Specified by:
appendPartition in interface IMetaStoreClient
Parameters:
table_name -
db_name -
part_vals -
Returns:
the appended partition
Throws:
InvalidObjectException
AlreadyExistsException
MetaException
org.apache.thrift.TException
See Also:
ThriftHiveMetastore.Iface.append_partition(java.lang.String, java.lang.String, java.util.List)

appendPartition

public Partition appendPartition(String dbName,
                                 String tableName,
                                 String partName)
                          throws InvalidObjectException,
                                 AlreadyExistsException,
                                 MetaException,
                                 org.apache.thrift.TException
Specified by:
appendPartition in interface IMetaStoreClient
Throws:
InvalidObjectException
AlreadyExistsException
MetaException
org.apache.thrift.TException

createDatabase

public void createDatabase(Database db)
                    throws AlreadyExistsException,
                           InvalidObjectException,
                           MetaException,
                           org.apache.thrift.TException
Create a new Database

Specified by:
createDatabase in interface IMetaStoreClient
Parameters:
db -
Throws:
AlreadyExistsException
InvalidObjectException
MetaException
org.apache.thrift.TException
See Also:
ThriftHiveMetastore.Iface.create_database(Database)

createTable

public void createTable(Table tbl)
                 throws AlreadyExistsException,
                        InvalidObjectException,
                        MetaException,
                        NoSuchObjectException,
                        org.apache.thrift.TException
Specified by:
createTable in interface IMetaStoreClient
Parameters:
tbl -
Throws:
MetaException
NoSuchObjectException
org.apache.thrift.TException
AlreadyExistsException
InvalidObjectException
See Also:
ThriftHiveMetastore.Iface.create_table(org.apache.hadoop.hive.metastore.api.Table)

createType

public boolean createType(Type type)
                   throws AlreadyExistsException,
                          InvalidObjectException,
                          MetaException,
                          org.apache.thrift.TException
Parameters:
type -
Returns:
true or false
Throws:
AlreadyExistsException
InvalidObjectException
MetaException
org.apache.thrift.TException
See Also:
ThriftHiveMetastore.Iface.create_type(org.apache.hadoop.hive.metastore.api.Type)

dropDatabase

public void dropDatabase(String name)
                  throws NoSuchObjectException,
                         InvalidOperationException,
                         MetaException,
                         org.apache.thrift.TException
Specified by:
dropDatabase in interface IMetaStoreClient
Parameters:
name -
Throws:
NoSuchObjectException
InvalidOperationException
MetaException
org.apache.thrift.TException
See Also:
ThriftHiveMetastore.Iface.drop_database(java.lang.String, boolean, boolean)

dropDatabase

public void dropDatabase(String name,
                         boolean deleteData,
                         boolean ignoreUnknownDb)
                  throws NoSuchObjectException,
                         InvalidOperationException,
                         MetaException,
                         org.apache.thrift.TException
Specified by:
dropDatabase in interface IMetaStoreClient
Throws:
NoSuchObjectException
InvalidOperationException
MetaException
org.apache.thrift.TException

dropDatabase

public void dropDatabase(String name,
                         boolean deleteData,
                         boolean ignoreUnknownDb,
                         boolean cascade)
                  throws NoSuchObjectException,
                         InvalidOperationException,
                         MetaException,
                         org.apache.thrift.TException
Specified by:
dropDatabase in interface IMetaStoreClient
Throws:
NoSuchObjectException
InvalidOperationException
MetaException
org.apache.thrift.TException

dropPartition

public boolean dropPartition(String db_name,
                             String tbl_name,
                             List<String> part_vals)
                      throws NoSuchObjectException,
                             MetaException,
                             org.apache.thrift.TException
Parameters:
tbl_name -
db_name -
part_vals -
Returns:
true or false
Throws:
NoSuchObjectException
MetaException
org.apache.thrift.TException
See Also:
ThriftHiveMetastore.Iface.drop_partition(java.lang.String, java.lang.String, java.util.List, boolean)

dropPartition

public boolean dropPartition(String dbName,
                             String tableName,
                             String partName,
                             boolean deleteData)
                      throws NoSuchObjectException,
                             MetaException,
                             org.apache.thrift.TException
Specified by:
dropPartition in interface IMetaStoreClient
Throws:
NoSuchObjectException
MetaException
org.apache.thrift.TException

dropPartition

public boolean dropPartition(String db_name,
                             String tbl_name,
                             List<String> part_vals,
                             boolean deleteData)
                      throws NoSuchObjectException,
                             MetaException,
                             org.apache.thrift.TException
Specified by:
dropPartition in interface IMetaStoreClient
Parameters:
db_name -
tbl_name -
part_vals -
deleteData - delete the underlying data or just delete the table in metadata
Returns:
true or false
Throws:
NoSuchObjectException
MetaException
org.apache.thrift.TException
See Also:
ThriftHiveMetastore.Iface.drop_partition(java.lang.String, java.lang.String, java.util.List, boolean)

dropTable

public void dropTable(String dbname,
                      String name)
               throws NoSuchObjectException,
                      MetaException,
                      org.apache.thrift.TException
Specified by:
dropTable in interface IMetaStoreClient
Parameters:
name -
dbname -
Throws:
NoSuchObjectException
ExistingDependentsException
MetaException
org.apache.thrift.TException
See Also:
ThriftHiveMetastore.Iface.drop_table(java.lang.String, java.lang.String, boolean)

dropTable

@Deprecated
public void dropTable(String tableName,
                                 boolean deleteData)
               throws MetaException,
                      UnknownTableException,
                      org.apache.thrift.TException,
                      NoSuchObjectException
Deprecated. 

Drop the table in the DEFAULT database.

Specified by:
dropTable in interface IMetaStoreClient
Parameters:
tableName - The table to drop
deleteData - Should we delete the underlying data
Throws:
MetaException - Could not drop table properly.
UnknownTableException - The table wasn't found.
org.apache.thrift.TException - A thrift communication error occurred
NoSuchObjectException - The table wasn't found.

dropTable

public void dropTable(String dbname,
                      String name,
                      boolean deleteData,
                      boolean ignoreUknownTab)
               throws MetaException,
                      org.apache.thrift.TException,
                      NoSuchObjectException
Description copied from interface: IMetaStoreClient
Drop the table.

Specified by:
dropTable in interface IMetaStoreClient
Parameters:
dbname -
name -
deleteData - delete the underlying data or just delete the table in metadata
Throws:
NoSuchObjectException
ExistingDependentsException
MetaException
org.apache.thrift.TException
See Also:
ThriftHiveMetastore.Iface.drop_table(java.lang.String, java.lang.String, boolean)

dropType

public boolean dropType(String type)
                 throws NoSuchObjectException,
                        MetaException,
                        org.apache.thrift.TException
Parameters:
type -
Returns:
true if the type is dropped
Throws:
MetaException
org.apache.thrift.TException
NoSuchObjectException
See Also:
ThriftHiveMetastore.Iface.drop_type(java.lang.String)

getTypeAll

public Map<String,Type> getTypeAll(String name)
                            throws MetaException,
                                   org.apache.thrift.TException
Parameters:
name -
Returns:
map of types
Throws:
MetaException
org.apache.thrift.TException
See Also:
ThriftHiveMetastore.Iface.get_type_all(java.lang.String)

getDatabases

public List<String> getDatabases(String databasePattern)
                          throws MetaException
Get the names of all databases in the MetaStore that match the given pattern.

Specified by:
getDatabases in interface IMetaStoreClient
Returns:
List of database names.
Throws:
MetaException

getAllDatabases

public List<String> getAllDatabases()
                             throws MetaException
Get the names of all databases in the MetaStore.

Specified by:
getAllDatabases in interface IMetaStoreClient
Returns:
List of database names.
Throws:
MetaException

listPartitions

public List<Partition> listPartitions(String db_name,
                                      String tbl_name,
                                      short max_parts)
                               throws NoSuchObjectException,
                                      MetaException,
                                      org.apache.thrift.TException
Specified by:
listPartitions in interface IMetaStoreClient
Parameters:
tbl_name -
db_name -
max_parts -
Returns:
list of partitions
Throws:
NoSuchObjectException
MetaException
org.apache.thrift.TException

listPartitions

public List<Partition> listPartitions(String db_name,
                                      String tbl_name,
                                      List<String> part_vals,
                                      short max_parts)
                               throws NoSuchObjectException,
                                      MetaException,
                                      org.apache.thrift.TException
Specified by:
listPartitions in interface IMetaStoreClient
Throws:
NoSuchObjectException
MetaException
org.apache.thrift.TException

listPartitionsWithAuthInfo

public List<Partition> listPartitionsWithAuthInfo(String db_name,
                                                  String tbl_name,
                                                  short max_parts,
                                                  String user_name,
                                                  List<String> group_names)
                                           throws NoSuchObjectException,
                                                  MetaException,
                                                  org.apache.thrift.TException
Specified by:
listPartitionsWithAuthInfo in interface IMetaStoreClient
Returns:
the list of partitions
Throws:
NoSuchObjectException
MetaException
org.apache.thrift.TException

listPartitionsWithAuthInfo

public List<Partition> listPartitionsWithAuthInfo(String db_name,
                                                  String tbl_name,
                                                  List<String> part_vals,
                                                  short max_parts,
                                                  String user_name,
                                                  List<String> group_names)
                                           throws NoSuchObjectException,
                                                  MetaException,
                                                  org.apache.thrift.TException
Specified by:
listPartitionsWithAuthInfo in interface IMetaStoreClient
Returns:
the list of paritions
Throws:
NoSuchObjectException
MetaException
org.apache.thrift.TException

listPartitionsByFilter

public List<Partition> listPartitionsByFilter(String db_name,
                                              String tbl_name,
                                              String filter,
                                              short max_parts)
                                       throws MetaException,
                                              NoSuchObjectException,
                                              org.apache.thrift.TException
Get list of partitions matching specified filter

Specified by:
listPartitionsByFilter in interface IMetaStoreClient
Parameters:
db_name - the database name
tbl_name - the table name
filter - the filter string, for example "part1 = \"p1_abc\" and part2 <= "\p2_test\"". Filtering can be done only on string partition keys.
max_parts - the maximum number of partitions to return, all partitions are returned if -1 is passed
Returns:
list of partitions
Throws:
MetaException
NoSuchObjectException
org.apache.thrift.TException

getDatabase

public Database getDatabase(String name)
                     throws NoSuchObjectException,
                            MetaException,
                            org.apache.thrift.TException
Description copied from interface: IMetaStoreClient
Get a Database Object

Specified by:
getDatabase in interface IMetaStoreClient
Parameters:
name -
Returns:
the database
Throws:
NoSuchObjectException
MetaException
org.apache.thrift.TException
See Also:
ThriftHiveMetastore.Iface.get_database(java.lang.String)

getPartition

public Partition getPartition(String db_name,
                              String tbl_name,
                              List<String> part_vals)
                       throws NoSuchObjectException,
                              MetaException,
                              org.apache.thrift.TException
Specified by:
getPartition in interface IMetaStoreClient
Parameters:
tbl_name -
db_name -
part_vals -
Returns:
the partition
Throws:
MetaException
org.apache.thrift.TException
NoSuchObjectException
See Also:
ThriftHiveMetastore.Iface.get_partition(java.lang.String, java.lang.String, java.util.List)

getPartitionsByNames

public List<Partition> getPartitionsByNames(String db_name,
                                            String tbl_name,
                                            List<String> part_names)
                                     throws NoSuchObjectException,
                                            MetaException,
                                            org.apache.thrift.TException
Description copied from interface: IMetaStoreClient
Get partitions by a list of partition names.

Specified by:
getPartitionsByNames in interface IMetaStoreClient
Parameters:
db_name - database name
tbl_name - table name
part_names - list of partition names
Returns:
list of Partition objects
Throws:
NoSuchObjectException
MetaException
org.apache.thrift.TException

getPartitionWithAuthInfo

public Partition getPartitionWithAuthInfo(String db_name,
                                          String tbl_name,
                                          List<String> part_vals,
                                          String user_name,
                                          List<String> group_names)
                                   throws MetaException,
                                          UnknownTableException,
                                          NoSuchObjectException,
                                          org.apache.thrift.TException
Specified by:
getPartitionWithAuthInfo in interface IMetaStoreClient
Returns:
the partition
Throws:
MetaException
UnknownTableException
NoSuchObjectException
org.apache.thrift.TException

getTable

public Table getTable(String dbname,
                      String name)
               throws MetaException,
                      org.apache.thrift.TException,
                      NoSuchObjectException
Description copied from interface: IMetaStoreClient
Get a table object.

Specified by:
getTable in interface IMetaStoreClient
Parameters:
name -
dbname -
Returns:
the table
Throws:
NoSuchObjectException
MetaException
org.apache.thrift.TException
NoSuchObjectException
See Also:
ThriftHiveMetastore.Iface.get_table(java.lang.String, java.lang.String)

getTable

@Deprecated
public Table getTable(String tableName)
               throws MetaException,
                      org.apache.thrift.TException,
                      NoSuchObjectException
Deprecated. 

Get a table object from the DEFAULT database.

Specified by:
getTable in interface IMetaStoreClient
Parameters:
tableName - Name of the table to fetch.
Returns:
An object representing the table.
Throws:
MetaException - Could not fetch the table
org.apache.thrift.TException - A thrift communication error occurred
NoSuchObjectException - In case the table wasn't found.

getTableObjectsByName

public List<Table> getTableObjectsByName(String dbName,
                                         List<String> tableNames)
                                  throws MetaException,
                                         InvalidOperationException,
                                         UnknownDBException,
                                         org.apache.thrift.TException

Specified by:
getTableObjectsByName in interface IMetaStoreClient
Parameters:
dbName - The database the tables are located in.
tableNames - The names of the tables to fetch
Returns:
A list of objects representing the tables. Only the tables that can be retrieved from the database are returned. For example, if none of the requested tables could be retrieved, an empty list is returned. There is no guarantee of ordering of the returned tables.
Throws:
MetaException - Any other errors
InvalidOperationException - The input to this operation is invalid (e.g., the list of tables names is null)
UnknownDBException - The requested database could not be fetched.
org.apache.thrift.TException - A thrift communication error occurred

listTableNamesByFilter

public List<String> listTableNamesByFilter(String dbName,
                                           String filter,
                                           short maxTables)
                                    throws MetaException,
                                           org.apache.thrift.TException,
                                           InvalidOperationException,
                                           UnknownDBException
Get a list of table names that match a filter. The filter operators are LIKE, <, <=, >, >=, =, <> In the filter statement, values interpreted as strings must be enclosed in quotes, while values interpreted as integers should not be. Strings and integers are the only supported value types. The currently supported key names in the filter are: Constants.HIVE_FILTER_FIELD_OWNER, which filters on the tables' owner's name and supports all filter operators Constants.HIVE_FILTER_FIELD_LAST_ACCESS, which filters on the last access times and supports all filter operators except LIKE Constants.HIVE_FILTER_FIELD_PARAMS, which filters on the tables' parameter keys and values and only supports the filter operators = and <>. Append the parameter key name to HIVE_FILTER_FIELD_PARAMS in the filter statement. For example, to filter on parameter keys called "retention", the key name in the filter statement should be Constants.HIVE_FILTER_FIELD_PARAMS + "retention" Also, = and <> only work for keys that exist in the tables. E.g., filtering on tables where key1 <> value will only return tables that have a value for the parameter key1. Some example filter statements include: filter = Constants.HIVE_FILTER_FIELD_OWNER + " like \".*test.*\" and " + Constants.HIVE_FILTER_FIELD_LAST_ACCESS + " = 0"; filter = Constants.HIVE_FILTER_FIELD_OWNER + " = \"test_user\" and (" + Constants.HIVE_FILTER_FIELD_PARAMS + "retention = \"30\" or " + Constants.HIVE_FILTER_FIELD_PARAMS + "retention = \"90\")"

Specified by:
listTableNamesByFilter in interface IMetaStoreClient
Parameters:
dbName - The name of the database from which you will retrieve the table names
filter - The filter string
maxTables - The maximum number of tables returned
Returns:
A list of table names that match the desired filter
Throws:
MetaException
org.apache.thrift.TException
InvalidOperationException
UnknownDBException

getType

public Type getType(String name)
             throws NoSuchObjectException,
                    MetaException,
                    org.apache.thrift.TException
Parameters:
name -
Returns:
the type
Throws:
MetaException
org.apache.thrift.TException
NoSuchObjectException
See Also:
ThriftHiveMetastore.Iface.get_type(java.lang.String)

getTables

public List<String> getTables(String dbname,
                              String tablePattern)
                       throws MetaException
Get the names of all tables in the specified database that satisfy the supplied table name pattern.

Specified by:
getTables in interface IMetaStoreClient
Returns:
List of table names.
Throws:
MetaException

getAllTables

public List<String> getAllTables(String dbname)
                          throws MetaException
Get the names of all tables in the specified database.

Specified by:
getAllTables in interface IMetaStoreClient
Returns:
List of table names.
Throws:
MetaException

tableExists

public boolean tableExists(String databaseName,
                           String tableName)
                    throws MetaException,
                           org.apache.thrift.TException,
                           UnknownDBException
Specified by:
tableExists in interface IMetaStoreClient
Throws:
MetaException
org.apache.thrift.TException
UnknownDBException

tableExists

@Deprecated
public boolean tableExists(String tableName)
                    throws MetaException,
                           org.apache.thrift.TException,
                           UnknownDBException
Deprecated. 

Check to see if the specified table exists in the DEFAULT database.

Specified by:
tableExists in interface IMetaStoreClient
Returns:
TRUE if DEFAULT.tableName exists, FALSE otherwise.
Throws:
MetaException
org.apache.thrift.TException
UnknownDBException

listPartitionNames

public List<String> listPartitionNames(String dbName,
                                       String tblName,
                                       short max)
                                throws MetaException,
                                       org.apache.thrift.TException
Specified by:
listPartitionNames in interface IMetaStoreClient
Throws:
MetaException
org.apache.thrift.TException

listPartitionNames

public List<String> listPartitionNames(String db_name,
                                       String tbl_name,
                                       List<String> part_vals,
                                       short max_parts)
                                throws MetaException,
                                       org.apache.thrift.TException,
                                       NoSuchObjectException
Specified by:
listPartitionNames in interface IMetaStoreClient
Throws:
MetaException
org.apache.thrift.TException
NoSuchObjectException

alter_partition

public void alter_partition(String dbName,
                            String tblName,
                            Partition newPart)
                     throws InvalidOperationException,
                            MetaException,
                            org.apache.thrift.TException
Description copied from interface: IMetaStoreClient
updates a partition to new partition

Specified by:
alter_partition in interface IMetaStoreClient
Parameters:
dbName - database of the old partition
tblName - table name of the old partition
newPart - new partition
Throws:
InvalidOperationException - if the old partition does not exist
MetaException - if error in updating metadata
org.apache.thrift.TException - if error in communicating with metastore server

alterDatabase

public void alterDatabase(String dbName,
                          Database db)
                   throws MetaException,
                          NoSuchObjectException,
                          org.apache.thrift.TException
Specified by:
alterDatabase in interface IMetaStoreClient
Throws:
MetaException
NoSuchObjectException
org.apache.thrift.TException

getFields

public List<FieldSchema> getFields(String db,
                                   String tableName)
                            throws MetaException,
                                   org.apache.thrift.TException,
                                   UnknownTableException,
                                   UnknownDBException
Specified by:
getFields in interface IMetaStoreClient
Parameters:
db -
tableName -
Throws:
UnknownTableException
UnknownDBException
MetaException
org.apache.thrift.TException
See Also:
ThriftHiveMetastore.Iface.get_fields(java.lang.String, java.lang.String)

createIndex

public void createIndex(Index index,
                        Table indexTable)
                 throws AlreadyExistsException,
                        InvalidObjectException,
                        MetaException,
                        NoSuchObjectException,
                        org.apache.thrift.TException
create an index

Specified by:
createIndex in interface IMetaStoreClient
Parameters:
index - the index object
indexTable - which stores the index data
Throws:
InvalidObjectException
MetaException
NoSuchObjectException
org.apache.thrift.TException
AlreadyExistsException

alter_index

public void alter_index(String dbname,
                        String base_tbl_name,
                        String idx_name,
                        Index new_idx)
                 throws InvalidOperationException,
                        MetaException,
                        org.apache.thrift.TException
Specified by:
alter_index in interface IMetaStoreClient
Parameters:
dbname -
base_tbl_name -
idx_name -
new_idx -
Throws:
InvalidOperationException
MetaException
org.apache.thrift.TException
See Also:
ThriftHiveMetastore.Iface.alter_index(java.lang.String, java.lang.String, java.lang.String, org.apache.hadoop.hive.metastore.api.Index)

getIndex

public Index getIndex(String dbName,
                      String tblName,
                      String indexName)
               throws MetaException,
                      UnknownTableException,
                      NoSuchObjectException,
                      org.apache.thrift.TException
Specified by:
getIndex in interface IMetaStoreClient
Parameters:
dbName -
tblName -
indexName -
Returns:
the index
Throws:
MetaException
UnknownTableException
NoSuchObjectException
org.apache.thrift.TException

listIndexNames

public List<String> listIndexNames(String dbName,
                                   String tblName,
                                   short max)
                            throws MetaException,
                                   org.apache.thrift.TException
list indexes of the give base table

Specified by:
listIndexNames in interface IMetaStoreClient
Parameters:
dbName -
tblName -
max -
Returns:
the list of indexes
Throws:
NoSuchObjectException
MetaException
org.apache.thrift.TException

listIndexes

public List<Index> listIndexes(String dbName,
                               String tblName,
                               short max)
                        throws NoSuchObjectException,
                               MetaException,
                               org.apache.thrift.TException
list all the index names of the give base table.

Specified by:
listIndexes in interface IMetaStoreClient
Parameters:
dbName -
tblName -
max -
Returns:
list of indexes
Throws:
MetaException
org.apache.thrift.TException
NoSuchObjectException

getSchema

public List<FieldSchema> getSchema(String db,
                                   String tableName)
                            throws MetaException,
                                   org.apache.thrift.TException,
                                   UnknownTableException,
                                   UnknownDBException
Specified by:
getSchema in interface IMetaStoreClient
Parameters:
db -
tableName -
Throws:
UnknownTableException
UnknownDBException
MetaException
org.apache.thrift.TException
See Also:
ThriftHiveMetastore.Iface.get_schema(java.lang.String, java.lang.String)

getConfigValue

public String getConfigValue(String name,
                             String defaultValue)
                      throws org.apache.thrift.TException,
                             ConfigValSecurityException
Specified by:
getConfigValue in interface IMetaStoreClient
Parameters:
name - name of the configuration property to get the value of
defaultValue - the value to return if property with the given name doesn't exist
Returns:
value of the specified configuration property
Throws:
org.apache.thrift.TException
ConfigValSecurityException

getPartition

public Partition getPartition(String db,
                              String tableName,
                              String partName)
                       throws MetaException,
                              org.apache.thrift.TException,
                              UnknownTableException,
                              NoSuchObjectException
Specified by:
getPartition in interface IMetaStoreClient
partName - - partition name i.e. 'ds=2010-02-03/ts=2010-02-03 18%3A16%3A01'
Returns:
the partition object
Throws:
MetaException
org.apache.thrift.TException
UnknownTableException
NoSuchObjectException
See Also:
ThriftHiveMetastore.Iface.get_partition(java.lang.String, java.lang.String, java.util.List)

appendPartitionByName

public Partition appendPartitionByName(String dbName,
                                       String tableName,
                                       String partName)
                                throws InvalidObjectException,
                                       AlreadyExistsException,
                                       MetaException,
                                       org.apache.thrift.TException
Throws:
InvalidObjectException
AlreadyExistsException
MetaException
org.apache.thrift.TException

dropPartitionByName

public boolean dropPartitionByName(String dbName,
                                   String tableName,
                                   String partName,
                                   boolean deleteData)
                            throws NoSuchObjectException,
                                   MetaException,
                                   org.apache.thrift.TException
Throws:
NoSuchObjectException
MetaException
org.apache.thrift.TException

partitionNameToVals

public List<String> partitionNameToVals(String name)
                                 throws MetaException,
                                        org.apache.thrift.TException
Specified by:
partitionNameToVals in interface IMetaStoreClient
Parameters:
name - the partition name e.g. ("ds=2010-03-03/hr=12")
Returns:
a list containing the partition col values, in the same order as the name
Throws:
MetaException
org.apache.thrift.TException

partitionNameToSpec

public Map<String,String> partitionNameToSpec(String name)
                                       throws MetaException,
                                              org.apache.thrift.TException
Specified by:
partitionNameToSpec in interface IMetaStoreClient
Parameters:
name - the partition name e.g. ("ds=2010-03-03/hr=12")
Returns:
a map from the partition col to the value, as listed in the name
Throws:
MetaException
org.apache.thrift.TException

dropIndex

public boolean dropIndex(String dbName,
                         String tblName,
                         String name,
                         boolean deleteData)
                  throws NoSuchObjectException,
                         MetaException,
                         org.apache.thrift.TException
Specified by:
dropIndex in interface IMetaStoreClient
name - index name
Returns:
true on success
Throws:
NoSuchObjectException
MetaException
org.apache.thrift.TException

grant_role

public boolean grant_role(String roleName,
                          String userName,
                          PrincipalType principalType,
                          String grantor,
                          PrincipalType grantorType,
                          boolean grantOption)
                   throws MetaException,
                          org.apache.thrift.TException
Specified by:
grant_role in interface IMetaStoreClient
Returns:
true on success
Throws:
MetaException
org.apache.thrift.TException

create_role

public boolean create_role(Role role)
                    throws MetaException,
                           org.apache.thrift.TException
Specified by:
create_role in interface IMetaStoreClient
Parameters:
role - role object
Returns:
true on success
Throws:
MetaException
org.apache.thrift.TException

drop_role

public boolean drop_role(String roleName)
                  throws MetaException,
                         org.apache.thrift.TException
Specified by:
drop_role in interface IMetaStoreClient
Parameters:
roleName - role name
Returns:
true on success
Throws:
MetaException
org.apache.thrift.TException

list_roles

public List<Role> list_roles(String principalName,
                             PrincipalType principalType)
                      throws MetaException,
                             org.apache.thrift.TException
Specified by:
list_roles in interface IMetaStoreClient
Returns:
list of roles
Throws:
MetaException
org.apache.thrift.TException

listRoleNames

public List<String> listRoleNames()
                           throws MetaException,
                                  org.apache.thrift.TException
Description copied from interface: IMetaStoreClient
list all role names

Specified by:
listRoleNames in interface IMetaStoreClient
Returns:
list of names
Throws:
MetaException
org.apache.thrift.TException

grant_privileges

public boolean grant_privileges(PrivilegeBag privileges)
                         throws MetaException,
                                org.apache.thrift.TException
Specified by:
grant_privileges in interface IMetaStoreClient
Returns:
true on success
Throws:
MetaException
org.apache.thrift.TException

revoke_role

public boolean revoke_role(String roleName,
                           String userName,
                           PrincipalType principalType)
                    throws MetaException,
                           org.apache.thrift.TException
Specified by:
revoke_role in interface IMetaStoreClient
Parameters:
roleName - role name
userName - user name
Returns:
true on success
Throws:
MetaException
org.apache.thrift.TException

revoke_privileges

public boolean revoke_privileges(PrivilegeBag privileges)
                          throws MetaException,
                                 org.apache.thrift.TException
Specified by:
revoke_privileges in interface IMetaStoreClient
Returns:
true on success
Throws:
MetaException
org.apache.thrift.TException

get_privilege_set

public PrincipalPrivilegeSet get_privilege_set(HiveObjectRef hiveObject,
                                               String userName,
                                               List<String> groupNames)
                                        throws MetaException,
                                               org.apache.thrift.TException
Specified by:
get_privilege_set in interface IMetaStoreClient
Returns:
the privilege set
Throws:
MetaException
org.apache.thrift.TException

list_privileges

public List<HiveObjectPrivilege> list_privileges(String principalName,
                                                 PrincipalType principalType,
                                                 HiveObjectRef hiveObject)
                                          throws MetaException,
                                                 org.apache.thrift.TException
Specified by:
list_privileges in interface IMetaStoreClient
Returns:
list of privileges
Throws:
MetaException
org.apache.thrift.TException

getDelegationToken

public String getDelegationToken(String renewerKerberosPrincipalName)
                          throws MetaException,
                                 org.apache.thrift.TException,
                                 IOException
Throws:
MetaException
org.apache.thrift.TException
IOException

getDelegationToken

public String getDelegationToken(String owner,
                                 String renewerKerberosPrincipalName)
                          throws MetaException,
                                 org.apache.thrift.TException
Specified by:
getDelegationToken in interface IMetaStoreClient
Parameters:
owner - the intended owner for the token
Returns:
the string of the token
Throws:
MetaException
org.apache.thrift.TException

renewDelegationToken

public long renewDelegationToken(String tokenStrForm)
                          throws MetaException,
                                 org.apache.thrift.TException
Specified by:
renewDelegationToken in interface IMetaStoreClient
Returns:
the new expiration time
Throws:
MetaException
org.apache.thrift.TException

cancelDelegationToken

public void cancelDelegationToken(String tokenStrForm)
                           throws MetaException,
                                  org.apache.thrift.TException
Specified by:
cancelDelegationToken in interface IMetaStoreClient
Throws:
MetaException
org.apache.thrift.TException

newSynchronizedClient

public static IMetaStoreClient newSynchronizedClient(IMetaStoreClient client)
Creates a synchronized wrapper for any IMetaStoreClient. This may be used by multi-threaded applications until we have fixed all reentrancy bugs.

Parameters:
client - unsynchronized client
Returns:
synchronized client

markPartitionForEvent

public void markPartitionForEvent(String db_name,
                                  String tbl_name,
                                  Map<String,String> partKVs,
                                  PartitionEventType eventType)
                           throws MetaException,
                                  org.apache.thrift.TException,
                                  NoSuchObjectException,
                                  UnknownDBException,
                                  UnknownTableException,
                                  InvalidPartitionException,
                                  UnknownPartitionException
Specified by:
markPartitionForEvent in interface IMetaStoreClient
Throws:
MetaException
org.apache.thrift.TException
NoSuchObjectException
UnknownDBException
UnknownTableException
InvalidPartitionException
UnknownPartitionException

isPartitionMarkedForEvent

public boolean isPartitionMarkedForEvent(String db_name,
                                         String tbl_name,
                                         Map<String,String> partKVs,
                                         PartitionEventType eventType)
                                  throws MetaException,
                                         NoSuchObjectException,
                                         UnknownTableException,
                                         UnknownDBException,
                                         org.apache.thrift.TException,
                                         InvalidPartitionException,
                                         UnknownPartitionException
Specified by:
isPartitionMarkedForEvent in interface IMetaStoreClient
Throws:
MetaException
NoSuchObjectException
UnknownTableException
UnknownDBException
org.apache.thrift.TException
InvalidPartitionException
UnknownPartitionException


Copyright © 2011 The Apache Software Foundation