public final class HMSClient extends Object implements AutoCloseable
Constructor and Description |
---|
HMSClient(@Nullable URI uri)
Connect to HMS and return a client instance.
|
HMSClient(@Nullable URI uri,
@Nullable String confDir)
Connect to HMS and return a client instance.
|
Modifier and Type | Method and Description |
---|---|
org.apache.hadoop.hive.metastore.api.Partition |
addPartition(@NotNull org.apache.hadoop.hive.metastore.api.Partition partition) |
void |
addPartitions(List<org.apache.hadoop.hive.metastore.api.Partition> partitions) |
void |
alterPartition(@NotNull String dbName,
@NotNull String tableName,
@NotNull org.apache.hadoop.hive.metastore.api.Partition partition) |
void |
alterPartitions(@NotNull String dbName,
@NotNull String tableName,
@NotNull List<org.apache.hadoop.hive.metastore.api.Partition> partitions) |
boolean |
alterTable(@NotNull String dbName,
@NotNull String tableName,
@NotNull org.apache.hadoop.hive.metastore.api.Table newTable) |
void |
appendPartition(@NotNull String dbName,
@NotNull String tableName,
@NotNull List<String> partitionValues) |
HMSClient |
Clone()
Return a new connected client using the same configuration as the original client.
|
void |
close() |
boolean |
createDatabase(org.apache.hadoop.hive.metastore.api.Database db) |
boolean |
createDatabase(@NotNull String name)
Create database with the given name if it doesn't exist
|
boolean |
createDatabase(@NotNull String name,
@Nullable String description,
@Nullable String location,
@Nullable Map<String,String> params)
Create database if it doesn't exist
|
org.apache.hadoop.hive.metastore.api.Partition |
createPartition(@NotNull org.apache.hadoop.hive.metastore.api.Table table,
@NotNull List<String> values) |
boolean |
createTable(org.apache.hadoop.hive.metastore.api.Table table) |
boolean |
dbExists(@NotNull String dbName)
Return True if given Hive database excists
|
boolean |
dropDatabase(@NotNull String dbName) |
boolean |
dropPartition(@NotNull String dbName,
@NotNull String tableName,
@NotNull List<String> arguments) |
org.apache.hadoop.hive.metastore.api.DropPartitionsResult |
dropPartitions(@NotNull String dbName,
@NotNull String tableName,
@Nullable List<String> partNames) |
boolean |
dropTable(@NotNull String dbName,
@NotNull String tableName) |
Set<String> |
getAllDatabases(@Nullable String filter)
Return all databases with name matching the filter.
|
Set<String> |
getAllTables(@NotNull String dbName,
@Nullable String filter)
Get all table names for a database matching the filter.
|
Long |
getCurrentNotificationId() |
org.apache.hadoop.hive.metastore.api.Database |
getDatabase(@NotNull String dbName)
Get full Database information.
|
List<String> |
getPartitionNames(@NotNull String dbName,
@NotNull String tableName) |
List<org.apache.hadoop.hive.metastore.api.Partition> |
getPartitions(@NotNull String dbName,
@NotNull String tableName) |
List<org.apache.hadoop.hive.metastore.api.Partition> |
getPartitionsByNames(@NotNull String dbName,
@NotNull String tableName,
@Nullable List<String> names) |
URI |
getServerURI() |
org.apache.hadoop.hive.metastore.api.Table |
getTable(@NotNull String dbName,
@NotNull String tableName) |
List<org.apache.hadoop.hive.metastore.api.Partition> |
listPartitions(@NotNull String dbName,
@NotNull String tableName) |
boolean |
tableExists(@NotNull String dbName,
@NotNull String tableName)
Return True if specified table exists
|
String |
toString() |
public HMSClient(@Nullable @Nullable URI uri) throws org.apache.thrift.TException, IOException, InterruptedException, LoginException, URISyntaxException
uri
- Hive Metastore URI.org.apache.thrift.TException
IOException
InterruptedException
LoginException
URISyntaxException
public HMSClient(@Nullable @Nullable URI uri, @Nullable @Nullable String confDir) throws org.apache.thrift.TException, IOException, InterruptedException, LoginException, URISyntaxException
uri
- Hive Metastore URI.confDir
- Directory with Hive configuration files - normally /etc/hive/conforg.apache.thrift.TException
IOException
InterruptedException
LoginException
URISyntaxException
public URI getServerURI()
public HMSClient Clone() throws InterruptedException, URISyntaxException, org.apache.thrift.TException, LoginException, IOException
InterruptedException
URISyntaxException
org.apache.thrift.TException
LoginException
IOException
public boolean dbExists(@NotNull @NotNull String dbName) throws org.apache.thrift.TException
dbName
- database nameorg.apache.thrift.TException
- if there is Thrift errorpublic boolean tableExists(@NotNull @NotNull String dbName, @NotNull @NotNull String tableName) throws org.apache.thrift.TException
dbName
- Database nametableName
- Table nameorg.apache.thrift.TException
- if there is Thrift errorpublic org.apache.hadoop.hive.metastore.api.Database getDatabase(@NotNull @NotNull String dbName) throws org.apache.thrift.TException
dbName
- Database name.org.apache.thrift.TException
- if there is Thrift errorpublic Set<String> getAllDatabases(@Nullable @Nullable String filter) throws org.apache.thrift.TException
filter
- Regexp. Can be null or empty in which case everything matchesorg.apache.thrift.TException
- when the call failspublic Set<String> getAllTables(@NotNull @NotNull String dbName, @Nullable @Nullable String filter) throws org.apache.thrift.TException
dbName
- Database namefilter
- regexp matching table nameorg.apache.thrift.TException
- if there is Thrift errorpublic boolean createDatabase(@NotNull @NotNull String name) throws org.apache.thrift.TException
name
- database nameorg.apache.thrift.TException
- if the call failspublic boolean createDatabase(@NotNull @NotNull String name, @Nullable @Nullable String description, @Nullable @Nullable String location, @Nullable @Nullable Map<String,String> params) throws org.apache.thrift.TException
name
- Database namedescription
- Database descriptionlocation
- Database locationparams
- Database paramsorg.apache.thrift.TException
- if call failspublic boolean createDatabase(org.apache.hadoop.hive.metastore.api.Database db) throws org.apache.thrift.TException
org.apache.thrift.TException
public boolean dropDatabase(@NotNull @NotNull String dbName) throws org.apache.thrift.TException
org.apache.thrift.TException
public boolean createTable(org.apache.hadoop.hive.metastore.api.Table table) throws org.apache.thrift.TException
org.apache.thrift.TException
public boolean dropTable(@NotNull @NotNull String dbName, @NotNull @NotNull String tableName) throws org.apache.thrift.TException
org.apache.thrift.TException
public org.apache.hadoop.hive.metastore.api.Table getTable(@NotNull @NotNull String dbName, @NotNull @NotNull String tableName) throws org.apache.thrift.TException
org.apache.thrift.TException
public org.apache.hadoop.hive.metastore.api.Partition createPartition(@NotNull @NotNull org.apache.hadoop.hive.metastore.api.Table table, @NotNull @NotNull List<String> values) throws org.apache.thrift.TException
org.apache.thrift.TException
public org.apache.hadoop.hive.metastore.api.Partition addPartition(@NotNull @NotNull org.apache.hadoop.hive.metastore.api.Partition partition) throws org.apache.thrift.TException
org.apache.thrift.TException
public void addPartitions(List<org.apache.hadoop.hive.metastore.api.Partition> partitions) throws org.apache.thrift.TException
org.apache.thrift.TException
public List<org.apache.hadoop.hive.metastore.api.Partition> listPartitions(@NotNull @NotNull String dbName, @NotNull @NotNull String tableName) throws org.apache.thrift.TException
org.apache.thrift.TException
public Long getCurrentNotificationId() throws org.apache.thrift.TException
org.apache.thrift.TException
public List<String> getPartitionNames(@NotNull @NotNull String dbName, @NotNull @NotNull String tableName) throws org.apache.thrift.TException
org.apache.thrift.TException
public boolean dropPartition(@NotNull @NotNull String dbName, @NotNull @NotNull String tableName, @NotNull @NotNull List<String> arguments) throws org.apache.thrift.TException
org.apache.thrift.TException
public List<org.apache.hadoop.hive.metastore.api.Partition> getPartitions(@NotNull @NotNull String dbName, @NotNull @NotNull String tableName) throws org.apache.thrift.TException
org.apache.thrift.TException
public org.apache.hadoop.hive.metastore.api.DropPartitionsResult dropPartitions(@NotNull @NotNull String dbName, @NotNull @NotNull String tableName, @Nullable @Nullable List<String> partNames) throws org.apache.thrift.TException
org.apache.thrift.TException
public List<org.apache.hadoop.hive.metastore.api.Partition> getPartitionsByNames(@NotNull @NotNull String dbName, @NotNull @NotNull String tableName, @Nullable @Nullable List<String> names) throws org.apache.thrift.TException
org.apache.thrift.TException
public boolean alterTable(@NotNull @NotNull String dbName, @NotNull @NotNull String tableName, @NotNull @NotNull org.apache.hadoop.hive.metastore.api.Table newTable) throws org.apache.thrift.TException
org.apache.thrift.TException
public void alterPartition(@NotNull @NotNull String dbName, @NotNull @NotNull String tableName, @NotNull @NotNull org.apache.hadoop.hive.metastore.api.Partition partition) throws org.apache.thrift.TException
org.apache.thrift.TException
public void alterPartitions(@NotNull @NotNull String dbName, @NotNull @NotNull String tableName, @NotNull @NotNull List<org.apache.hadoop.hive.metastore.api.Partition> partitions) throws org.apache.thrift.TException
org.apache.thrift.TException
public void appendPartition(@NotNull @NotNull String dbName, @NotNull @NotNull String tableName, @NotNull @NotNull List<String> partitionValues) throws org.apache.thrift.TException
org.apache.thrift.TException
public void close() throws Exception
close
in interface AutoCloseable
Exception
Copyright © 2018. All rights reserved.