diff --git metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java index 7fd99d8..feb2b68 100644 --- metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java +++ metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java @@ -18,6 +18,8 @@ package org.apache.hadoop.hive.metastore; +import static org.apache.hadoop.hive.metastore.MetaStoreUtils.DEFAULT_DATABASE_NAME; + import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; @@ -386,6 +388,13 @@ public class HiveMetaStoreClient implements IMetaStoreClient { dropTable(dbname, name, true, true); } + /** {@inheritDoc} */ + @Deprecated + public void dropTable(String tableName, boolean deleteData) + throws MetaException, UnknownTableException, TException, NoSuchObjectException { + dropTable(DEFAULT_DATABASE_NAME, tableName, deleteData, false); + } + /** * @param dbname * @param name @@ -463,12 +472,7 @@ public class HiveMetaStoreClient implements IMetaStoreClient { return result; } - /** - * @return the list of databases - * @throws MetaException - * @throws TException - * @see org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore.Iface#get_databases() - */ + /** {@inheritDoc} */ public List getDatabases(String databasePattern) throws MetaException { try { @@ -479,12 +483,7 @@ public class HiveMetaStoreClient implements IMetaStoreClient { return null; } - /** - * @return the list of databases - * @throws MetaException - * @throws TException - * @see org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore.Iface#get_all_databases() - */ + /** {@inheritDoc} */ public List getAllDatabases() throws MetaException { try { return client.get_all_databases(); @@ -561,6 +560,13 @@ public class HiveMetaStoreClient implements IMetaStoreClient { return deepCopy(client.get_table(dbname, name)); } + /** {@inheritDoc} */ + @Deprecated + public Table getTable(String tableName) throws MetaException, TException, + NoSuchObjectException { + return getTable(DEFAULT_DATABASE_NAME, tableName); + } + /** * @param name * @return the type @@ -573,6 +579,7 @@ public class HiveMetaStoreClient implements IMetaStoreClient { return deepCopy(client.get_type(name)); } + /** {@inheritDoc} */ public List getTables(String dbname, String tablePattern) throws MetaException { try { return client.get_tables(dbname, tablePattern); @@ -582,6 +589,7 @@ public class HiveMetaStoreClient implements IMetaStoreClient { return null; } + /** {@inheritDoc} */ public List getAllTables(String dbname) throws MetaException { try { return client.get_all_tables(dbname); @@ -601,6 +609,13 @@ public class HiveMetaStoreClient implements IMetaStoreClient { return true; } + /** {@inheritDoc} */ + @Deprecated + public boolean tableExists(String tableName) throws MetaException, + TException, UnknownDBException { + return tableExists(DEFAULT_DATABASE_NAME, tableName); + } + public List listPartitionNames(String dbName, String tblName, short max) throws MetaException, TException { return client.get_partition_names(dbName, tblName, max); diff --git metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java index 20deb21..1bf4293 100644 --- metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java +++ metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java @@ -44,15 +44,46 @@ public interface IMetaStoreClient { public void close(); + /** + * Get the names of all databases in the MetaStore that match the given pattern. + * @param databasePattern + * @return List of database names. + * @throws MetaException + * @throws TException + */ public List getDatabases(String databasePattern) throws MetaException, TException; + /** + * Get the names of all databases in the MetaStore. + * @return List of database names. + * @throws MetaException + * @throws TException + */ public List getAllDatabases() throws MetaException, TException; + /** + * Get the names of all tables in the specified database that satisfy the supplied + * table name pattern. + * @param dbName + * @param tablePattern + * @return List of table names. + * @throws MetaException + * @throws TException + * @throws UnknownDBException + */ public List getTables(String dbName, String tablePattern) throws MetaException, TException, UnknownDBException; + /** + * Get the names of all tables in the specified database. + * @param dbName + * @return List of table names. + * @throws MetaException + * @throws TException + * @throws UnknownDBException + */ public List getAllTables(String dbName) throws MetaException, TException, UnknownDBException; @@ -76,17 +107,70 @@ public interface IMetaStoreClient { boolean ignoreUknownTab) throws MetaException, TException, NoSuchObjectException; + /** + * Drop the table in the DEFAULT database. + * + * @param tableName + * The table to drop + * @param deleteData + * Should we delete the underlying data + * @throws MetaException + * Could not drop table properly. + * @throws UnknownTableException + * The table wasn't found. + * @throws TException + * A thrift communication error occurred + * @throws NoSuchObjectException + * The table wasn't found. + * + * @deprecated As of release 0.6.0 replaced by {@link #dropTable(String, String, boolean, boolean)}. + * This method will be removed in release 0.7.0. + */ + @Deprecated + public void dropTable(String tableName, boolean deleteData) + throws MetaException, UnknownTableException, TException, + NoSuchObjectException; + public void dropTable(String dbname, String tableName) throws MetaException, TException, NoSuchObjectException; - // public void createTable(String tableName, Properties schema) throws - // MetaException, UnknownTableException, - // TException; - public boolean tableExists(String databaseName, String tableName) throws MetaException, TException, UnknownDBException; /** + * Check to see if the specified table exists in the DEFAULT database. + * @param tableName + * @return TRUE if DEFAULT.tableName exists, FALSE otherwise. + * @throws MetaException + * @throws TException + * @throws UnknownDBException + * @deprecated As of release 0.6.0 replaced by {@link #tableExists(String, String)}. + * This method will be removed in release 0.7.0. + */ + @Deprecated + public boolean tableExists(String tableName) throws MetaException, + TException, UnknownDBException; + + /** + * Get a table object from the DEFAULT database. + * + * @param tableName + * Name of the table to fetch. + * @return An object representing the table. + * @throws MetaException + * Could not fetch the table + * @throws TException + * A thrift communication error occurred + * @throws NoSuchObjectException + * In case the table wasn't found. + * @deprecated As of release 0.6.0 replaced by {@link #getTable(String, String)}. + * This method will be removed in release 0.7.0. + */ + @Deprecated + public Table getTable(String tableName) throws MetaException, TException, + NoSuchObjectException; + + /** * Get a Database Object * @param databaseName name of the database to fetch * @return