THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
The HCatClient is an abstract class containing all the APIs permitted HCatalog DDL commands. The implementation class will be provided as a configuration property, which will be used by the
"create" method. In this way, the implementation details will be masked to the users.
Code Block |
---|
/** * The abstract class HCatClient containing APIs for HCatalog DDL commands. */ public abstract class HCatClient { /** * Creates an instance of HCatClient. * * @param conf An instance of configuration. * @return An instance of HCatClient. */ public HCatClient create(Configuration conf){ // Obtain details of implementation class and return an instance. } /** * Gets the database like. * * @param regex The regular expression. Providing "*" would retrieve all the names * of the databases. * @return The list of all the database names. * @throws HCatException */ public abstract List<String> getDatabaseLike(String regex) throws HCatException; /** * Gets the database. * * @param dbName The name of the database. * @return An instance of HCatDatabaseInfo. * @throws HCatException */ public abstract HCatDatabase getDatabase(String dbName) throws HCatException; /** * Creates the database. * * @param dbInfo An instance of HCatCreateDBDesc. * @return true, if successful * @throws HCatException */ public abstract boolean createDatabase(HCatCreateDBDesc dbInfo) throws HCatException; /** * Deletes a database. * * @param dbName The name of the database to delete. * @param ifExists Hive returns an error if the database specified does not exist, * unless ifExists is set to true. * @param mode This is set to either "restrict" or "cascade". Restrict will * remove the schema if all the tables are empty. Cascade removes * everything including data and definitions. * @param userGroup The user group to use * @param permissions The permissions string to use. The format is "rwxrw-r-x". * @return true, if successful * @throws HCatException */ public abstract boolean deleteDatabase(String dbName, boolean ifExists, String mode, String userGroup, String permissions) throws HCatException; /** * Gets the tables like a pattern specified. * * @param dbName The name of the database. * @param regex The regular expression. Providing "*" would retrieve all the names * of the table. * @return A list of all table names matching the specified pattern. * @throws HCatException */ public abstract List<String> getTablesLike(String dbName, String regex) throws HCatException; /** * Gets the table. * * @param dbName The name of the database. * @param tableName The name of the table. * @return An instance of HCatTableInfo. * @throws HCatException */ public abstract HCatTable getTable(String dbName, String tableName) throws HCatException; /** * Creates the table. * * @param createTableDesc An instance of HCatCreateTableDesc class. * @return true, if successful. * @throws HCatException the h cat exception */ public abstract boolean createTable(HCatCreateTableDesc createTableDesc) throws HCatException; /** * Creates the table like an existing table. * * @param dbName The name of the database. * @param existingTblName The name of the existing table. * @param newTableName The name of the new table. * @param ifExists the if exists * @param isExternal Set to "true", if table has be created at a different * location other than default. * @param location The location for the table. * @return true, if successful * @throws HCatException */ public abstract boolean createTableLike(String dbName, String existingTblName, String newTableName, boolean ifExists, boolean isExternal, String location) throws HCatException; /** * Delete a table. * * @param dbName The name of the database. * @param tableName The name of the table. * @param ifExists Hive returns an error if the database specified does not exist, * unless ifExists is set to true. * @param userGroup The user group to use. * @param permissions The permissions string to use. The format is "rwxrw-r-x". * @return true, if successful * @throws HCatException */ public abstract boolean deleteTable(String dbName, String tableName, boolean ifExists, String userGroup, String permissions) throws HCatException; /** * Renames a table. * * @param dbName The name of the database. * @param oldName The name of the table to be renamed. * @param newName The new name of the table. * @param userGroup The user group to use. * @param permissions The permissions string to use. The format is "rwxrw-r-x". * @return true, if successful * @throws HCatException */ public abstract boolean renameTable(String dbName, String oldName, String newName, String userGroup, String permissions) throws HCatException; /** * Gets all the partitions. * * @param dbName The name of the database. * @param tblName The name of the table. * @return A list of partition names. * @throws HCatException the h cat exception */ public abstract List<HCatPartition> getPartitions(String dbName, String tblName) throws HCatException; /** * Gets the partition. * * @param dbName The database name. * @param tableName The table name. * @param partitionName The partition name, Comma separated list of col_name='value'. * @return An instance of HCatPartitionInfo. * @throws HCatException */ public abstract HCatPartition getPartition(String dbName, String tableName, String partitionName) throws HCatException; /** * Adds the partition. * * @param partInfo An instance of HCatAddPartitionDesc. * @return true, if successful * @throws HCatException the h cat exception */ public abstract boolean addPartition(HCatAddPartitionDesc partInfo) throws HCatException; /** * Deletes partition. * * @param dbName The database name. * @param tableName The table name. * @param partitionName The partition name, Comma separated list of col_name='value'. * @param ifExists Hive returns an error if the partition specified does not exist, unless ifExists is set to true. * @param userGroup The user group to use. * @param permissions The permissions string to use. The format is "rwxrw-r-x". * @return true, if successful * @throws HCatException */ public abstract boolean deletePartition(String dbName, String tableName, String partitionName, boolean ifExists, String userGroup, String permissions) throws HCatException; /** * List partitions by filter. * * @param dbName The database name. * @param tblName The table name. * @param filter The filter string, * for example "part1 = \"p1_abc\" and part2 <= "\p2_test\"". Filtering can * be done only on string partition keys. * @return list of partitions * @throws HCatException the h cat exception */ public abstract List<HCatPartition> listPartitionsByFilter(String dbName, String tblName, String filter) throws HCatException; /** * Mark partition for event. * * @param dbName The database name. * @param tblName The table name. * @param partKVs the part k vs * @param eventType the event type * @throws HCatException the h cat exception */ public abstract void markPartitionForEvent(String dbName, String tblName, Map<String, String> partKVs, PartitionEventType eventType) throws HCatException; /** * Checks if is partition marked for event. * * @param dbName the db name * @param tblName the tbl name * @param partKVs the part k vs * @param eventType the event type * @return true, if is partition marked for event * @throws HCatException the h cat exception */ public abstract boolean isPartitionMarkedForEvent(String dbName, String tblName, Map<String, String> partKVs, PartitionEventType eventType) throws HCatException; /** * Gets the delegation token. * * @param owner the owner * @param renewerKerberosPrincipalName the renewer kerberos principal name * @return the delegation token * @throws HCatException the h cat exception */ public abstract String getDelegationToken(String owner, String renewerKerberosPrincipalName) throws HCatException; /** * Renew delegation token. * * @param tokenStrForm the token str form * @return the long * @throws HCatException the h cat exception */ public abstract long renewDelegationToken(String tokenStrForm) throws HCatException; /** * Cancel delegation token. * * @param tokenStrForm the token str form * @throws HCatException the h cat exception */ public abstract void cancelDelegationToken(String tokenStrForm) throws HCatException; } |
...