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(List<HCatAddPartitionDesc> partInfoList)
Adds a list of partitions.
|
int |
addPartitionSpec(HCatPartitionSpec partitionSpec)
Adds partitions using HCatPartitionSpec.
|
void |
cancelDelegationToken(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(String dbName,
String existingTblName,
String newTableName,
boolean ifNotExists,
boolean isExternal,
String location)
Creates the table like an existing table.
|
HCatPartition |
deserializePartition(String hcatPartitionStringRep)
Deserializer for an HCatPartition.
|
List<HCatPartition> |
deserializePartitions(List<String> hcatPartitionStringReps)
Deserializer for a list of HCatPartition strings.
|
HCatPartitionSpec |
deserializePartitionSpec(List<String> hcatPartitionSpecStrings)
Deserializer for HCatPartitionSpec.
|
HCatTable |
deserializeTable(String hcatTableStringRep)
Deserializer for HCatTable.
|
void |
dropDatabase(String dbName,
boolean ifExists,
HCatClient.DropDBMode mode)
Drops a database.
|
void |
dropPartitions(String dbName,
String tableName,
Map<String,String> partitionSpec,
boolean ifExists)
Drops partition(s) that match the specified (and possibly partial) partition specification.
|
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.
|
void |
dropTable(String dbName,
String tableName,
boolean ifExists)
Drop table.
|
String |
getConfVal(String key,
String defaultVal)
Fetch configuration value on conf that the HCatClient is instantiated
against.
|
long |
getCurrentNotificationEventId()
Get the most recently used notification id.
|
HCatDatabase |
getDatabase(String dbName)
Gets the database.
|
String |
getDelegationToken(String owner,
String renewerKerberosPrincipalName)
Gets the delegation token.
|
String |
getMessageBusTopicName(String dbName,
String tableName)
Retrieve Message-bus topic for a table.
|
List<HCatNotificationEvent> |
getNextNotification(long lastEventId,
int maxEvents,
IMetaStoreClient.NotificationFilter filter)
Get a list of notifications
|
HCatPartition |
getPartition(String dbName,
String tableName,
Map<String,String> partitionSpec)
Gets the partition.
|
List<HCatPartition> |
getPartitions(String dbName,
String tblName)
Gets all the partitions.
|
List<HCatPartition> |
getPartitions(String dbName,
String tblName,
Map<String,String> partitionSpec)
Gets all the partitions that match the specified (and possibly partial) partition specification.
|
HCatPartitionSpec |
getPartitionSpecs(String dbName,
String tableName,
int maxPartitions)
Gets partitions in terms of generic HCatPartitionSpec instances.
|
HCatPartitionSpec |
getPartitionSpecs(String dbName,
String tableName,
Map<String,String> partitionSelector,
int maxPartitions)
Gets partitions in terms of generic HCatPartitionSpec instances.
|
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.
|
HCatTable |
getTable(String dbName,
String tableName)
Gets the table.
|
boolean |
isPartitionMarkedForEvent(String dbName,
String tblName,
Map<String,String> partKVs,
PartitionEventType eventType)
Checks if a partition is marked for event.
|
List<String> |
listDatabaseNamesByPattern(String pattern)
Get all existing databases that match the given
pattern.
|
List<HCatPartition> |
listPartitionsByFilter(String dbName,
String tblName,
String filter)
List partitions by filter.
|
HCatPartitionSpec |
listPartitionSpecsByFilter(String dbName,
String tblName,
String filter,
int maxPartitions)
List partitions by filter, but as HCatPartitionSpecs.
|
List<String> |
listTableNamesByPattern(String dbName,
String tablePattern)
Returns all existing tables from the specified database which match the given
pattern.
|
void |
markPartitionForEvent(String dbName,
String tblName,
Map<String,String> partKVs,
PartitionEventType eventType)
Mark partition for event.
|
void |
renameTable(String dbName,
String oldName,
String newName)
Renames a table.
|
long |
renewDelegationToken(String tokenStrForm)
Renew delegation token.
|
String |
serializePartition(HCatPartition hcatPartition)
Serializer for HCatPartition.
|
List<String> |
serializePartitions(List<HCatPartition> hcatPartitions)
Serializer for a list of HCatPartition.
|
List<String> |
serializePartitionSpec(HCatPartitionSpec partitionSpec)
Serializer for HCatPartitionSpec.
|
String |
serializeTable(HCatTable hcatTable)
Serializer for HCatTable.
|
void |
updateTableSchema(String dbName,
String tableName,
HCatTable newTableDefinition)
Updates the Table's whole schema (including column schema, I/O Formats, SerDe definitions, etc.)
|
void |
updateTableSchema(String dbName,
String tableName,
List<HCatFieldSchema> columnSchema)
Updates the Table's column schema to the specified definition.
|
createpublic List<String> listDatabaseNamesByPattern(String pattern) throws HCatException
HCatClientlistDatabaseNamesByPattern in class HCatClientpattern - java re patternHCatExceptionpublic HCatDatabase getDatabase(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(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 List<String> listTableNamesByPattern(String dbName, 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(String dbName, 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(String dbName, String tableName, 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 updateTableSchema(String dbName, String tableName, HCatTable newTableDefinition) throws HCatException
HCatClientupdateTableSchema in class HCatClientdbName - The name of the database.tableName - The name of the table.newTableDefinition - The (new) definition of the table.HCatExceptionpublic void createTableLike(String dbName, String existingTblName, String newTableName, boolean ifNotExists, boolean isExternal, 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(String dbName, 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(String dbName, String oldName, 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 List<HCatPartition> getPartitions(String dbName, String tblName) throws HCatException
HCatClientgetPartitions in class HCatClientdbName - The name of the database.tblName - The name of the table.HCatExceptionpublic List<HCatPartition> getPartitions(String dbName, String tblName, Map<String,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.)HCatException@InterfaceAudience.LimitedPrivate(value="Hive") @InterfaceStability.Evolving public HCatPartitionSpec getPartitionSpecs(String dbName, String tableName, int maxPartitions) throws HCatException
HCatClientgetPartitionSpecs in class HCatClientHCatExceptionpublic HCatPartitionSpec getPartitionSpecs(String dbName, String tableName, Map<String,String> partitionSelector, int maxPartitions) throws HCatException
HCatClientgetPartitionSpecs in class HCatClientHCatExceptionpublic HCatPartition getPartition(String dbName, String tableName, Map<String,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(String dbName, String tableName, Map<String,String> partitionSpec, boolean ifExists, boolean deleteData) 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.deleteData - Whether to delete the underlying data.HCatExceptionpublic void dropPartitions(String dbName, String tableName, Map<String,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 List<HCatPartition> listPartitionsByFilter(String dbName, String tblName, 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.HCatException@InterfaceAudience.LimitedPrivate(value="Hive") @InterfaceStability.Evolving public HCatPartitionSpec listPartitionSpecsByFilter(String dbName, String tblName, String filter, int maxPartitions) throws HCatException
HCatClientlistPartitionSpecsByFilter in class HCatClientHCatExceptionpublic void markPartitionForEvent(String dbName, String tblName, Map<String,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(String dbName, String tblName, Map<String,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 String getDelegationToken(String owner, String renewerKerberosPrincipalName) throws HCatException
HCatClientgetDelegationToken in class HCatClientowner - the ownerrenewerKerberosPrincipalName - the renewer kerberos principal nameHCatExceptionpublic long renewDelegationToken(String tokenStrForm) throws HCatException
HCatClientrenewDelegationToken in class HCatClienttokenStrForm - the token stringHCatExceptionpublic void cancelDelegationToken(String tokenStrForm) throws HCatException
HCatClientcancelDelegationToken in class HCatClienttokenStrForm - the token stringHCatExceptionpublic String getConfVal(String key, String defaultVal)
HCatClientgetConfVal in class HCatClientkey - keyname to look updefaultVal - default value to furnish in case the key does not existpublic void close()
throws HCatException
HCatClientclose in class HCatClientHCatExceptionpublic int addPartitions(List<HCatAddPartitionDesc> partInfoList) throws HCatException
HCatClientaddPartitions in class HCatClientpartInfoList - A list of HCatAddPartitionDesc.HCatException@InterfaceAudience.LimitedPrivate(value="Hive") @InterfaceStability.Evolving public int addPartitionSpec(HCatPartitionSpec partitionSpec) throws HCatException
HCatClientaddPartitionSpec in class HCatClientpartitionSpec - The HCatPartitionSpec representing the set of partitions added.HCatException - On failure to add partitions.public String getMessageBusTopicName(String dbName, String tableName) throws HCatException
HCatClientgetMessageBusTopicName in class HCatClientdbName - The name of the DB.tableName - The name of the table.HCatExceptionpublic Iterator<ReplicationTask> getReplicationTasks(long lastEventId, int maxEvents, String dbName, String tableName) throws HCatException
HCatClientgetReplicationTasks in class HCatClientlastEventId - : 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.HCatExceptionpublic List<HCatNotificationEvent> getNextNotification(long lastEventId, int maxEvents, IMetaStoreClient.NotificationFilter filter) throws HCatException
HCatClientgetNextNotification in class HCatClientlastEventId - 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.HCatExceptionpublic long getCurrentNotificationEventId()
throws HCatException
HCatClientgetCurrentNotificationEventId in class HCatClientHCatExceptionpublic String serializeTable(HCatTable hcatTable) throws HCatException
HCatClientserializeTable in class HCatClienthcatTable - The HCatTable to be serialized into string formHCatExceptionpublic HCatTable deserializeTable(String hcatTableStringRep) throws HCatException
HCatClientdeserializeTable in class HCatClienthcatTableStringRep - The String representation of an HCatTable, presumably retrieved from HCatClient.serializeTable(HCatTable)HCatExceptionpublic String serializePartition(HCatPartition hcatPartition) throws HCatException
HCatClientserializePartition in class HCatClienthcatPartition - The HCatPartition instance to be serialized.HCatExceptionpublic List<String> serializePartitions(List<HCatPartition> hcatPartitions) throws HCatException
HCatClientserializePartitions in class HCatClienthcatPartitions - The HCatPartitions to be serialized.HCatExceptionpublic HCatPartition deserializePartition(String hcatPartitionStringRep) throws HCatException
HCatClientdeserializePartition in class HCatClienthcatPartitionStringRep - The String representation of the HCatPartition, presumably retrieved from HCatClient.serializePartition(HCatPartition)HCatExceptionpublic List<HCatPartition> deserializePartitions(List<String> hcatPartitionStringReps) throws HCatException
HCatClientdeserializePartitions in class HCatClienthcatPartitionStringReps - The list of HCatPartition strings to be deserialized.HCatExceptionpublic List<String> serializePartitionSpec(HCatPartitionSpec partitionSpec) throws HCatException
HCatClientserializePartitionSpec in class HCatClientpartitionSpec - HCatPartitionSpec to be serialized.HCatException - On failure to serialize.public HCatPartitionSpec deserializePartitionSpec(List<String> hcatPartitionSpecStrings) throws HCatException
HCatClientdeserializePartitionSpec in class HCatClienthcatPartitionSpecStrings - List of strings, representing the HCatPartitionSpec as a whole.HCatException - On failure to deserialize.Copyright © 2017 The Apache Software Foundation. All rights reserved.