public abstract class HCatClient
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
HCatClient.DropDBMode |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
HCAT_CLIENT_IMPL_CLASS |
Constructor and Description |
---|
HCatClient() |
Modifier and Type | Method and Description |
---|---|
abstract void |
addPartition(HCatAddPartitionDesc partInfo)
Adds the partition.
|
abstract int |
addPartitions(java.util.List<HCatAddPartitionDesc> partInfoList)
Adds a list of partitions.
|
abstract void |
cancelDelegationToken(java.lang.String tokenStrForm)
Cancel delegation token.
|
abstract void |
close()
Close the hcatalog client.
|
static HCatClient |
create(Configuration conf)
Creates an instance of HCatClient.
|
abstract void |
createDatabase(HCatCreateDBDesc dbInfo)
Creates the database.
|
abstract void |
createTable(HCatCreateTableDesc createTableDesc)
Creates the table.
|
abstract 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.
|
abstract void |
dropDatabase(java.lang.String dbName,
boolean ifExists,
HCatClient.DropDBMode mode)
Drops a database.
|
abstract 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.
|
abstract void |
dropTable(java.lang.String dbName,
java.lang.String tableName,
boolean ifExists)
Drop table.
|
abstract HCatDatabase |
getDatabase(java.lang.String dbName)
Gets the database.
|
abstract java.lang.String |
getDelegationToken(java.lang.String owner,
java.lang.String renewerKerberosPrincipalName)
Gets the delegation token.
|
abstract java.lang.String |
getMessageBusTopicName(java.lang.String dbName,
java.lang.String tableName)
Retrieve Message-bus topic for a table.
|
abstract HCatPartition |
getPartition(java.lang.String dbName,
java.lang.String tableName,
java.util.Map<java.lang.String,java.lang.String> partitionSpec)
Gets the partition.
|
abstract java.util.List<HCatPartition> |
getPartitions(java.lang.String dbName,
java.lang.String tblName)
Gets all the partitions.
|
abstract 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.
|
abstract HCatTable |
getTable(java.lang.String dbName,
java.lang.String tableName)
Gets the table.
|
abstract 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.
|
abstract java.util.List<java.lang.String> |
listDatabaseNamesByPattern(java.lang.String pattern)
Get all existing databases that match the given
pattern.
|
abstract java.util.List<HCatPartition> |
listPartitionsByFilter(java.lang.String dbName,
java.lang.String tblName,
java.lang.String filter)
List partitions by filter.
|
abstract 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.
|
abstract 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.
|
abstract void |
renameTable(java.lang.String dbName,
java.lang.String oldName,
java.lang.String newName)
Renames a table.
|
abstract long |
renewDelegationToken(java.lang.String tokenStrForm)
Renew delegation token.
|
abstract 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.
|
public static final java.lang.String HCAT_CLIENT_IMPL_CLASS
public static HCatClient create(Configuration conf) throws HCatException
conf
- An instance of configuration.HCatException
public abstract java.util.List<java.lang.String> listDatabaseNamesByPattern(java.lang.String pattern) throws HCatException
pattern
- java re patternHCatException
public abstract HCatDatabase getDatabase(java.lang.String dbName) throws HCatException
dbName
- The name of the database.HCatException
public abstract void createDatabase(HCatCreateDBDesc dbInfo) throws HCatException
dbInfo
- An instance of HCatCreateDBDesc.HCatException
public abstract void dropDatabase(java.lang.String dbName, boolean ifExists, HCatClient.DropDBMode mode) throws HCatException
dbName
- 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.HCatException
public abstract java.util.List<java.lang.String> listTableNamesByPattern(java.lang.String dbName, java.lang.String tablePattern) throws HCatException
dbName
- The name of the DB (to be searched)tablePattern
- The regex for the table-nameHCatException
public abstract HCatTable getTable(java.lang.String dbName, java.lang.String tableName) throws HCatException
dbName
- The name of the database.tableName
- The name of the table.HCatException
public abstract void createTable(HCatCreateTableDesc createTableDesc) throws HCatException
createTableDesc
- An instance of HCatCreateTableDesc class.HCatException
public abstract void updateTableSchema(java.lang.String dbName, java.lang.String tableName, java.util.List<HCatFieldSchema> columnSchema) throws HCatException
dbName
- The name of the database.tableName
- The name of the table.columnSchema
- The (new) definition of the column schema (i.e. list of fields).HCatException
public abstract void createTableLike(java.lang.String dbName, java.lang.String existingTblName, java.lang.String newTableName, boolean ifNotExists, boolean isExternal, java.lang.String location) throws HCatException
dbName
- 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.HCatException
public abstract void dropTable(java.lang.String dbName, java.lang.String tableName, boolean ifExists) throws HCatException
dbName
- 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.HCatException
public abstract void renameTable(java.lang.String dbName, java.lang.String oldName, java.lang.String newName) throws HCatException
dbName
- The name of the database.oldName
- The name of the table to be renamed.newName
- The new name of the table.HCatException
public abstract java.util.List<HCatPartition> getPartitions(java.lang.String dbName, java.lang.String tblName) throws HCatException
dbName
- The name of the database.tblName
- The name of the table.HCatException
public abstract 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
dbName
- The name of the database.tblName
- The name of the table.partitionSpec
- The partition specification. (Need not include all partition keys.)HCatException
public abstract HCatPartition getPartition(java.lang.String dbName, java.lang.String tableName, java.util.Map<java.lang.String,java.lang.String> partitionSpec) throws HCatException
dbName
- The database name.tableName
- The table name.partitionSpec
- The partition specification, {[col_name,value],[col_name2,value2]}. All partition-key-values
must be specified.HCatException
public abstract void addPartition(HCatAddPartitionDesc partInfo) throws HCatException
partInfo
- An instance of HCatAddPartitionDesc.HCatException
public abstract int addPartitions(java.util.List<HCatAddPartitionDesc> partInfoList) throws HCatException
partInfoList
- A list of HCatAddPartitionDesc.HCatException
public abstract void dropPartitions(java.lang.String dbName, java.lang.String tableName, java.util.Map<java.lang.String,java.lang.String> partitionSpec, boolean ifExists) throws HCatException
dbName
- 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.HCatException,ConnectionFailureException
HCatException
public abstract java.util.List<HCatPartition> listPartitionsByFilter(java.lang.String dbName, java.lang.String tblName, java.lang.String filter) throws HCatException
dbName
- 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.HCatException
public abstract void markPartitionForEvent(java.lang.String dbName, java.lang.String tblName, java.util.Map<java.lang.String,java.lang.String> partKVs, PartitionEventType eventType) throws HCatException
dbName
- The database name.tblName
- The table name.partKVs
- the key-values associated with the partition.eventType
- the event typeHCatException
public abstract boolean isPartitionMarkedForEvent(java.lang.String dbName, java.lang.String tblName, java.util.Map<java.lang.String,java.lang.String> partKVs, PartitionEventType eventType) throws HCatException
dbName
- the db nametblName
- the table namepartKVs
- the key-values associated with the partition.eventType
- the event typeHCatException
public abstract java.lang.String getDelegationToken(java.lang.String owner, java.lang.String renewerKerberosPrincipalName) throws HCatException
owner
- the ownerrenewerKerberosPrincipalName
- the renewer kerberos principal nameHCatException,ConnectionFailureException
HCatException
public abstract long renewDelegationToken(java.lang.String tokenStrForm) throws HCatException
tokenStrForm
- the token stringHCatException
public abstract void cancelDelegationToken(java.lang.String tokenStrForm) throws HCatException
tokenStrForm
- the token stringHCatException
public abstract java.lang.String getMessageBusTopicName(java.lang.String dbName, java.lang.String tableName) throws HCatException
dbName
- The name of the DB.tableName
- The name of the table.HCatException
public abstract void close() throws HCatException
HCatException
Copyright © 2012 The Apache Software Foundation