org.apache.hadoop.hive.metastore
Class MetaStoreClient

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

public class MetaStoreClient
extends Object
implements IMetaStoreClient

TODO Unnecessary when the server sides for both dbstore and filestore are merged


Field Summary
static org.apache.commons.logging.Log LOG
           
 
Constructor Summary
MetaStoreClient(org.apache.hadoop.conf.Configuration configuration)
           
 
Method Summary
 Partition add_partition(Partition partition)
          Add a partition to the table.
 void alter_table(String defaultDatabaseName, String tblName, Table table)
           
 Partition appendPartition(String dbName, String tableName, List<String> partVals)
           
 void close()
           
 boolean createDatabase(String name, String location_uri)
           
 void createTable(String tableName, Properties schema)
           
 void createTable(Table tbl)
           
 boolean dropDatabase(String name)
           
 boolean dropPartition(String db_name, String tbl_name, List<String> part_vals, boolean deleteData)
           
 void dropTable(String tableName, boolean deleteData)
          Drop the table.
 void dropTable(String dbname, String name, boolean deleteData, boolean ignoreUknownTab)
          This operation is unsupported in this metastore.
 List<FieldSchema> get_fields(String tableName)
           
 Partition getPartition(String dbName, String tableName, List<String> partVals)
           
 Properties getSchema(String tableName)
           
 Table getTable(String tableName)
          Get a table object.
 Table getTable(String dbName, String tableName)
          This operation is unsupported in this metastore.
 List<String> getTables(String dbName, String tablePattern)
           
 List<String> listPartitionNames(String db_name, String tbl_name, short max_parts)
           
 List<Partition> listPartitions(String dbName, String tableName, short max_parts)
           
 void open(URI store)
           
 boolean tableExists(String tableName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

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

MetaStoreClient

public MetaStoreClient(org.apache.hadoop.conf.Configuration configuration)
                throws MetaException
Throws:
MetaException
Method Detail

open

public void open(URI store)
          throws com.facebook.thrift.TException
Throws:
com.facebook.thrift.TException

close

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

getTables

public List<String> getTables(String dbName,
                              String tablePattern)
                       throws MetaException,
                              UnknownTableException,
                              com.facebook.thrift.TException,
                              UnknownDBException
Specified by:
getTables in interface IMetaStoreClient
Throws:
MetaException
UnknownTableException
com.facebook.thrift.TException
UnknownDBException

dropTable

public void dropTable(String tableName,
                      boolean deleteData)
               throws MetaException,
                      UnknownTableException,
                      com.facebook.thrift.TException
Description copied from interface: IMetaStoreClient
Drop the table.

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.
com.facebook.thrift.TException - A thrift communication error occurred

createTable

public void createTable(String tableName,
                        Properties schema)
                 throws MetaException,
                        UnknownTableException,
                        com.facebook.thrift.TException
Throws:
MetaException
UnknownTableException
com.facebook.thrift.TException

getSchema

public Properties getSchema(String tableName)
                     throws MetaException,
                            com.facebook.thrift.TException,
                            NoSuchObjectException
Throws:
MetaException
com.facebook.thrift.TException
NoSuchObjectException

tableExists

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

get_fields

public List<FieldSchema> get_fields(String tableName)
                             throws MetaException,
                                    UnknownTableException,
                                    com.facebook.thrift.TException
Throws:
MetaException
UnknownTableException
com.facebook.thrift.TException

getTable

public Table getTable(String tableName)
               throws MetaException,
                      com.facebook.thrift.TException,
                      NoSuchObjectException
Description copied from interface: IMetaStoreClient
Get a table object.

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
com.facebook.thrift.TException - A thrift communication error occurred
NoSuchObjectException - In case the table wasn't found.

getTable

public Table getTable(String dbName,
                      String tableName)
               throws MetaException,
                      com.facebook.thrift.TException,
                      NoSuchObjectException
This operation is unsupported in this metastore.

Specified by:
getTable in interface IMetaStoreClient
Parameters:
dbName - The database the table is located in.
tableName - Name of the table to fetch.
Returns:
An object representing the table.
Throws:
MetaException - Could not fetch the table
com.facebook.thrift.TException - A thrift communication error occurred
NoSuchObjectException - In case the table wasn't found.
See Also:
getTable(String)

listPartitions

public List<Partition> listPartitions(String dbName,
                                      String tableName,
                                      short max_parts)
                               throws NoSuchObjectException,
                                      MetaException,
                                      com.facebook.thrift.TException
Specified by:
listPartitions in interface IMetaStoreClient
Returns:
the list of partitions
Throws:
NoSuchObjectException
MetaException
com.facebook.thrift.TException

getPartition

public Partition getPartition(String dbName,
                              String tableName,
                              List<String> partVals)
                       throws MetaException,
                              com.facebook.thrift.TException
Specified by:
getPartition in interface IMetaStoreClient
Returns:
the partition object
Throws:
MetaException
com.facebook.thrift.TException
See Also:
ThriftHiveMetastore.Iface.get_partition(java.lang.String, java.lang.String, java.util.List)

createTable

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

appendPartition

public Partition appendPartition(String dbName,
                                 String tableName,
                                 List<String> partVals)
                          throws InvalidObjectException,
                                 AlreadyExistsException,
                                 MetaException,
                                 com.facebook.thrift.TException
Specified by:
appendPartition in interface IMetaStoreClient
Returns:
the partition object
Throws:
InvalidObjectException
AlreadyExistsException
MetaException
com.facebook.thrift.TException
See Also:
ThriftHiveMetastore.Iface.append_partition(java.lang.String, java.lang.String, java.util.List)

alter_table

public void alter_table(String defaultDatabaseName,
                        String tblName,
                        Table table)
                 throws InvalidOperationException,
                        MetaException,
                        com.facebook.thrift.TException
Specified by:
alter_table in interface IMetaStoreClient
Throws:
InvalidOperationException
MetaException
com.facebook.thrift.TException

createDatabase

public boolean createDatabase(String name,
                              String location_uri)
                       throws AlreadyExistsException,
                              MetaException,
                              com.facebook.thrift.TException
Specified by:
createDatabase in interface IMetaStoreClient
Throws:
AlreadyExistsException
MetaException
com.facebook.thrift.TException

dropDatabase

public boolean dropDatabase(String name)
                     throws MetaException,
                            com.facebook.thrift.TException
Specified by:
dropDatabase in interface IMetaStoreClient
Throws:
MetaException
com.facebook.thrift.TException

listPartitionNames

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

dropPartition

public boolean dropPartition(String db_name,
                             String tbl_name,
                             List<String> part_vals,
                             boolean deleteData)
                      throws NoSuchObjectException,
                             MetaException,
                             com.facebook.thrift.TException
Specified by:
dropPartition in interface IMetaStoreClient
deleteData - delete the underlying data or just delete the table in metadata
Returns:
true or false
Throws:
NoSuchObjectException
MetaException
com.facebook.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,
                      boolean deleteData,
                      boolean ignoreUknownTab)
               throws ExistingDependentsException,
                      MetaException,
                      com.facebook.thrift.TException,
                      NoSuchObjectException
This operation is unsupported in this metastore.

Specified by:
dropTable in interface IMetaStoreClient
Parameters:
dbname - The database for this table
name - The table to drop
Throws:
ExistingDependentsException
MetaException - Could not drop table properly.
com.facebook.thrift.TException - A thrift communication error occurred
NoSuchObjectException - The table wasn't found.
See Also:
IMetaStoreClient.dropTable(String, String, boolean, boolean)

add_partition

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

Specified by:
add_partition in interface IMetaStoreClient
Parameters:
partition - The partition to add
Returns:
The partition added
Throws:
InvalidObjectException - Could not find table to add to
AlreadyExistsException - Partition already exists
MetaException - Could not add partition
com.facebook.thrift.TException - Thrift exception


Copyright © 2009 The Apache Software Foundation