Search in sources :

Example 1 with JDBCExecutor

use of org.apache.hudi.hive.ddl.JDBCExecutor in project hudi by apache.

the class UtilitiesTestBase method clearHiveDb.

/**
 * Initialize Hive DB.
 *
 * @throws IOException
 */
private static void clearHiveDb() throws IOException {
    HiveConf hiveConf = new HiveConf();
    // Create Dummy hive sync config
    HiveSyncConfig hiveSyncConfig = getHiveSyncConfig("/dummy", "dummy");
    hiveConf.addResource(hiveServer.getHiveConf());
    HoodieTableMetaClient.withPropertyBuilder().setTableType(HoodieTableType.COPY_ON_WRITE).setTableName(hiveSyncConfig.tableName).initTable(dfs.getConf(), hiveSyncConfig.basePath);
    QueryBasedDDLExecutor ddlExecutor = new JDBCExecutor(hiveSyncConfig, dfs);
    ddlExecutor.runSQL("drop database if exists " + hiveSyncConfig.databaseName);
    ddlExecutor.runSQL("create database " + hiveSyncConfig.databaseName);
    ddlExecutor.close();
}
Also used : HiveConf(org.apache.hadoop.hive.conf.HiveConf) QueryBasedDDLExecutor(org.apache.hudi.hive.ddl.QueryBasedDDLExecutor) HiveSyncConfig(org.apache.hudi.hive.HiveSyncConfig) JDBCExecutor(org.apache.hudi.hive.ddl.JDBCExecutor)

Aggregations

HiveConf (org.apache.hadoop.hive.conf.HiveConf)1 HiveSyncConfig (org.apache.hudi.hive.HiveSyncConfig)1 JDBCExecutor (org.apache.hudi.hive.ddl.JDBCExecutor)1 QueryBasedDDLExecutor (org.apache.hudi.hive.ddl.QueryBasedDDLExecutor)1