public class HCatClientHMSImpl extends HCatClient
HCatClient.DropDBModeHCAT_CLIENT_IMPL_CLASS| Constructor and Description |
|---|
HCatClientHMSImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addPartition(HCatAddPartitionDesc partInfo)
Adds the partition.
|
int |
addPartitions(java.util.List<HCatAddPartitionDesc> partInfoList)
Adds a list of partitions.
|
void |
cancelDelegationToken(java.lang.String tokenStrForm)
Cancel delegation token.
|
void |
close()
Close the hcatalog client.
|
void |
createDatabase(HCatCreateDBDesc dbInfo)
Creates the database.
|
void |
createTable(HCatCreateTableDesc createTableDesc)
Creates the table.
|
void |
createTableLike(java.lang.String dbName,
java.lang.String existingTblName,
java.lang.String newTableName,
boolean ifNotExists,
boolean isExternal,
java.lang.String location)
Creates the table like an existing table.
|
void |
dropDatabase(java.lang.String dbName,
boolean ifExists,
HCatClient.DropDBMode mode)
Drops a database.
|
void |
dropPartitions(java.lang.String dbName,
java.lang.String tableName,
java.util.Map<java.lang.String,java.lang.String> partitionSpec,
boolean ifExists)
Drops partition(s) that match the specified (and possibly partial) partition specification.
|
void |
dropTable(java.lang.String dbName,
java.lang.String tableName,
boolean ifExists)
Drop table.
|
HCatDatabase |
getDatabase(java.lang.String dbName)
Gets the database.
|
java.lang.String |
getDelegationToken(java.lang.String owner,
java.lang.String renewerKerberosPrincipalName)
Gets the delegation token.
|
java.lang.String |
getMessageBusTopicName(java.lang.String dbName,
java.lang.String tableName)
Retrieve Message-bus topic for a table.
|
HCatPartition |
getPartition(java.lang.String dbName,
java.lang.String tableName,
java.util.Map<java.lang.String,java.lang.String> partitionSpec)
Gets the partition.
|
java.util.List<HCatPartition> |
getPartitions(java.lang.String dbName,
java.lang.String tblName)
Gets all the partitions.
|
java.util.List<HCatPartition> |
getPartitions(java.lang.String dbName,
java.lang.String tblName,
java.util.Map<java.lang.String,java.lang.String> partitionSpec)
Gets all the partitions that match the specified (and possibly partial) partition specification.
|
HCatTable |
getTable(java.lang.String dbName,
java.lang.String tableName)
Gets the table.
|
boolean |
isPartitionMarkedForEvent(java.lang.String dbName,
java.lang.String tblName,
java.util.Map<java.lang.String,java.lang.String> partKVs,
PartitionEventType eventType)
Checks if a partition is marked for event.
|
java.util.List<java.lang.String> |
listDatabaseNamesByPattern(java.lang.String pattern)
Get all existing databases that match the given
pattern.
|
java.util.List<HCatPartition> |
listPartitionsByFilter(java.lang.String dbName,
java.lang.String tblName,
java.lang.String filter)
List partitions by filter.
|
java.util.List<java.lang.String> |
listTableNamesByPattern(java.lang.String dbName,
java.lang.String tablePattern)
Returns all existing tables from the specified database which match the given
pattern.
|
void |
markPartitionForEvent(java.lang.String dbName,
java.lang.String tblName,
java.util.Map<java.lang.String,java.lang.String> partKVs,
PartitionEventType eventType)
Mark partition for event.
|
void |
renameTable(java.lang.String dbName,
java.lang.String oldName,
java.lang.String newName)
Renames a table.
|
long |
renewDelegationToken(java.lang.String tokenStrForm)
Renew delegation token.
|
void |
updateTableSchema(java.lang.String dbName,
java.lang.String tableName,
java.util.List<HCatFieldSchema> columnSchema)
Updates the Table's column schema to the specified definition.
|
createpublic java.util.List<java.lang.String> listDatabaseNamesByPattern(java.lang.String pattern)
throws HCatException
HCatClientlistDatabaseNamesByPattern in class HCatClientpattern - java re patternHCatExceptionpublic HCatDatabase getDatabase(java.lang.String dbName) throws HCatException
HCatClientgetDatabase in class HCatClientdbName - The name of the database.HCatExceptionpublic void createDatabase(HCatCreateDBDesc dbInfo) throws HCatException
HCatClientcreateDatabase in class HCatClientdbInfo - An instance of HCatCreateDBDesc.HCatExceptionpublic void dropDatabase(java.lang.String dbName,
boolean ifExists,
HCatClient.DropDBMode mode)
throws HCatException
HCatClientdropDatabase in class HCatClientdbName - The name of the database to delete.ifExists - Hive returns an error if the database specified does not exist,
unless ifExists is set to true.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.HCatExceptionpublic java.util.List<java.lang.String> listTableNamesByPattern(java.lang.String dbName,
java.lang.String tablePattern)
throws HCatException
HCatClientlistTableNamesByPattern in class HCatClientdbName - The name of the DB (to be searched)tablePattern - The regex for the table-nameHCatExceptionpublic HCatTable getTable(java.lang.String dbName, java.lang.String tableName) throws HCatException
HCatClientgetTable in class HCatClientdbName - The name of the database.tableName - The name of the table.HCatExceptionpublic void createTable(HCatCreateTableDesc createTableDesc) throws HCatException
HCatClientcreateTable in class HCatClientcreateTableDesc - An instance of HCatCreateTableDesc class.HCatExceptionpublic void updateTableSchema(java.lang.String dbName,
java.lang.String tableName,
java.util.List<HCatFieldSchema> columnSchema)
throws HCatException
HCatClientupdateTableSchema in class HCatClientdbName - The name of the database.tableName - The name of the table.columnSchema - The (new) definition of the column schema (i.e. list of fields).HCatExceptionpublic void createTableLike(java.lang.String dbName,
java.lang.String existingTblName,
java.lang.String newTableName,
boolean ifNotExists,
boolean isExternal,
java.lang.String location)
throws HCatException
HCatClientcreateTableLike in class HCatClientdbName - The name of the database.existingTblName - The name of the existing table.newTableName - The name of the new table.ifNotExists - If true, then error related to already table existing is skipped.isExternal - Set to "true", if table has be created at a different
location other than default.location - The location for the table.HCatExceptionpublic void dropTable(java.lang.String dbName,
java.lang.String tableName,
boolean ifExists)
throws HCatException
HCatClientdropTable in class HCatClientdbName - The name of the database.tableName - The name of the table.ifExists - Hive returns an error if the database specified does not exist,
unless ifExists is set to true.HCatExceptionpublic void renameTable(java.lang.String dbName,
java.lang.String oldName,
java.lang.String newName)
throws HCatException
HCatClientrenameTable in class HCatClientdbName - The name of the database.oldName - The name of the table to be renamed.newName - The new name of the table.HCatExceptionpublic java.util.List<HCatPartition> getPartitions(java.lang.String dbName, java.lang.String tblName) throws HCatException
HCatClientgetPartitions in class HCatClientdbName - The name of the database.tblName - The name of the table.HCatExceptionpublic java.util.List<HCatPartition> getPartitions(java.lang.String dbName, java.lang.String tblName, java.util.Map<java.lang.String,java.lang.String> partitionSpec) throws HCatException
HCatClientgetPartitions in class HCatClientdbName - The name of the database.tblName - The name of the table.partitionSpec - The partition specification. (Need not include all partition keys.)HCatExceptionpublic HCatPartition getPartition(java.lang.String dbName, java.lang.String tableName, java.util.Map<java.lang.String,java.lang.String> partitionSpec) throws HCatException
HCatClientgetPartition in class HCatClientdbName - The database name.tableName - The table name.partitionSpec - The partition specification, {[col_name,value],[col_name2,value2]}. All partition-key-values
must be specified.HCatExceptionpublic void addPartition(HCatAddPartitionDesc partInfo) throws HCatException
HCatClientaddPartition in class HCatClientpartInfo - An instance of HCatAddPartitionDesc.HCatExceptionpublic void dropPartitions(java.lang.String dbName,
java.lang.String tableName,
java.util.Map<java.lang.String,java.lang.String> partitionSpec,
boolean ifExists)
throws HCatException
HCatClientdropPartitions in class HCatClientdbName - The database name.tableName - The table name.partitionSpec - The partition specification, {[col_name,value],[col_name2,value2]}.ifExists - Hive returns an error if the partition specified does not exist, unless ifExists is set to true.HCatExceptionpublic java.util.List<HCatPartition> listPartitionsByFilter(java.lang.String dbName, java.lang.String tblName, java.lang.String filter) throws HCatException
HCatClientlistPartitionsByFilter in class HCatClientdbName - The database name.tblName - 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.HCatExceptionpublic void markPartitionForEvent(java.lang.String dbName,
java.lang.String tblName,
java.util.Map<java.lang.String,java.lang.String> partKVs,
PartitionEventType eventType)
throws HCatException
HCatClientmarkPartitionForEvent in class HCatClientdbName - The database name.tblName - The table name.partKVs - the key-values associated with the partition.eventType - the event typeHCatExceptionpublic boolean isPartitionMarkedForEvent(java.lang.String dbName,
java.lang.String tblName,
java.util.Map<java.lang.String,java.lang.String> partKVs,
PartitionEventType eventType)
throws HCatException
HCatClientisPartitionMarkedForEvent in class HCatClientdbName - the db nametblName - the table namepartKVs - the key-values associated with the partition.eventType - the event typeHCatExceptionpublic java.lang.String getDelegationToken(java.lang.String owner,
java.lang.String renewerKerberosPrincipalName)
throws HCatException
HCatClientgetDelegationToken in class HCatClientowner - the ownerrenewerKerberosPrincipalName - the renewer kerberos principal nameHCatExceptionpublic long renewDelegationToken(java.lang.String tokenStrForm)
throws HCatException
HCatClientrenewDelegationToken in class HCatClienttokenStrForm - the token stringHCatExceptionpublic void cancelDelegationToken(java.lang.String tokenStrForm)
throws HCatException
HCatClientcancelDelegationToken in class HCatClienttokenStrForm - the token stringHCatExceptionpublic void close()
throws HCatException
HCatClientclose in class HCatClientHCatExceptionpublic int addPartitions(java.util.List<HCatAddPartitionDesc> partInfoList) throws HCatException
HCatClientaddPartitions in class HCatClientpartInfoList - A list of HCatAddPartitionDesc.HCatExceptionpublic java.lang.String getMessageBusTopicName(java.lang.String dbName,
java.lang.String tableName)
throws HCatException
HCatClientgetMessageBusTopicName in class HCatClientdbName - The name of the DB.tableName - The name of the table.HCatExceptionCopyright © 2012 The Apache Software Foundation