THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
we can use a wrapper to wrap a IMetaStoreClient and HiveShim , thus we can create different version of IMetaStoreClient by using HiveShim#getHiveMetastoreClient. The pseudocode below illustrates this process.
Code Block | ||
---|---|---|
| ||
public interface HiveShim extends Serializable {
/**
* Create a Hive Metastore client based on the given HiveConf object.
*
* @param hiveConf HiveConf instance
* @return an IMetaStoreClient instance
*/
IMetaStoreClient getHiveMetastoreClient(HiveConf hiveConf);
/**
* Alters a Hive table.
*
* @param client the Hive metastore client
* @param databaseName the name of the database to which the table belongs
* @param tableName the name of the table to be altered
* @param table the new Hive table
*/
void alterTable(IMetaStoreClient client, String databaseName, String tableName, Table table)
throws InvalidOperationException, MetaException, TException;
void alterPartition(IMetaStoreClient client, String databaseName, String tableName, Partition partition)
throws InvalidOperationException, MetaException, TException;
...
...
...
}
HiveShim hiveShim = HiveShimLoader.loadHiveShim(hiveVersion);
IMetaStoreClient createMetastoreClient() {
return hiveShim.getHiveMetastoreClient(hiveConf);
}
IMetaStoreClient client = createMetastoreClient(); |
...