Search in sources :

Example 6 with HiveSyncConfig

use of org.apache.hudi.hive.HiveSyncConfig in project hudi by apache.

the class HiveSyncFunctionalTestHarness method dropTables.

public void dropTables(String database, String... tables) throws IOException, HiveException, MetaException {
    HiveSyncConfig hiveSyncConfig = hiveSyncConf();
    hiveSyncConfig.databaseName = database;
    for (String table : tables) {
        hiveSyncConfig.tableName = table;
        new HiveQueryDDLExecutor(hiveSyncConfig, fs(), hiveConf()).runSQL("drop table if exists " + table);
    }
}
Also used : HiveSyncConfig(org.apache.hudi.hive.HiveSyncConfig) HiveQueryDDLExecutor(org.apache.hudi.hive.ddl.HiveQueryDDLExecutor)

Example 7 with HiveSyncConfig

use of org.apache.hudi.hive.HiveSyncConfig in project hudi by apache.

the class HoodieDLAClient method toHiveSyncConfig.

private HiveSyncConfig toHiveSyncConfig() {
    HiveSyncConfig hiveSyncConfig = new HiveSyncConfig();
    hiveSyncConfig.partitionFields = dlaConfig.partitionFields;
    hiveSyncConfig.databaseName = dlaConfig.databaseName;
    Path basePath = new Path(dlaConfig.basePath);
    hiveSyncConfig.basePath = generateAbsolutePathStr(basePath);
    return hiveSyncConfig;
}
Also used : Path(org.apache.hadoop.fs.Path) HiveSyncConfig(org.apache.hudi.hive.HiveSyncConfig)

Example 8 with HiveSyncConfig

use of org.apache.hudi.hive.HiveSyncConfig in project hudi by apache.

the class TestHiveIncrementalPuller method getTargetHiveSyncConfig.

private HiveSyncConfig getTargetHiveSyncConfig(String basePath) {
    HiveSyncConfig config = HiveSyncConfig.copy(hiveSyncConfig);
    config.databaseName = "tgtdb";
    config.tableName = "test2";
    config.basePath = basePath;
    config.batchSyncNum = 3;
    config.syncMode = "jdbc";
    return config;
}
Also used : HiveSyncConfig(org.apache.hudi.hive.HiveSyncConfig)

Example 9 with HiveSyncConfig

use of org.apache.hudi.hive.HiveSyncConfig 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)

Example 10 with HiveSyncConfig

use of org.apache.hudi.hive.HiveSyncConfig in project hudi by apache.

the class UtilitiesTestBase method getHiveSyncConfig.

/**
 * Helper to get hive sync config.
 *
 * @param basePath
 * @param tableName
 * @return
 */
protected static HiveSyncConfig getHiveSyncConfig(String basePath, String tableName) {
    HiveSyncConfig hiveSyncConfig = new HiveSyncConfig();
    hiveSyncConfig.jdbcUrl = "jdbc:hive2://127.0.0.1:9999/";
    hiveSyncConfig.hiveUser = "";
    hiveSyncConfig.hivePass = "";
    hiveSyncConfig.databaseName = "testdb1";
    hiveSyncConfig.tableName = tableName;
    hiveSyncConfig.basePath = basePath;
    hiveSyncConfig.assumeDatePartitioning = false;
    hiveSyncConfig.usePreApacheInputFormat = false;
    hiveSyncConfig.partitionFields = CollectionUtils.createImmutableList("datestr");
    return hiveSyncConfig;
}
Also used : HiveSyncConfig(org.apache.hudi.hive.HiveSyncConfig)

Aggregations

HiveSyncConfig (org.apache.hudi.hive.HiveSyncConfig)20 HiveConf (org.apache.hadoop.hive.conf.HiveConf)5 HiveSyncTool (org.apache.hudi.hive.HiveSyncTool)3 HiveQueryDDLExecutor (org.apache.hudi.hive.ddl.HiveQueryDDLExecutor)3 FileSystem (org.apache.hadoop.fs.FileSystem)2 TypedProperties (org.apache.hudi.common.config.TypedProperties)2 HoodieHiveClient (org.apache.hudi.hive.HoodieHiveClient)2 Test (org.junit.jupiter.api.Test)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 Connection (java.sql.Connection)1 ResultSet (java.sql.ResultSet)1 Statement (java.sql.Statement)1 ArrayList (java.util.ArrayList)1 Configuration (org.apache.hadoop.conf.Configuration)1 Path (org.apache.hadoop.fs.Path)1 ZookeeperTestService (org.apache.hudi.common.testutils.minicluster.ZookeeperTestService)1 JDBCExecutor (org.apache.hudi.hive.ddl.JDBCExecutor)1 QueryBasedDDLExecutor (org.apache.hudi.hive.ddl.QueryBasedDDLExecutor)1 DummySchemaProvider (org.apache.hudi.utilities.DummySchemaProvider)1 HoodieDeltaStreamer (org.apache.hudi.utilities.deltastreamer.HoodieDeltaStreamer)1