@InterfaceAudience.Public @InterfaceStability.Stable public abstract class HCatClient extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
HCatClient.DropDBMode |
| Modifier and Type | Field and Description |
|---|---|
static 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(List<HCatAddPartitionDesc> partInfoList)
Adds a list of partitions.
|
abstract int |
addPartitionSpec(HCatPartitionSpec partitionSpec)
Adds partitions using HCatPartitionSpec.
|
abstract void |
cancelDelegationToken(String tokenStrForm)
Cancel delegation token.
|
abstract void |
close()
Close the hcatalog client.
|
static HCatClient |
create(org.apache.hadoop.conf.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(String dbName,
String existingTblName,
String newTableName,
boolean ifNotExists,
boolean isExternal,
String location)
Creates the table like an existing table.
|
abstract HCatPartition |
deserializePartition(String hcatPartitionStringRep)
Deserializer for an HCatPartition.
|
abstract List<HCatPartition> |
deserializePartitions(List<String> hcatPartitionStringReps)
Deserializer for a list of HCatPartition strings.
|
abstract HCatPartitionSpec |
deserializePartitionSpec(List<String> hcatPartitionSpecStrings)
Deserializer for HCatPartitionSpec.
|
abstract HCatTable |
deserializeTable(String hcatTableStringRep)
Deserializer for HCatTable.
|
abstract void |
dropDatabase(String dbName,
boolean ifExists,
HCatClient.DropDBMode mode)
Drops a database.
|
abstract void |
dropPartitions(String dbName,
String tableName,
Map<String,String> partitionSpec,
boolean ifExists)
Drops partition(s) that match the specified (and possibly partial) partition specification.
|
abstract void |
dropPartitions(String dbName,
String tableName,
Map<String,String> partitionSpec,
boolean ifExists,
boolean deleteData)
Drops partition(s) that match the specified (and possibly partial) partition specification.
|
abstract void |
dropTable(String dbName,
String tableName,
boolean ifExists)
Drop table.
|
abstract String |
getConfVal(String key,
String defaultVal)
Fetch configuration value on conf that the HCatClient is instantiated
against.
|
abstract long |
getCurrentNotificationEventId()
Get the most recently used notification id.
|
abstract HCatDatabase |
getDatabase(String dbName)
Gets the database.
|
abstract String |
getDelegationToken(String owner,
String renewerKerberosPrincipalName)
Gets the delegation token.
|
abstract String |
getMessageBusTopicName(String dbName,
String tableName)
Retrieve Message-bus topic for a table.
|
abstract List<HCatNotificationEvent> |
getNextNotification(long lastEventId,
int maxEvents,
IMetaStoreClient.NotificationFilter filter)
Get a list of notifications
|
abstract HCatPartition |
getPartition(String dbName,
String tableName,
Map<String,String> partitionSpec)
Gets the partition.
|
abstract List<HCatPartition> |
getPartitions(String dbName,
String tblName)
Gets all the partitions.
|
abstract List<HCatPartition> |
getPartitions(String dbName,
String tblName,
Map<String,String> partitionSpec)
Gets all the partitions that match the specified (and possibly partial) partition specification.
|
abstract HCatPartitionSpec |
getPartitionSpecs(String dbName,
String tableName,
int maxPartitions)
Gets partitions in terms of generic HCatPartitionSpec instances.
|
abstract HCatPartitionSpec |
getPartitionSpecs(String dbName,
String tableName,
Map<String,String> partitionSelector,
int maxPartitions)
Gets partitions in terms of generic HCatPartitionSpec instances.
|
abstract Iterator<ReplicationTask> |
getReplicationTasks(long lastEventId,
int maxEvents,
String dbName,
String tableName)
Get an iterator that iterates over a list of replication tasks needed to replicate all the
events that have taken place for a given db/table.
|
abstract HCatTable |
getTable(String dbName,
String tableName)
Gets the table.
|
abstract boolean |
isPartitionMarkedForEvent(String dbName,
String tblName,
Map<String,String> partKVs,
org.apache.hadoop.hive.metastore.api.PartitionEventType eventType)
Checks if a partition is marked for event.
|
abstract List<String> |
listDatabaseNamesByPattern(String pattern)
Get all existing databases that match the given
pattern.
|
abstract List<HCatPartition> |
listPartitionsByFilter(String dbName,
String tblName,
String filter)
List partitions by filter.
|
abstract HCatPartitionSpec |
listPartitionSpecsByFilter(String dbName,
String tblName,
String filter,
int maxPartitions)
List partitions by filter, but as HCatPartitionSpecs.
|
abstract List<String> |
listTableNamesByPattern(String dbName,
String tablePattern)
Returns all existing tables from the specified database which match the given
pattern.
|
abstract void |
markPartitionForEvent(String dbName,
String tblName,
Map<String,String> partKVs,
org.apache.hadoop.hive.metastore.api.PartitionEventType eventType)
Mark partition for event.
|
abstract void |
renameTable(String dbName,
String oldName,
String newName)
Renames a table.
|
abstract long |
renewDelegationToken(String tokenStrForm)
Renew delegation token.
|
abstract String |
serializePartition(HCatPartition hcatPartition)
Serializer for HCatPartition.
|
abstract List<String> |
serializePartitions(List<HCatPartition> hcatPartitions)
Serializer for a list of HCatPartition.
|
abstract List<String> |
serializePartitionSpec(HCatPartitionSpec partitionSpec)
Serializer for HCatPartitionSpec.
|
abstract String |
serializeTable(HCatTable hcatTable)
Serializer for HCatTable.
|
abstract void |
updateTableSchema(String dbName,
String tableName,
HCatTable newTableDefinition)
Updates the Table's whole schema (including column schema, I/O Formats, SerDe definitions, etc.)
|
abstract void |
updateTableSchema(String dbName,
String tableName,
List<HCatFieldSchema> columnSchema)
Updates the Table's column schema to the specified definition.
|
public static final String HCAT_CLIENT_IMPL_CLASS
public static HCatClient create(org.apache.hadoop.conf.Configuration conf) throws HCatException
conf - An instance of configuration.HCatExceptionpublic abstract String getConfVal(String key, String defaultVal)
key - keyname to look updefaultVal - default value to furnish in case the key does not existpublic abstract List<String> listDatabaseNamesByPattern(String pattern) throws HCatException
pattern - java re patternHCatExceptionpublic abstract HCatDatabase getDatabase(String dbName) throws HCatException
dbName - The name of the database.HCatExceptionpublic abstract void createDatabase(HCatCreateDBDesc dbInfo) throws HCatException
dbInfo - An instance of HCatCreateDBDesc.HCatExceptionpublic abstract void dropDatabase(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.HCatExceptionpublic abstract List<String> listTableNamesByPattern(String dbName, String tablePattern) throws HCatException
dbName - The name of the DB (to be searched)tablePattern - The regex for the table-nameHCatExceptionpublic abstract HCatTable getTable(String dbName, String tableName) throws HCatException
dbName - The name of the database.tableName - The name of the table.HCatExceptionpublic abstract void createTable(HCatCreateTableDesc createTableDesc) throws HCatException
createTableDesc - An instance of HCatCreateTableDesc class.HCatExceptionpublic abstract void updateTableSchema(String dbName, String tableName, 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).HCatExceptionpublic abstract void updateTableSchema(String dbName, String tableName, HCatTable newTableDefinition) throws HCatException
dbName - The name of the database.tableName - The name of the table.newTableDefinition - The (new) definition of the table.HCatExceptionpublic abstract String serializeTable(HCatTable hcatTable) throws HCatException
hcatTable - The HCatTable to be serialized into string formHCatException, - on failure to serialize.HCatExceptionpublic abstract HCatTable deserializeTable(String hcatTableStringRep) throws HCatException
hcatTableStringRep - The String representation of an HCatTable, presumably retrieved from serializeTable(HCatTable)HCatExceptionpublic abstract String serializePartition(HCatPartition hcatPartition) throws HCatException
hcatPartition - The HCatPartition instance to be serialized.HCatException, - on failure to serialize.HCatExceptionpublic abstract List<String> serializePartitions(List<HCatPartition> hcatPartitions) throws HCatException
hcatPartitions - The HCatPartitions to be serialized.HCatException, - on failure to serialize.HCatExceptionpublic abstract HCatPartition deserializePartition(String hcatPartitionStringRep) throws HCatException
hcatPartitionStringRep - The String representation of the HCatPartition, presumably retrieved from serializePartition(HCatPartition)HCatException, - on failure to deserialze.HCatExceptionpublic abstract List<HCatPartition> deserializePartitions(List<String> hcatPartitionStringReps) throws HCatException
hcatPartitionStringReps - The list of HCatPartition strings to be deserialized.HCatException, - on failure to deserialize.HCatException@InterfaceAudience.LimitedPrivate(value="Hive") @InterfaceStability.Evolving public abstract List<String> serializePartitionSpec(HCatPartitionSpec partitionSpec) throws HCatException
partitionSpec - HCatPartitionSpec to be serialized.HCatException - On failure to serialize.@InterfaceAudience.LimitedPrivate(value="Hive") @InterfaceStability.Evolving public abstract HCatPartitionSpec deserializePartitionSpec(List<String> hcatPartitionSpecStrings) throws HCatException
hcatPartitionSpecStrings - List of strings, representing the HCatPartitionSpec as a whole.HCatException - On failure to deserialize.public abstract void createTableLike(String dbName, String existingTblName, String newTableName, boolean ifNotExists, boolean isExternal, 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.HCatExceptionpublic abstract void dropTable(String dbName, 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.HCatExceptionpublic abstract void renameTable(String dbName, String oldName, 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.HCatExceptionpublic abstract List<HCatPartition> getPartitions(String dbName, String tblName) throws HCatException
dbName - The name of the database.tblName - The name of the table.HCatExceptionpublic abstract List<HCatPartition> getPartitions(String dbName, String tblName, Map<String,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@InterfaceAudience.LimitedPrivate(value="Hive") @InterfaceStability.Evolving public abstract HCatPartitionSpec getPartitionSpecs(String dbName, String tableName, int maxPartitions) throws HCatException
HCatException@InterfaceAudience.LimitedPrivate(value="Hive") @InterfaceStability.Evolving public abstract HCatPartitionSpec getPartitionSpecs(String dbName, String tableName, Map<String,String> partitionSelector, int maxPartitions) throws HCatException
HCatExceptionpublic abstract HCatPartition getPartition(String dbName, String tableName, Map<String,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.HCatExceptionpublic abstract void addPartition(HCatAddPartitionDesc partInfo) throws HCatException
partInfo - An instance of HCatAddPartitionDesc.HCatExceptionpublic abstract int addPartitions(List<HCatAddPartitionDesc> partInfoList) throws HCatException
partInfoList - A list of HCatAddPartitionDesc.HCatException@InterfaceAudience.LimitedPrivate(value="Hive") @InterfaceStability.Evolving public abstract int addPartitionSpec(HCatPartitionSpec partitionSpec) throws HCatException
partitionSpec - The HCatPartitionSpec representing the set of partitions added.HCatException - On failure to add partitions.public abstract void dropPartitions(String dbName, String tableName, Map<String,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,ConnectionFailureExceptionHCatExceptionpublic abstract void dropPartitions(String dbName, String tableName, Map<String,String> partitionSpec, boolean ifExists, boolean deleteData) 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.deleteData - Whether to delete the underlying data.HCatException,ConnectionFailureExceptionHCatExceptionpublic abstract List<HCatPartition> listPartitionsByFilter(String dbName, String tblName, 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@InterfaceAudience.LimitedPrivate(value="Hive") @InterfaceStability.Evolving public abstract HCatPartitionSpec listPartitionSpecsByFilter(String dbName, String tblName, String filter, int maxPartitions) throws HCatException
HCatExceptionpublic abstract void markPartitionForEvent(String dbName, String tblName, Map<String,String> partKVs, org.apache.hadoop.hive.metastore.api.PartitionEventType eventType) throws HCatException
dbName - The database name.tblName - The table name.partKVs - the key-values associated with the partition.eventType - the event typeHCatExceptionpublic abstract boolean isPartitionMarkedForEvent(String dbName, String tblName, Map<String,String> partKVs, org.apache.hadoop.hive.metastore.api.PartitionEventType eventType) throws HCatException
dbName - the db nametblName - the table namepartKVs - the key-values associated with the partition.eventType - the event typeHCatExceptionpublic abstract String getDelegationToken(String owner, String renewerKerberosPrincipalName) throws HCatException
owner - the ownerrenewerKerberosPrincipalName - the renewer kerberos principal nameHCatException,ConnectionFailureExceptionHCatExceptionpublic abstract long renewDelegationToken(String tokenStrForm) throws HCatException
tokenStrForm - the token stringHCatExceptionpublic abstract void cancelDelegationToken(String tokenStrForm) throws HCatException
tokenStrForm - the token stringHCatExceptionpublic abstract String getMessageBusTopicName(String dbName, String tableName) throws HCatException
dbName - The name of the DB.tableName - The name of the table.HCatException@InterfaceStability.Evolving public abstract Iterator<ReplicationTask> getReplicationTasks(long lastEventId, int maxEvents, String dbName, String tableName) throws HCatException
lastEventId - : The last event id that was processed for this reader. The returned
replication tasks will start from this point forwardmaxEvents - : Maximum number of events to consider for generating the
replication tasks. If < 1, then all available events will be considered.dbName - : The database name for which we're interested in the events for.tableName - : The table name for which we're interested in the events for - if null,
then this function will behave as if it were running at a db level.HCatException@InterfaceAudience.LimitedPrivate(value="Hive") @InterfaceStability.Evolving public abstract List<HCatNotificationEvent> getNextNotification(long lastEventId, int maxEvents, IMetaStoreClient.NotificationFilter filter) throws HCatException
lastEventId - The last event id that was consumed by this reader. The returned
notifications will start at the next eventId available this eventId that
matches the filter.maxEvents - Maximum number of events to return. If < 1, then all available events will
be returned.filter - Filter to determine if message should be accepted. If null, then all
available events up to maxEvents will be returned.HCatException@InterfaceAudience.LimitedPrivate(value="Hive") @InterfaceStability.Evolving public abstract long getCurrentNotificationEventId() throws HCatException
HCatExceptionpublic abstract void close()
throws HCatException
HCatExceptionCopyright © 2019 The Apache Software Foundation. All Rights Reserved.