[HUDI-394] Provide a basic implementation of test suite
This commit is contained in:
@@ -112,6 +112,15 @@ public class HiveSyncTool {
|
||||
+ " of type " + hoodieHiveClient.getTableType());
|
||||
// Check if the necessary table exists
|
||||
boolean tableExists = hoodieHiveClient.doesTableExist(tableName);
|
||||
|
||||
// check if the database exists else create it
|
||||
try {
|
||||
hoodieHiveClient.updateHiveSQL("create database if not exists " + cfg.databaseName);
|
||||
} catch (Exception e) {
|
||||
// this is harmless since table creation will fail anyways, creation of DB is needed for in-memory testing
|
||||
LOG.warn("Unable to create database", e);
|
||||
}
|
||||
|
||||
// Get the parquet schema for this table looking at the latest commit
|
||||
MessageType schema = hoodieHiveClient.getDataSchema();
|
||||
// Sync schema if needed
|
||||
|
||||
@@ -572,4 +572,8 @@ public class HoodieHiveClient {
|
||||
return new PartitionEvent(PartitionEventType.UPDATE, storagePartition);
|
||||
}
|
||||
}
|
||||
|
||||
public IMetaStoreClient getClient() {
|
||||
return client;
|
||||
}
|
||||
}
|
||||
@@ -126,10 +126,21 @@ public class HiveTestService {
|
||||
public void stop() {
|
||||
resetSystemProperties();
|
||||
if (tServer != null) {
|
||||
tServer.stop();
|
||||
try {
|
||||
tServer.stop();
|
||||
} catch (Exception e) {
|
||||
LOG.error("Stop meta store failed", e);
|
||||
}
|
||||
}
|
||||
if (hiveServer != null) {
|
||||
hiveServer.stop();
|
||||
try {
|
||||
hiveServer.stop();
|
||||
} catch (Exception e) {
|
||||
LOG.error("Stop hive server failed", e);
|
||||
}
|
||||
}
|
||||
if (executorService != null) {
|
||||
executorService.shutdownNow();
|
||||
}
|
||||
LOG.info("Hive Minicluster service shut down.");
|
||||
tServer = null;
|
||||
|
||||
Reference in New Issue
Block a user